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

Bean validation integration #531

Merged
merged 3 commits into from
May 30, 2022

Conversation

Azquelt
Copy link
Member

@Azquelt Azquelt commented May 23, 2022

  • Schema enhanced by certain bean validation annotations
  • Can be overridden by user
  • Can be disabled by config

Fixes #482

@Azquelt
Copy link
Member Author

Azquelt commented May 23, 2022

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

@Azquelt
Copy link
Member Author

Azquelt commented May 23, 2022

I haven't quite got all of these passing on the smallrye impl yet but will work on that tomorrow.

@Azquelt Azquelt force-pushed the bean-validation-integration branch from ead1edf to 61a46c4 Compare May 24, 2022 15:26
@Azquelt
Copy link
Member Author

Azquelt commented May 24, 2022

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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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:

Copy link
Member Author

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)

Copy link
Member Author

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>
Copy link
Member

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.

Azquelt added 2 commits May 27, 2022 14:23
- Schema enhanced by certain bean validation annotations
- Can be overridden by user
- Can be disabled by config
@Azquelt Azquelt force-pushed the bean-validation-integration branch from 61a46c4 to 3268ec6 Compare May 27, 2022 13:23
Comment on lines +78 to +88
@Negative
private int negativeInt;

@NegativeOrZero
private int negativeOrZeroInt;

@Positive
private int positiveInt;

@PositiveOrZero
private int positiveOrZeroInt;
Copy link
Member

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.

@MikeEdgar MikeEdgar added this to the MP OpenAPI 3.1 milestone May 28, 2022
@Azquelt Azquelt merged commit 4fd62c5 into eclipse:master May 30, 2022
@Azquelt Azquelt removed this from the MP OpenAPI 3.1 milestone Jun 13, 2022
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

Successfully merging this pull request may close these issues.

MicroProfile Open API working with Bean Validation
3 participants