ZDL To AsyncAPI Generator
👉 ZenWave360 Helps You Create Software that’s Easy to Understand
Generate AsyncAPI definition from ZDL Services and Events:
jbang zw -p io.zenwave360.sdk.plugins.ZDLToAsyncAPIPlugin \
specFile=src/main/resources/model/orders-model.zdl \
idType=integer \
idTypeFormat=int64 \
targetFile=src/main/resources/model/asyncapi.yml
For instance the following ZDL model will generate:
service OrdersService for (CustomerOrder) {
// only emited events will be included in the asyncapi definition
updateOrder(id, CustomerOrderInput) CustomerOrder withEvents OrderStatusUpdated
}
@asyncapi({channel: "OrderUpdatesChannel", topic: "orders.order_updates"})
event OrderStatusUpdated {
id String
dateTime Instant required
status OrderStatus required
previousStatus OrderStatus
}
- An
schema
namedOrderStatusUpdated
with apayload
containing theid
,dateTime
,status
andpreviousStatus
fields. - A
message
namedOrderStatusUpdatedMessage
pointing toOrderStatusUpdated
schema. - An a
Channel
namedOrderUpdatesChannel
containing a reference to theOrderStatusUpdatedMessage
message. - It also will generate an
Operation
namedonOrderStatusUpdated
with and actionsend
to theOrderUpdatesChannel
channel.
This is as a compact format as it can get!! Saving you a lot of typing and giving you very concise representation of your events.
Options
Option | Description | Type | Default | Values |
---|---|---|---|---|
specFile | Spec file to parse | String | Â | Â |
targetFolder | Target folder to generate code to. If left empty, it will print to stdout. | File | Â | Â |
targetFile | Target file | String | asyncapi.yml | Â |
asyncapiVersion | Target AsyncAPI version. | AsyncapiVersionType | v3 | v2, v3 |
schemaFormat | Schema format for messages’ payload | SchemaFormat | schema | schema, avro |
idType | JsonSchema type for id fields and parameters. | String | string | Â |
idTypeFormat | JsonSchema type format for id fields and parameters. | String | Â | Â |
basePackage | Java Models package name | String | io.example.domain.model | Â |
avroPackage | Package name for generated Avro Schemas (.avsc) | String | io.example.domain.model | Â |
zdlBusinessEntityProperty | Extension property referencing original zdl entity in components schemas (default: x-business-entity) | String | x-business-entity | Â |
continueOnZdlError | Continue even when ZDL contains fatal errors | boolean | true | Â |
Getting Help
jbang zw -p io.zenwave360.sdk.plugins.ZDLToAsyncAPIPlugin --help