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

skip body validation if body parser is not wired in the request chain #74

Closed
stevehu opened this issue Mar 6, 2019 · 1 comment
Closed
Assignees

Comments

@stevehu
Copy link
Contributor

stevehu commented Mar 6, 2019

As we know the openapi-validator and swagger-validator can validate the request body if the body is parsed by the body handler. For put, post and patch request, if the body is missing from the exchange attachment, an error message that indicates the body is missing will be returned. There are two different situations that we cannot use the body parser in the request chain as once the stream is consumed, it won't be available for the downstream handlers anymore.

  • Validation in light-router and light-proxy. We have to keep the body stream to pass to the downstream service so we cannot consume it.

  • In light-spring-boot application. We have to keep the body so that Spring Boot can consume it.

To ensure that the two situations are handled correctly, we have to skip the body validation in the validator if the body cannot be found in the exchange. So the idea is to add another flag in the openapi-validator.yml and swagger-validator.yml to skip the body validation. Other parts of the request are still validated.

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