JDL To AsyncAPI Generator
👉 ZenWave360 Helps You Create Software Easy to Understand
Generate AsyncAPI definition from JHipster Domain Language (JDL) entities:
- One channel for each entity update events
- Messages and payloads for each entity:
- Supported Schema Formats: AVRO and AsyncAPI schema
- Supported Payload Styles: Entity and State Transfer (for Create/Update/Delete events)
JDL Example:
@aggregate
entity Customer {
username String required minlength(3) maxlength(250)
password String required minlength(3) maxlength(250)
email String required minlength(3) maxlength(250)
firstName String required minlength(3) maxlength(250)
lastName String required minlength(3) maxlength(250)
}
Then run:
jbang zw -p io.zenwave360.sdk.plugins.JDLToAsyncAPIPlugin \
includeCommands=true \
specFile=src/main/resources/model/orders-model.jdl \
idType=integer \
idTypeFormat=int64 \
annotations=aggregate \
payloadStyle=event \
targetFile=src/main/resources/model/asyncapi.yml
Options
Option | Description | Type | Default | Values |
---|---|---|---|---|
specFile | Spec file to parse | String | Â | Â |
specFiles | JDL files to parse | String[] | [] | Â |
basePackage | Java Models package name | String | io.example.domain.model | Â |
targetFolder | Target folder for generated output | String | Â | Â |
targetFile | Target file | String | asyncapi.yml | Â |
schemaFormat | Schema format for messages’ payload | SchemaFormat | schema | schema, avro |
payloadStyle | Payload Style for messages’ payload | PayloadStyle | entity | entity, event |
idType | JsonSchema type for id fields and parameters. | String | string | Â |
idTypeFormat | JsonSchema type format for id fields and parameters. | String | Â | Â |
asyncapiVersion | Target AsyncAPI version. | AsyncapiVersionType | v2 | v2, v3 |
entities | Entities to generate code for | List | [] | Â |
skipEntities | Entities to skip code generation for | List | [] | Â |
annotations | Annotations to generate code for (ex. aggregate) | List | [] | Â |
skipForAnnotations | Skip generating operations for entities annotated with these | List | [vo, embedded, skip] | Â |
includeEvents | Include channels and messages to publish domain events | boolean | true | Â |
includeCommands | Include channels and messages to listen for async command requests | boolean | false | Â |
jdlBusinessEntityProperty | Extension property referencing original jdl entity in components schemas (default: x-business-entity) | String | x-business-entity | Â |
avroPackage | Package name for generated Avro Schemas (.avsc) | String | io.example.domain.model | Â |
skipFormatting | Skip java sources output formatting | boolean | false | Â |
haltOnFailFormatting | Halt on formatting errors | boolean | true | Â |
Getting Help
jbang zw -p io.zenwave360.sdk.plugins.JDLToAsyncAPIPlugin --help