-
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
Add support for Atlassian swagger-request-validator library #118
Add support for Atlassian swagger-request-validator library #118
Conversation
...rc/main/java/io/github/belgif/rest/problem/openapi/OpenapiRequestViolationProblemAdvice.java
Outdated
Show resolved
Hide resolved
...alidation-spring-it/src/main/java/io/github/belgif/rest/problem/OpenApiValidationConfig.java
Outdated
Show resolved
Hide resolved
...rc/main/java/io/github/belgif/rest/problem/openapi/OpenapiRequestViolationProblemAdvice.java
Outdated
Show resolved
Hide resolved
@smals-mavh , would be best to update doc for this new feature, but might have to be coordinated with other doc changes in https://github.com/belgif/rest-problem-java/tree/feature/%23117-improve-documentation |
@pvdbosch I think a note somewhere in the docs that it supports mapping the InvalidRequestException from the atlassian lib to belgif-problem should be enough, the rest seems to work automagically with this conditionalOnClass. @jpraet ready for further review. |
...ommon/src/main/java/io/github/belgif/rest/problem/AbstractOpenApiValidationSpringBootIT.java
Outdated
Show resolved
Hide resolved
...src/main/java/io/github/belgif/rest/problem/spring/OpenApiRequestViolationProblemAdvice.java
Outdated
Show resolved
Hide resolved
...t/src/test/java/io/github/belgif/rest/problem/RestProblemOpenapiValidationSpringBoot3IT.java
Outdated
Show resolved
Hide resolved
...src/main/java/io/github/belgif/rest/problem/spring/OpenApiRequestViolationProblemAdvice.java
Outdated
Show resolved
Hide resolved
Implemented feedback |
belgif-rest-problem-it/belgif-rest-problem-openapi-validation-spring-boot-2-it/pom.xml
Outdated
Show resolved
Hide resolved
belgif-rest-problem-it/belgif-rest-problem-openapi-validation-spring-boot-2-it/pom.xml
Outdated
Show resolved
Hide resolved
belgif-rest-problem-it/belgif-rest-problem-openapi-validation-spring-boot-2-it/pom.xml
Outdated
Show resolved
Hide resolved
belgif-rest-problem-it/belgif-rest-problem-openapi-validation-spring-boot-3-it/pom.xml
Outdated
Show resolved
Hide resolved
belgif-rest-problem-it/belgif-rest-problem-openapi-validation-spring-boot-3-it/pom.xml
Outdated
Show resolved
Hide resolved
belgif-rest-problem-it/belgif-rest-problem-openapi-validation-spring-boot-3-it/pom.xml
Outdated
Show resolved
Hide resolved
...ommon/src/main/java/io/github/belgif/rest/problem/AbstractOpenApiValidationSpringBootIT.java
Show resolved
Hide resolved
...ommon/src/main/java/io/github/belgif/rest/problem/AbstractOpenApiValidationSpringBootIT.java
Show resolved
Hide resolved
...src/main/java/io/github/belgif/rest/problem/spring/OpenApiRequestViolationProblemAdvice.java
Outdated
Show resolved
Hide resolved
...ommon/src/main/java/io/github/belgif/rest/problem/AbstractOpenApiValidationSpringBootIT.java
Outdated
Show resolved
Hide resolved
...ommon/src/main/java/io/github/belgif/rest/problem/AbstractOpenApiValidationSpringBootIT.java
Outdated
Show resolved
Hide resolved
...ommon/src/main/java/io/github/belgif/rest/problem/AbstractOpenApiValidationSpringBootIT.java
Outdated
Show resolved
Hide resolved
...src/main/java/io/github/belgif/rest/problem/spring/OpenApiRequestViolationProblemAdvice.java
Outdated
Show resolved
Hide resolved
...src/main/java/io/github/belgif/rest/problem/spring/OpenApiRequestViolationProblemAdvice.java
Outdated
Show resolved
Hide resolved
…-request-validator
…lidator' of https://github.com/belgif/rest-problem-java into 97-support-exceptions-from-atlassian-swagger-request-validator
...em-spring-boot-2-it/src/main/java/io/github/belgif/rest/problem/OpenApiValidationConfig.java
Show resolved
Hide resolved
@clone1612 @jpraet @pvdbosch , Tried to implement all the feedback. The atlassian library gives one violation (message in validation report) for each object that is missing a required property. When one object is missing multiple properties, it provides all missing properties in the detail message, and the 'name' is the parent object. I think this is clear enough, and it might not be worth our time to split this out even further, because it would involve regex on the message (which might change / be translated).
or
The / in name is because it's in the root schema of the request body. For the allOf you had a good catch @clone1612 !
But just getting all the nested messages wouldn't work for oneOf / anyOf schemas, so in those cases, the detail message will be different, but it will remain just one issue:
|
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.
@smals-mavh Changes look good, thanks! Don't forget to add a release note in src/main/asciidoc/release-notes.adoc
when you're ready to merge.
Added documentation and releasenote (still for v0.9, since I didn't see that on maven central yet) |
...pring/src/main/java/io/github/belgif/rest/problem/spring/InvalidRequestExceptionHandler.java
Show resolved
Hide resolved
...pring/src/main/java/io/github/belgif/rest/problem/spring/InvalidRequestExceptionHandler.java
Outdated
Show resolved
Hide resolved
...pring/src/main/java/io/github/belgif/rest/problem/spring/InvalidRequestExceptionHandler.java
Outdated
Show resolved
Hide resolved
...pring/src/main/java/io/github/belgif/rest/problem/spring/InvalidRequestExceptionHandler.java
Outdated
Show resolved
Hide resolved
…-request-validator
…lidator' of https://github.com/belgif/rest-problem-java into 97-support-exceptions-from-atlassian-swagger-request-validator
…-request-validator
Quality Gate passedIssues Measures |
Currently only implemented for Spring Boot 3.
atlassian lib for SB3 is different from the SB2 one (swagger-request-validator-springmvc for sb2, swagger-request-validator-spring-webmvc for sb3).
Now the belgif-rest-problem-openapi-validation-spring library also comes with the belgif-rest-problem-spring-boot-3 lib which might be confusing.
Maybe we should rename belgif-rest-problem-openapi-validation-spring to belgif-rest-problem-openapi-validation-spring-boot-3 to be more clear on the fact that it (now) only supports SB3, and it already includes the other errormappers.
Or if someone has a better / more efficient idea, please let me know.
@jpraet ready for review.