jhipster / jhipster-core

JHipster Domain Language, used by JHipster UML and JDL-Studio to generate entities
Apache License 2.0
346 stars 116 forks source link

Remove terminal commas #461

Open MathieuAA opened 4 years ago

MathieuAA commented 4 years ago

This issue comes from a discussion between @colameo and I about terminal commas. This issue's goal is to define the necessary rules to make terminal commas obsolete in the future, and/or at least make them optional in all the relevant cases first.

Any opinion is welcome

@colameo if the description doesn't convey your meaning please do rephrase it.

colameo commented 4 years ago

IMO all classifier elements of type:

<classifier> <name> {
    elements = element (',' element)*
}

should be without commas ,

there is really no benefit of having a separator and because it's optional it makes even harder to parse because weird definitions like the followings are allowed and also valid:

entity Department {
  guid UUID required,
  name String required unique
  description TextBlob,
  advertisement Blob
  logo ImageBlob
}
MathieuAA commented 4 years ago

If we remove the commas completely, it would be a breaking change (and not a small one). Making them optional first and printing warnings about them should be a good start. Maybe the linter can help for this (I really have to dig it up).

As a side note, if we remove commas out of the equation, this leaves the newline as a separator. Not so sure about this one.

colameo commented 4 years ago

could we at least remove commas from application and deployment config sections? that would simplify the handling of options a lot ... (at least for the current refactoring work I'm doing).

MathieuAA commented 4 years ago

Yes, and relationships too. I'm merging JCore and the generator and this is taking me some time. I'll get to it right after

MathieuAA commented 4 years ago

@colameo I'll be working on it today

MathieuAA commented 4 years ago

Okay, the only case where commas aren't optional is with the enum, I'm making them optional.

MathieuAA commented 4 years ago

The next step would be to update the linter and make the JDL importer use it

funder7 commented 4 years ago

Hi, I came here from issue #347, even `export-jdl command should export a JDL without commas. I'm writing it here just as reminder :-)

MathieuAA commented 4 years ago

Hello, don't worry it's not forgotten ;) just don't have time to do it...

funder7 commented 4 years ago

Okay! :-D

MathieuAA commented 4 years ago

You know what? I'll do this this weekend. Thanks :)

funder7 commented 4 years ago

Yeah!! Let's do it! :-D