Skip to content
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

Payload validation skips application/json content when request contains charset parameter #450

Open
lancekf opened this issue Aug 30, 2023 · 0 comments

Comments

@lancekf
Copy link

lancekf commented Aug 30, 2023

Given payload validation is turned on for incoming requests and a requestBody defining content of application/json in the openapi spec
When a request is made with a Content-Type of application/json; charset=utf-8
Expectation:
Then the request is validated against the defined application/json content spec
Actual:
Then the request is not validated

This appears to be due to the request's content-type being used as a key for getting the appropriate media from the Content Map at:

io.swagger.v3.oas.models.media.MediaType media = content.get(mediaType.toString());

In this scenario, mediaType will be equal to application/json;charset=UTF-8 but content only has a mapping for application/json, thus media becomes null and validation is subsequently skipped.

Using swagger-inflector:2.0.8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant