-
Notifications
You must be signed in to change notification settings - Fork 4
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 @Singular
+ Switch statement/expression, arrays, better API
#113
Conversation
String propertyName = beanProperty.getSimpleName(); | ||
String singularName = beanProperty.stringValue(Singular.class).orElse(null); | ||
if (singularName == null) { | ||
if (propertyName.endsWith("s")) { |
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.
not sure if we should make this logic smarter. Lombok seems to have stripped the logic from Rails to do this https://github.com/projectlombok/lombok/blob/master/src/core/lombok/core/handlers/singulars.txt
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.
Added
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.
Ok looks good. Next we need to add some tests to make sure Micronaut Serialization plus @Builder
/ @SuperBuilder
/ @Singular
works automatically especially with types that have private
constructors.
We should automatically be applying https://github.com/micronaut-projects/micronaut-serialization/blob/6b962e4f964a3a37f622f5f3e620b3abfc51498d/serde-jackson-tck/src/main/java/io/micronaut/serde/jackson/builder/TestBuildMe2.java#L6-L9
Should it be by default? Maybe it should be implemented in serde. We might want to add some hint like |
yeah probably makes sense to make it opt in though I wonder if the original class' constructor is private we would need to use the builder anyway? |
Yeah but I'm thinking where to implement it, I think it should be part of Serde to recognize the sourcegen builder annotation and apply some logic |
Quality Gate failedFailed conditions See analysis details on SonarCloud Catch issues before they fail your Quality Gate with our IDE extension SonarLint |
No description provided.