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 JDLObject models 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. paginate instead of pagination.
  • Not a breaking change: JDLObject is not part of the public API (generator-jhipster/jdl).

Plan, one pull request per step:

  1. printJDL: print a parsed JDL back to text.
  2. 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 printJDL tests are reused, plus the cases only the conversion has (e.g. options with * and except, implicit bidirectional relationships, entities shared by applications).
  3. 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.
  4. Import with astToJson.
  5. A single import path: a JDL without application is imported into an implicit one.
  6. Move the option rules (e.g. dto or filter implies a service class) from the JDL conversion to the generator, and test that the generator applies them.
  7. Remove JDLObject and 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