Generating OpenAPI definition files from JDL with ZenWaveSDK
Writing YAML by hand is no fun, but you can simplify the process of writing OpenAPI definition files by using a Domain Specific Language (DSL).
Thanks to ZenWave SDK, you can convert JDL models into OpenAPI definition files. This can save time and effort in the development process while ensuring that your APIs follow best practices and standards.
JDL Example
@aggregateentity 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)}entity Address {street Stringcity Stringcountry StringzipCode String}relationship OneToOne {Customer{address} to Address{customer}}
It will add x-business-entity
and x-business-entity-paginated
to generated schemas, very useful if you are also using ZenWave to generate a complete backend from JDL
Generating OpenAPI definition files from JDL with ZenWaveSDK
See JDL To OpenAPI Generator for a complete list of options and GitHub repository for install instructions.
ZenWave SDK will generate CRUD operations for your entities, including paginated lists and search operations.
jbang zw -p io.zenwave360.sdk.plugins.ZDLToOpenAPIPlugin \specFile=entities-model.jdl \idType=integer \idTypeFormat=int64 \targetFolder=. \targetFile=openapi.yml
By using JDL to define your domain model and ZenWave SDK to convert it into an OpenAPI definition file, you can simplify the process of designing and documenting your APIs. This can improve the overall quality and consistency of your APIs, while also reducing errors and inconsistencies.