-
Notifications
You must be signed in to change notification settings - Fork 83
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
Bean validation integration #531
Conversation
There's a commit to autoformat the code before my changes, since maven does this on every build. I must have forgotten to run a full build before my last PR |
I haven't quite got all of these passing on the smallrye impl yet but will work on that tomorrow. |
ead1edf
to
61a46c4
Compare
Updated because I'd been reading the wrong draft version of json schema when I was writing the tests. |
|
||
In some cases, additional schema restrictions can be inferred from Jakarta Bean Validation annotations and used to enhance the generated OpenAPI document. | ||
|
||
Vendors are required to process Jakarta Bean Validation annotations and add the properties listed in the table below to the schema model when: |
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.
Vendors are required to process Jakarta Bean Validation annotations and add the properties listed in the table below to the schema model when: | |
Implementors are required to process Jakarta Bean Validation annotations and add the properties listed in the table below to the schema model when: |
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.
I'm happy to change this, but "vendors" matches the language used in the rest of the spec, so I'll also raise an issue to consistently talk about implementers (or maybe implementations would be better)
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.
Updated to "Implementations are required"
<dependency> | ||
<groupId>jakarta.validation</groupId> | ||
<artifactId>jakarta.validation-api</artifactId> | ||
<version>3.0.0</version> |
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.
For now, you can specify the dependency here. I will need to raise an issue to tidy it up afterwards by putting the dependencies and versions in microprofile-parent so that all specs use the same version.
- Schema enhanced by certain bean validation annotations - Can be overridden by user - Can be disabled by config
61a46c4
to
3268ec6
Compare
@Negative | ||
private int negativeInt; | ||
|
||
@NegativeOrZero | ||
private int negativeOrZeroInt; | ||
|
||
@Positive | ||
private int positiveInt; | ||
|
||
@PositiveOrZero | ||
private int positiveOrZeroInt; |
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.
The intent with using the "exclusive" booleans with positive/negative wasn't immediately obvious to me due to the use of integers. Good catch.
Fixes #482