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

Fix readonly properties for generator. #1165

Merged

Conversation

altro3
Copy link
Collaborator

@altro3 altro3 commented Aug 12, 2023

Fixed #1160

@altro3 altro3 requested a review from andriy-dmytruk August 12, 2023 08:21
@altro3 altro3 force-pushed the fix-readonly-fro-generator branch 3 times, most recently from 3fdef6e to 536fcdd Compare August 16, 2023 18:31
@altro3 altro3 force-pushed the fix-readonly-fro-generator branch from 536fcdd to e034b27 Compare August 17, 2023 12:44
@altro3 altro3 requested a review from dstepanov August 17, 2023 13:16
@altro3
Copy link
Collaborator Author

altro3 commented Aug 17, 2023

@andriy-dmytruk @dstepanov Could you review it and merge?

@@ -113,13 +115,20 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#vendorE
{{/vars}}

{{#requiredPropertiesInConstructor}}
public {{classname}}({{#vendorExtensions.requiredVarsWithoutDiscriminator}}{{{datatypeWithEnum}}} {{name}}{{^-last}}, {{/-last}}{{/vendorExtensions.requiredVarsWithoutDiscriminator}}{{#vendorExtensions.areRequiredVarsAndReadOnlyVars}}, {{/vendorExtensions.areRequiredVarsAndReadOnlyVars}}{{#readOnlyVars}}{{{datatypeWithEnum}}} {{name}}{{^-last}}, {{/-last}}{{/readOnlyVars}}) {
public {{classname}}({{#vendorExtensions.requiredVarsWithoutDiscriminator}}{{#isReadOnly}}{{#vendorExtensions.isServer}}{{^-first}}, {{/-first}}{{{datatypeWithEnum}}} {{name}}{{/vendorExtensions.isServer}}{{/isReadOnly}}{{^isReadOnly}}{{^-first}}, {{/-first}}{{{datatypeWithEnum}}} {{name}}{{/isReadOnly}}{{/vendorExtensions.requiredVarsWithoutDiscriminator}}) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We could make a vendor extension isWrittable instead to not repeat the code twice, but this is fine.

@andriy-dmytruk
Copy link
Contributor

Looks good, thanks @altro3

@altro3
Copy link
Collaborator Author

altro3 commented Aug 24, 2023

@dstepanov Could you merge it?

@graemerocher graemerocher merged commit 12ea4bb into micronaut-projects:master Aug 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants