-
Notifications
You must be signed in to change notification settings - Fork 9.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Headers properties should be case insensitive. #457
Comments
From a spec standpoint, there's really no issue. This is more around the processing of requests, which is out of the scope of the spec. |
There's an edge case where you can define two header parameters with the same names only with different cases. While valid for other parameter types, it's conceptually invalid for header parameters. Don't think this needs to be addressed by the spec though, it's more of a user error in that case. Just putting it on the table here. |
I'm on the fence about this. On the one hand, I agree with @Maks3w because most libraries I've ever used seem to work this way. On the other hand, I agree @jasonh-n-austin that consistency is more important than anything. I just don't see why anyone would use |
I agree with @webron that making uniqueness case-insensitive when specifying parameters makes some sense, but probably isn't that high priority. I guess I could see some argument that if you're using the OpenAPI Spec to validate incoming requests, case sensitivity could be an issue. However, that's still not a spec issue, that's on whatever implementation isn't following RFC7230 on header handling. Perhaps a 'caveat' in the spec might be useful to guide implementers. |
I think it should be spec'ed that headers need to be canonicalized. It should at the very least trigger a validation warning by the tools, consistently. |
Hi @jharmn, Would like to know the conclusion of this discussion. We have the same concern where the java-library in [1] has been used, which is built based on the OpenAPI specification. As per the Hypertext Transfer Protocol specification in [2] :
As per the OpenAPI specification v3.0 in [3] :
So that the OpenAPI specification not expecting to validate header names, case-sensitively. Rather stating to validate case-insensitively. Please verify. [1] https://bitbucket.org/atlassian/swagger-request-validator/src/swagger-request-validator-2.3.0/ Thanks |
Headers have been noted as case-insensitive in the spec for a while, and issue #2785 tracks adding a top-level comment, so I'm closing this issue in favor of that one. |
HTTP Header names are case insensitive. Swagger specification enforce to be case sensitive all field names without exceptions.
The specification should clarify headers names are case insensitive and must be validated in that way.
So the following schema:
Should be validate these headers as valid headers:
The text was updated successfully, but these errors were encountered: