Is it possible to disallow unknown query parameters in an OpenAPI v3 spec?

Viewed 753

In OpenAPI, you can specify additionalProperties: false as part of an object schema to indicate that extra, unknown properties in a request or response body will be considered a validation error.

Is there any way to do something similar when specifying query parameters for an API? I want to indicate that requests including other query parameters beyond those explicitly documented will be considered an error and trigger an HTTP 400 response.

I see that you can mark individual parameters as required: true, but I can't find any way to say, "These are the only parameters allowed." Does the OpenAPI 3 spec allow this? If so, how?

0 Answers
Related