Skip to content

Assign query keys matching patternProperties to exploded object params - #526

Open
chuvayva wants to merge 1 commit into
interagent:masterfrom
chuvayva:pattern-properties-query-keys
Open

chuvayva wants to merge 1 commit into
interagent:masterfrom
chuvayva:pattern-properties-query-keys

Conversation

@chuvayva

Copy link
Copy Markdown

Closes #525.

A form-exploded object query parameter can describe its keys with patternProperties instead of properties. No query key was assigned to such a parameter, so strict_query_params reported every key as unknown, and without strict mode the keys were never validated against the patterns.

Now a query key goes into that parameter when it matches one of its patternProperties. openapi_parser then validates and coerces it against the matching schema, and the key no longer counts as unknown.

The rule stays narrow, as proposed in the issue:

  • Only keys that match a pattern are assigned. A key that matches nothing stays unknown.
  • A key that names another parameter, or a property of any exploded object, keeps its current meaning.
  • A key that matches the patterns of two parameters is assigned to neither.
  • Non-exploded objects and deepObject keys are unchanged.

With the repro from the issue:

?page=1&score_gteq=50       => 200 {"page" => 1, "filters" => {"score_gteq" => 50}}
?page=1&score_gteq=50&foo=1 => Unknown query parameter(s): foo

A form-exploded object parameter with patternProperties received no query
keys, so strict_query_params reported them as unknown and they were never
validated. Assign a key to the parameter when it matches one of its
patterns and nothing else declares it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Exploded query object with patternProperties: keys are reported as unknown parameters

1 participant