-
Notifications
You must be signed in to change notification settings - Fork 0
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
Support fail on request/response violation #3
Conversation
import reactor.core.publisher.Mono; | ||
import reactor.test.StepVerifier; | ||
|
||
class OpenApiValidationWebFilterTest { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ℹ️ Very similar to the other test. Same approach used. Differences are mainly the mocking.
|
||
@Override | ||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { | ||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ℹ️ Changes here are copy paste from the non spring 2.7.
Different imports and/or minimal code changes like HttpStatus
vs HttpStatusCode
which changed in spring boot .
@@ -48,31 +51,107 @@ private Mono<Void> decorateWithValidation(ServerWebExchange exchange, WebFilterC | |||
|
|||
var serverWebExchange = exchange.mutate().request(requestDecorated).response(responseDecorated).build(); | |||
|
|||
var alreadyDidRequestValidation = validateRequestWithFailOnViolation(requestMetaData, requestDecorated); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ℹ️ Changes here are copy paste from the non spring 2.7.
Different imports and/or minimal code changes like HttpStatus
vs HttpStatusCode
which changed in spring boot .
This adds support for failing the request on violations.
In case of a request violation it will not execute the endpoint logic at all.
Configuration in
application.properties
withNote for reviewing: The WebFilter and HttpFilter in spring 2.7 modules are copy paste from the spring 3.0 ones with just the changes needed for spring 2.7 (different imports due to different package or class name).