Repository navigation
Conversation
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>
| # @param [Array<OpenAPIParser::Schemas::Parameter>] params_for_location | ||
| # @param [Hash] raw_params | ||
| # @return [Hash{String => Array}] parameter name → assigned raw keys | ||
| def pattern_property_keys(params_for_location, raw_params) |
There was a problem hiding this comment.
issue (blocking): the new pattern matching also runs on header parameters. Matching request headers are moved into the object parameter.
deserialize_headers uses the same deserialize_params_by_location path. exploded_form_object? treats style: nil as form, but the default style for headers is simple. I ran this case against this branch: a header parameter X-Meta with an object schema and the pattern ^X-.
deserialize_headers({ 'X-Request-Id' => 'abc', 'Accept' => 'json' })
# => {"X-Meta" => {"X-Request-Id" => "abc"}, "Accept" => "json"}X-Request-Id no longer appears at the top level of committee.headers. The declared-properties branch already had this mismatch, but this PR spreads it to any header that matches a regex. That is a much wider net. The PR description limits the change to query keys, so the simplest fix is to guard on location:
def pattern_property_keys(params_for_location, raw_params, location)
return {} unless location == 'query'
...A better fix is to make exploded_form_object? resolve the style with the existing default_style(location) helper, so nil doesn't always mean form. That would fix the older properties case as well. Please add a header test either way.
There was a problem hiding this comment.
^ from a claude code session, so do let me know if anything seems off (seemed reasonable/accurate to me)
geemus
left a comment
There was a problem hiding this comment.
Sounds and looks good overall, just one gotcha around headers for you to please resolve and I think it should be good.
Closes #525.
A form-exploded object query parameter can describe its keys with
patternPropertiesinstead ofproperties. No query key was assigned to such a parameter, sostrict_query_paramsreported 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:
deepObjectkeys are unchanged.With the repro from the issue: