-
-
Notifications
You must be signed in to change notification settings - Fork 114
Enriching the JDL grammar #141
Comments
Please keep in mind, that changes in the JDL grammar affects the community which uses jhipster-ide. Since the ide features were introduced we have 300-500 installation per month and as you can imagine a change in the JDL would affect those people... Beside of that, I also like the idea to improve the JDL grammar ;-) and thought to implement a kind of "Xjdl" (which stands for eXtended JDL) with feature similar to what you discussed in the issue #6275. So I'm looking forward to this... |
Colameo, the changes will be mostly backward compatible I believe |
Yes. The only breaking change I've ever made was about regexes (the separator is now |
@MathieuAA - ok that's good, that means we do not have pressure to integrate all changes in sync with yours. |
@deepu105 I liked the Deepu, I didn't get the difference between
|
@agoncal it must be. @deepu105 Do you think it will be easy to update the subgen to make it generate an application? |
@MathieuAA yes the import-jdl sub gen can be easily updated to compose the app sub gen based on the app configuration/yo-rc generated. Unfortunately, I'll be on vacation from tomorrow until 8th of September so I won't be of much help. I can, of course, review things from my phone. But this should be straight forward just follow the same way entity generator is composed. @agoncal might be a typo, I meant singular/plural in the same meaning as you guys did. |
@bd82 this is the autocomplete snippet we use. https://github.com/jhipster/jdl-studio/blob/gh-pages/js/codemirror/codemirror.jdl-mode.js |
@deepu105 thanks for adding the syntax! I'll work on it this week and submit a PR. |
@MathieuAA take look at the PR from @bd82 before you start as it might be useful |
@deepu105 Yeah I've had a look yesterday, and I agree with you |
@deepu105 I was thinking of your idea of "inheritance". If you have a repository :
With this code, you have a valuable repository (valuable, because you can use it and it works), it's associated service and REST controller. Everything works. Now, for a service:
What do you do with it ? What do you generate ? And empty method ? What for ? You would have to add code on it. Coming back to your idea of inheritance, what about generating the following code:
This would allow to regenerate JHipster code easily (here, the MyService class) and creates an extension point for developers (using the ExtendedMyService). WDYT ? Is that what you had in mind ? |
@agoncal overall I would like to move to an Inheritance model for our generated code so that people can update the child classes without having to worry about being overwritten by upgrades and stuff. Now for the repository vs Service. I belive if you generate a repo with say
You would create a Spring Data Interface called
What I would rather prefer would be to be more flexible and provide a way to create service (as repository is too easy to hand code, just a spring data interface with methods) so you can do something like
This will generate a resource class with end point for both methods (GET by default) the methods will call corresponding methods from service, an interface and impl for the service which will call repository methods. A spring repository. Here though its not too much value its faster to create different combinations and then customize it. And yes inheritance model would be nice on it as well |
@deepu105 I agree that you can create Spring Data interface + service + REST controller using an IDE... but being able to do it in JDL is important. The way I work with JHipster is that I never touch the generated code, and only use inheritance. This allows me to upgrade my projects. In in my JDL I have a :
I know it will be in the generated code, and I know I won't have to touch it when upgrading JHipster. If you think of JHipster being an "IDE code generator", then, I can either use JHipster to generate a repository+service+controller or the IDE. Services is where the business logic happens:
With this code, there is not much you can do. For my model of programming (inheritance) this would not help me. You idea of decoration is great. You could even go:
|
@deepu105 , everyone. How large of an enrichment of the grammar are we talking about here? I'm trying to figure out how the questions of:
If most of the Grammar will effectively be redesigned, we may want to answer the If this enrichment mostly affects things outside the grammar and there will only be a moderate amount of syntax changes perhaps it does not matter and the tracks can be executed independently and in parallel. |
Another idea is also to be able to generate Enums that are not related to Entity (see #167) |
This part of the original issue was not brought over, so I copied it here: Uniqueness Today we have several validations on our attributes (
This would generate a
Issue #18 also proposed unique constraints, but it actually went one step further, proposing a way to specify multi-column unique constraints, like so:
This could then generate the composite unique constraint in Liquibase. If you agree that this would be useful, I'd be happy to contribute this feature. However, being a jhipster rookie, could somebody point me in the right direction, like what are the parts that would need modifications? |
All, I agree to the
If it's implemented in the generator and the other JHipster devs agree to it (incidentally a PR for this would be nice in the generator), I'll add it to the JDL. Now for this, a new issue should have been created (or posting in the first one) instead of adding yet another topic to this already impressive thread. |
I guess we were clear in another thread that we won't afd unique validation as there is no added value. So for now it is out of scope lets not do it. Lets finish the basic grammar we agreed above and later we can think of other enhancements |
@MathieuAA just tried JDL v2 : well done ! |
@agoncal did you try JDL v3? with the microservice stack generation jhipster/generator-jhipster#8335 |
@deepu105 Current project is a monolith with Keycloak. Haven't had the chance to use microservices in v3... but will certainly give it a try ;o) |
Hello, @MathieuAA
|
Let me disturb that conversation a little ^^ ;-). If the goal of this new syntax is to ease JH upgrade without modifying code, it may be wise to focus on other aspects. If we take generated elements from the ground up:
May be adding a notion of extensibility on entities could be nice?
Or even better being inspired by the EMF XCore like or VPDSL syntax
With one or the other, we could avoid the 'repository' and 'service' keyword which are in this form kind of overkill for what they achieve IMHO. Also, I really like the notion of generic definition extension and abstraction, which would be very useful in many cases, circumventing the actual impossibility to have the same entity in two microservices which is frequent when doing client-server. I'm finally inline with the point of cbornet: we should be able to host a full microservice definition by jdl file, which is impossible today, due to the generic configurations like search, skipClient, and so on. |
I have been working on some JDL syntax and feature enhancements. Ill share them soon, for the record I don't want to change any existing syntax, I think they are quite simple and nice, which is more important. Let me write up about what I have in mind later. |
closing in favor of #277 |
From the generator's original post here
Syntax in consideration:
commonConfig.jdl
myMicroservice1JDLFile.jdl
myGateway.jdl
This will generate
The text was updated successfully, but these errors were encountered: