kin-openapi
kin-openapi copied to clipboard
new: add detetion for undescribed request parameters
Added the ability, when checking a request, to find parameters that are not described in the schema.
does openapi allow unspecified query params?
does openapi allow unspecified query params?
I think yes, but I'm not sure. But this functionality added for user, who has, for example, a lot of request/response and want to ensure, what specification consists full information about all parameters (later I want to add same check for request and response body).
@fenollp , what about pull-request?
Hi! This is interesting. Are you still looking to merge this?
I'm thinking that the OpenAPIv3 spec does not treat query params a certain way. Schemas do allow "undescribed query params" in that a schema for a parameter of type "query" may sport the setting additionalProperties: true
.
If you want a route not to accept query fields that are not listed in the spec, use additionalProperties: false
:
# ...
- name: MyQueryParam
in: query
schema: # only allows "?myOnlyProperty=42"
type: object
additionalProperties: false
properties:
myOnlyProperty:
type: number
# ...
@Alexey19 Feel free to re-open if needed.