-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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 jdl enum comments #15364
Add jdl enum comments #15364
Conversation
Can you please have a look over this @MathieuAA whenever you get some time? |
4876866
to
d2e339a
Compare
generators/entity-server/templates/src/main/java/package/domain/enumeration/Enum.java.ejs
Outdated
Show resolved
Hide resolved
test/jdl/grammar/grammar.spec.js
Outdated
@@ -1081,24 +1086,31 @@ entity A { | |||
|
|||
it('should parse it', () => { | |||
expect(parsedEnum).to.deep.equal({ | |||
javadoc: ' country enum ', |
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 find it weird the comment isn't trimmed, WDYT? I would have expected it to be country enum
.
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 tried to keep it in sync with how entity comments are being parsed
javadoc: ' field comment ', |
javadoc: ' A comment ', |
But I agree there is no use of trailing space, I have now fixed this for entities as well by changing regex in jdl-ast-builder-visitor.js
trimComment()
Co-authored-by: Mathieu ABOU-AICHI <MathieuAA@users.noreply.github.com>
Trim trailing spaces from JDL parser Related to jhipster#14869
…/generator-jhipster into add-jdl-enum-comments
generators/entity-server/templates/src/main/java/package/domain/enumeration/Enum.java.ejs
Outdated
Show resolved
Hide resolved
generators/utils.js
Outdated
@@ -513,10 +513,11 @@ function getEnumInfo(field, clientRootFolder) { | |||
const customValuesState = getCustomValuesState(enums); | |||
return { | |||
enumName: fieldType, | |||
javadoc: field.fieldTypeJavadoc && this.getJavadoc(field.fieldTypeJavadoc, 0), |
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.
why the 0?
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.
That is the indentSize.
Not sure if this has any effect as overall generated file seems formatted (with prettier?)
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.
you can always test :) try using 2 instead of 0, or see if 0 can be the default
but if I'm not mistaken, the indent level is important
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 just tested :), indent level matters only if we are generating without prettier (i.e. with --skip-prettier
). by default it prettifies all the files with proper indentation.
To cover that case I changed the indents to 4 for field javadoc and default to zero for class level javadoc.
Thanks for pointing out.
…n/enumeration/Enum.java.ejs Co-authored-by: Mathieu ABOU-AICHI <MathieuAA@users.noreply.github.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.
just one comment which you can resolve if you want, but it's approved! thanks for the work!!
@MathieuAA Thanks for approving, I also added the indentation for cases when prettier is not run (using |
@swarajsaaj Relaunched failing tests... |
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.
Ident adjusts
generators/entity-server/templates/src/main/java/package/domain/enumeration/Enum.java.ejs
Outdated
Show resolved
Hide resolved
generators/entity-server/templates/src/main/java/package/domain/enumeration/Enum.java.ejs
Outdated
Show resolved
Hide resolved
generators/entity-server/templates/src/main/java/package/domain/enumeration/Enum.java.ejs
Outdated
Show resolved
Hide resolved
generators/entity-server/templates/src/main/java/package/domain/enumeration/Enum.java.ejs
Outdated
Show resolved
Hide resolved
Let's merge this since @mshima fixed lint issues |
Thanks @swarajsaaj for the contribution |
Thanks @DanielFran for merging and committing the suggestions. |
I was on vacations and didn't manage to follow everything. Plz claim it @swarajsaaj |
Thanks @pascalgrimaud 😄 , i claim the bounty at at https://opencollective.com/generator-jhipster/expenses/49963 |
@swarajsaaj : approved :-) thanks for your hard work |
Adds javadocs to Enum types and enum values from JDL.
Related to #14869
Please make sure the below checklist is followed for Pull Requests.
When you are still working on the PR, consider converting it to Draft (bellow reviewers) and adding
skip-ci
label, you can still see CI build result at your branch.