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

JAX-RS parameters: support validation constraints and x-codegen-annotations extension #141

Merged
merged 6 commits into from May 23, 2023

Conversation

MikeEdgar
Copy link
Contributor

@MikeEdgar MikeEdgar commented Apr 27, 2023

Fixes #117

Signed-off-by: Michael Edgar <medgar@redhat.com>
Signed-off-by: Michael Edgar <medgar@redhat.com>
Signed-off-by: Michael Edgar <medgar@redhat.com>
Signed-off-by: Michael Edgar <medgar@redhat.com>
Signed-off-by: Michael Edgar <medgar@redhat.com>
@MikeEdgar MikeEdgar marked this pull request as ready for review April 28, 2023 20:06
Signed-off-by: Michael Edgar <medgar@redhat.com>
@MikeEdgar MikeEdgar requested review from EricWittmann, jsenko, carlesarnal and andreaTP and removed request for jsenko May 1, 2023 12:20
Copy link
Member

@andreaTP andreaTP left a comment

Choose a reason for hiding this comment

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

Amazing work @MikeEdgar !!!
Sorry for the delay in the review, I left a few comments, but looks like a great start!

if (constraintValue instanceof String) {
target.addAnnotation(annotationName).setStringValue(annotationProperty, constraintValue.toString());
} else if (constraintValue != null) {
target.addAnnotation(annotationName).setLiteralValue(annotationProperty, constraintValue.toString());
Copy link
Member

Choose a reason for hiding this comment

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

I think we should sanitize the constraintValue to make sure we are not using reserved keywords or invalid patterns.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Are you thinking specifically for Pattern constraints or more generally? I think we should be safe from reserved keyword use since the generator is in control of the annotation property names in this part of the code. The danger is present when the x-codegen-annotations is used, but ultimately anything invalid (reserved keywords or non-existent annotations/properties) specified by the user would fail to compile.

@MikeEdgar MikeEdgar requested a review from andreaTP May 22, 2023 14:07
@MikeEdgar
Copy link
Contributor Author

@andreaTP please let me know if you're good with my responses or if you have any other changes you'd like to see to this PR.

Copy link
Member

@andreaTP andreaTP left a comment

Choose a reason for hiding this comment

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

@MikeEdgar sorry for the delay! LGTM, thanks for the awesome contribution!

@MikeEdgar MikeEdgar merged commit 3838bda into Apicurio:main May 23, 2023
1 check passed
@MikeEdgar MikeEdgar deleted the issue-117 branch May 23, 2023 16:05
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.

Support custom parameter annotations
3 participants