Replace JDLObject with direct AST ↔ JSON conversion
Author: mshimaCreated Sep 26, 2026Updated Sep 26, 2026
Labelsarea: feature request :bulb:theme: JDL
Overview of the feature request
Remove JDLObject and convert the JDL directly between its AST and JSON.
Today both directions go through JDLObject, an object model that duplicates the AST the parser builds:
- import: JDL → AST →
JDLObject→ JSON - export: JSON →
JDLObject→ JDL (JDLObject.toString())
Proposal:
- import: JDL → AST → JSON (
astToJson) - export: JSON → AST (
jsonToAst) → JDL (printJDL)
Motivation for or Use Case
- Less code: the
JDLObjectmodels and their converters are 23 classes and about 2,600 lines that repeat what the AST already holds. - Simpler code: several converters keep module-level state, and the importer has three separate paths (entities only, one application, several applications).
- Correct export:
toString()writes deprecated or invalid JDL, e.g.paginateinstead ofpagination. - Not a breaking change:
JDLObjectis not part of the public API (generator-jhipster/jdl).
Plan, one pull request per step:
printJDL: print a parsed JDL back to text.- Golden tests: snapshot the current import and export of a small set of JDLs, each covering a specific point, to compare the next steps with: the output may change, and the snapshots show every change. The JDLs of the
printJDLtests are reused, plus the cases only the conversion has (e.g. options with*andexcept, implicit bidirectional relationships, entities shared by applications). - Export with
jsonToAst+printJDL. The jdl store keeps the text of its previous JDL (formatting and comments) for what did not change, reprinting only what did. - Import with
astToJson. - A single import path: a JDL without application is imported into an implicit one.
- Move the option rules (e.g.
dtoorfilterimplies a service class) from the JDL conversion to the generator, and test that the generator applies them. - Remove
JDLObjectand its converters.
Related issues or PR
#35180, #35182, #35186
Checking this box is mandatory (this is just to show you read everything)
Source: jhipster/generator-jhipster