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

Add @Singular + Switch statement/expression, arrays, better API #113

Merged
merged 4 commits into from
Jul 5, 2024

Conversation

dstepanov
Copy link
Collaborator

No description provided.

@dstepanov dstepanov requested a review from graemerocher July 5, 2024 08:32
String propertyName = beanProperty.getSimpleName();
String singularName = beanProperty.stringValue(Singular.class).orElse(null);
if (singularName == null) {
if (propertyName.endsWith("s")) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added

Copy link
Contributor

@graemerocher graemerocher left a 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

@dstepanov
Copy link
Collaborator Author

Should it be by default? Maybe it should be implemented in serde.

We might want to add some hint like @Buildable(MyBeanBuilder.class) and annotate the original class with the builder class reference. Serde can implement annotating it with @JsonDeserialize

@graemerocher
Copy link
Contributor

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?

@dstepanov
Copy link
Collaborator Author

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

Copy link

sonarqubecloud bot commented Jul 5, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 70%)
9 New Critical Issues (required ≤ 0)

See analysis details on SonarCloud

Catch issues before they fail your Quality Gate with our IDE extension SonarLint

@dstepanov dstepanov merged commit 4be507e into 1.2.x Jul 5, 2024
6 of 7 checks passed
@dstepanov dstepanov deleted the singular branch July 5, 2024 13:22
@graemerocher graemerocher added the type: enhancement New feature or request label Aug 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants