-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Add method getFluentBeanProperties to JavaClassElement #6415
Conversation
The method return the bean properties (declared or generated) in a fluent API. This is a pattern used with Lombok. See micronaut-projects/micronaut-openapi#593
* Deprecated. This can be removed in Micronaut 3.2.0 | ||
* | ||
* @param classElement The {@link TypeElement} | ||
* @param annotationMetadata The annotation metadata | ||
* @param visitorContext The visitor context | ||
* @param genericsInfo The generic type info | ||
* @param arrayDimensions The number of array dimensions | ||
*/ | ||
@Deprecated |
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.
If this PR is merged I will send a new PR to remove this for Micronaut 3.2.0 when I release a new version of micronaut-openapi
Can you explain why it doesn't make sense for Groovy or Kotlin? |
Personally I think we should instead add support for the element query API and allow:
Rather than adding yet another method |
The As far as I know Lombok only works with Java. Maybe is debatable that this pattern can be used with Groovy or Kotlin. From a Groovy point of view I've never used that patter before, I've only used Groovy's |
I will explore @graemerocher's suggestion as it seems a better approach :) |
Sorry, I've merged this by mistake 🤦♂️ . Reverting it now in #6477 |
…jects#6415) The method return the bean properties (declared or generated) in a fluent API. This is a pattern used with Lombok. See micronaut-projects/micronaut-openapi#593
See micronaut-projects/micronaut-openapi#593
This PR does two things:
getFluentBeanProperties
toClassElement
to return the bean properties declared in a "fluent" way, like when using Lombok. It only adds implementation for Java because it doesn't make sense for Groovy.getBeanProperties
that is now used for bothgetBeanProperties
andgetFluentBeanProperties
method.Basically in the current micronaut-openapi implementation there is a helper class that duplicates all the code extracted here to private methods. With this PR merged in core (and some changes I've already done in micronaut-openapi) I can remove that class and avoid using core's internal classes.
Without this merged micronaut-openapi won't use now internal classes but as mentioned before we will need to duplicate a lot of code and keep it in sync.
One final thought. I wasn't sure about including this new method in
ClassElement
instead of inJavaClassElement
so I can change it to the child class if necessary. Being inClassElement
simplifies even more micronaut-openapi because there is no need to check if code is Java or Groovy, though.