I am not sure whether that's on purpose or whether that's a bug, but I've just spotted a (imo) surprising behaviour during deep object validation. Given schema definition like this:
paths:
/foo:
get:
parameters:
- name: filters
in: query
required: false
style: deepObject
explode: true
schema:
type: object
properties:
first:
type: array
items:
type: string
second:
type: array
items:
type: string
When making a request with following params:
filters=foo
filters[]=1&filters[]=2
the validation passed.
This surprised me because I'd expect it to fail as neither string nor array should be allowed, should they? Since in rails app you can then access the params[:filters] and it's a string or an array (respectively) it creates a risky precedence.
It's caused by the OpenapiParameters::Query#parse_deep_object where prop_key = key.match(prop_regx)&.[](1) returns nil because the regex won't match keys like filters nor filters[].
I am not sure whether that's on purpose or whether that's a bug, but I've just spotted a (imo) surprising behaviour during deep object validation. Given schema definition like this:
When making a request with following params:
filters=foofilters[]=1&filters[]=2the validation passed.
This surprised me because I'd expect it to fail as neither string nor array should be allowed, should they? Since in rails app you can then access the
params[:filters]and it's a string or an array (respectively) it creates a risky precedence.It's caused by the
OpenapiParameters::Query#parse_deep_objectwhereprop_key = key.match(prop_regx)&.[](1)returnsnilbecause the regex won't match keys likefiltersnorfilters[].