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

孤街浪徒 提交于 2021-01-28 02:02:56

问题


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?

来源:https://stackoverflow.com/questions/58187233/is-it-possible-to-disallow-unknown-query-parameters-in-an-openapi-v3-spec

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!