Java wrapper for the JHipster Domain Language JDL using Graalvm JS Truffle Language...
This is part of the ZenWave Code Generator project:
Configurable and extensible Code Generator for DDD and API-First modeling with support for JHipster JDL, AsyncAPI and OpenAPI
<dependency>
<groupId>io.github.zenwave360.jhipster</groupId>
<artifactId>jdl-jvm</artifactId>
<version>${jdl-jvm.version}</version>
</dependency>String jdlString = Files.readString(Paths.get("jdl-samples-main/21-points.jh"));
Map<String, Object> parsedJDL = JDLParser.parseJDL(jdlString);String jdlString = Files.readString(Paths.get("jdl-samples-main/21-points.jh"));
Map<String, Object> parsedJDL = JDLParser.parseJDL(jdlString, , Map.of("databaseType", "mongodb"));Note: It uses Graalvm JS Truffle Language and performance is not that bad. It takes about 3' to load the js script and parse the jdl string.
Upstream JDL source code is located under src/main/jdl-core folder.
You can bundle target/classes/io/zenwave360/jhipster/jdl/jdl-parser.js using:
mvn generate-resourcesfrom project root, ornpm run generate-resourcesfromsrc/main/jdl-corefolder
This wrapper includes some extensions compatible with the original JDL format, meaning that valid JDL will produce the same jdlObject as the upstream jdl library.
- Field Types: in addition to enums and basic types it allows other entities (and arrays of) as field type, this is useful for embedded fields which are not relations.
- Service: in addition to
serviceClassandserviceImplit allows configuring free text value asserviceNameto allow grouping multiple entities in a given service. Then it's up to each generator to generate an interface or just an implementation class.
- Adds annotation options to the entity object
- Adds
isEnum,isEntityandisArrayto entity fields - Adds
className,instanceName,classNamePluralandinstanceNamePluralto entity fields - Fill globaly configured options (like service, dto ,search...) to entity options for consistency