https://github.com/zenwave360/jdl-jvm
JHipster Domain Language (JDL) Wrapped for the JVM
https://github.com/zenwave360/jdl-jvm
graalvm jdl jhipster jvm
Last synced: 8 months ago
JSON representation
JHipster Domain Language (JDL) Wrapped for the JVM
- Host: GitHub
- URL: https://github.com/zenwave360/jdl-jvm
- Owner: ZenWave360
- License: apache-2.0
- Archived: true
- Created: 2022-04-10T18:23:21.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-04-24T20:32:46.000Z (about 3 years ago)
- Last Synced: 2025-03-20T15:17:37.551Z (about 1 year ago)
- Topics: graalvm, jdl, jhipster, jvm
- Language: JavaScript
- Homepage:
- Size: 721 KB
- Stars: 0
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# JHipster Domain Language (JDL) Wrapped for the JVM
[](https://search.maven.org/artifact/io.github.zenwave360.jhipster/jdl-jvm)
Java wrapper for the [JHipster Domain Language JDL](https://www.jhipster.tech/jdl/intro) using Graalvm JS Truffle Language...
This is part of the [ZenWave Code Generator](https://github.com/ZenWave360/zenwave-code-generator) project:
> Configurable and extensible Code Generator for DDD and API-First modeling with support for JHipster JDL, AsyncAPI and OpenAPI
## Usage
```xml
io.github.zenwave360.jhipster
jdl-jvm
${jdl-jvm.version}
```
```java
String jdlString = Files.readString(Paths.get("jdl-samples-main/21-points.jh"));
Map parsedJDL = JDLParser.parseJDL(jdlString);
```
```java
String jdlString = Files.readString(Paths.get("jdl-samples-main/21-points.jh"));
Map 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.
## Generating jdl-parser.js bundle
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-resources` from project root, or
- `npm run generate-resources` from `src/main/jdl-core` folder
## Custom Extensions
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.
### Extensions In JDL Language
- 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 `serviceClass` and `serviceImpl` it allows configuring free text value as `serviceName` to allow grouping multiple entities in a given service. Then it's up to each generator to generate an interface or just an implementation class.
### Extensions In Parsed Result Object
- Adds annotation options to the entity object
- Adds `isEnum`, `isEntity` and `isArray` to entity fields
- Adds `className`, `instanceName`, `classNamePlural` and `instanceNamePlural` to entity fields
- Fill globaly configured options (like service, dto ,search...) to entity options for consistency