-
Notifications
You must be signed in to change notification settings - Fork 534
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
Validation classes, OAS 3 Router Factory and OAS 3 Validation handler #666
Conversation
Removed asynchronous implementation of validator Implemented form validation, query validation, path validation, headers validation, custom validators, file name validation inside BaseValidationHandler Refactored some class names
Writed functions and javadocs of HTTPRequestValidationHandler interface Writed Javadoc of ValidationHandler Writed Javadoc of CustomValidator Switched from String regexp to Pattern regexp object to allow pattern check Writed function and Javadoc for HTTPOperationRequestValidationHandler interface Moved ParameterType and ParameterLocation Added to pom.xml swagger-parser library
Writed tests for parameter type validation methods Started writing HTTPRequestValidationTest Improved queryParams method test inside RouterTest
Refactored ValidationRule: Moved and renamed in ParameterValidationRule and now check array params internally Created NumericTypeValidator, StringEnumTypeValidator, StringTypeValidator (from PatternTypeValidator) Refactored ValidationException, BaseValidationHandler, HTTPRequestValidationHandler to support new validation mechanism
Now an array param is managed by ParameterValidationRule only if collection format is multi (for example /hello?param=value¶m=value2 ), every other types of collection formats are managed by ArrayTypeValidator Added some tests to Swagger2RequestValidationHandlerTest Added long type suppport in Swagger 2 operation parsing Added 400 response when content type not found
…olean function and it can throw a ValidationException (but only with a message and a ErrorType) Removed Swagger2RequestValidationHandler Refactored validation behavior for arrays and objects to support OpenAPI 3
Removed Swagger2RequestValidationHandler Refactored validation behavior for arrays and objects to support OpenAPI 3
Renamed OpenAPI3RequestValidationHandler
Added some tests to OpenAPI3ValidationTest
Merged RouteImpl queryParams() fix
Refactored validation mechanism to allow request parameters encapsulation Added some unit tests
Added JsonObject in RequestParameter Added cookie validation support Wrote some tests for OpenAPI3
Added more unit tests to for OpenAPI3
Fixed code generation errors
Added OpenAPI3RouterFactoryTest and tested OpenAPI3RouterFactory
Added unit test for multipart support
Refactored code and APIs to Vertx project guidelines Added isEmpty() as alias of isNull() in RequestParameter
added basic poms for api contracts
# Conflicts: # vertx-web/src/main/asciidoc/enums.adoc # vertx-web/src/main/java/examples/WebExamples.java
encoding shoulb be on the same level as schema in a MediaType https://swagger.io/specification/#mediaTypeObject
in /pets/{petId}, if petId is defined as a string, then 3 is a valid value (it will be seen as "3"). Just changing string to number and adapating 3 tests.
The swagger-parser doesn't resolve by default $ref schemas. There is an option in the parser to activate it, but it has side effects (no more allOf for instance since all items of an allOf array are merged into one single schema) So when a parameter schema has a $ref, this schema is overridden by the $ref schema, found in the spec object
Since a parameter can be 'not required', if it is not in the request, it does not mean it's an error
Since the spec validation is always done with the swagger-parser.
It allows using the modified version of the swagger-parser in my repo : https://github.com/phiz71/swagger-parser Waiting for my PRs to be merged.
since package-info has been modified
Added test for circular references Removed jitpack from maven repositories
Thank you to @phiz71 work, now we use official swagger-parser library (v2) published to maven central. All test pass and now this code is ready to be merged. |
Maybe we should wait for a 2.0.0-rc1 instead of a SNAPSHOT ? |
@@ -46,6 +46,18 @@ | |||
<optional>true</optional> | |||
</dependency> | |||
|
|||
<!-- Validation dependencies --> |
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.
these dependencies should go with the oas module pom not the root pom
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.
They are only about json validation, that is included inside vertx-web module
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.
Yes I understand but they should be declared on the module Pom not the top level because otherwise users not using oas will get them included in their projects without needing it
Rc1 of Swagger-parser has been released. It contains all the PRs I made and that are necessary for vertx-web-oas. |
can we finish the review of this PR so it can be merged for 3.5 ? |
@slinkydeveloper @phiz71 thank you. I've moved some code around to keep this feature isolated on its own module and we should have on 3.5 as tech preview. |
I feel proud, even if did 1% of the whole work 😄 |
we consider your OSS project as a contribute to Vert.x in general :-) |
GSoC project completed! Now I'm ready for the next one 😄! |
This PR provides the three main features of the project:
Also I provide tests for validation and oas3 inside respective packages