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
Conversation
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>
Signed-off-by: Michael Edgar <medgar@redhat.com>
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.
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()); |
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 think we should sanitize the constraintValue
to make sure we are not using reserved keywords or invalid patterns.
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.
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.
core/src/main/java/io/apicurio/hub/api/codegen/jaxrs/OpenApi2CodegenVisitor.java
Show resolved
Hide resolved
@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. |
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.
@MikeEdgar sorry for the delay! LGTM, thanks for the awesome contribution!
Fixes #117