### Install ZenWave SDK with JBang (Next Snapshot) Source: https://github.com/zenwave360/zenwave-sdk/blob/main/README.md Installs the latest experimental/unstable snapshot version of ZenWave SDK as a JBang alias named 'zw'. ```shell jbang alias add --fresh --force --name=zw next@zenwave360/zenwave-sdk ``` -------------------------------- ### Install ZenWave SDK with JBang (Snapshot) Source: https://github.com/zenwave360/zenwave-sdk/blob/main/README.md Installs the latest snapshot version of ZenWave SDK as a JBang alias named 'zw'. ```shell jbang alias add --fresh --force --name=zw snapshots@zenwave360/zenwave-sdk ``` -------------------------------- ### Clone and Build ZenWave SDK Source: https://github.com/zenwave360/zenwave-sdk/blob/main/README.md Clone the ZenWave SDK repository from GitHub and build it using Maven. This process installs the necessary artifacts locally. ```shell git clone https://github.com/ZenWave360/zenwave-sdk.git cd zenwave-sdk mvn clean install ``` -------------------------------- ### Get Detailed Help for a Plugin Source: https://github.com/zenwave360/zenwave-sdk/blob/main/README.md Command to get detailed help for a specific plugin, specifying the 'markdown' help format. ```shell jbang zw --help markdown -p ``` -------------------------------- ### Get Help for a Specific Plugin Source: https://github.com/zenwave360/zenwave-sdk/blob/main/README.md Command to retrieve help information for a particular Zenwave SDK plugin. ```shell jbang zw --help -p ``` -------------------------------- ### Custom ZenWave SDK Installation with JBang Source: https://github.com/zenwave360/zenwave-sdk/blob/main/README.md Installs ZenWave SDK with custom plugins and repositories using JBang. This command specifies multiple dependencies and configurations for advanced usage. ```shell jbang alias add --name=zw --force \ -m=io.zenwave360.sdk.Main \ --repos=mavencentral,snapshots=https://s01.oss.sonatype.org/content/repositories/snapshots \ --deps=\ org.slf4j:slf4j-simple:1.7.36,\ io.zenwave360.sdk.plugins:asyncapi-spring-cloud-streams3:2.4.0,\ io.zenwave360.sdk.plugins:asyncapi-jsonschema2pojo:2.4.0,\ io.zenwave360.sdk.plugins:avro-schema-compiler:2.4.0,\ org.apache.avro:avro-compiler:1.12.0,\ io.zenwave360.sdk.plugins:asyncapi-generator:2.4.0,\ io.zenwave360.sdk.plugins:openapi-spring-webtestclient:2.4.0,\ io.zenwave360.sdk.plugins:openapi-karate:2.4.0,\ io.zenwave360.sdk.plugins:backend-application-default:2.4.0,\ io.zenwave360.sdk.plugins.customizations:kotlin-backend-application:2.4.0,\ io.zenwave360.sdk.plugins:zdl-to-openapi:2.4.0,\ io.zenwave360.sdk.plugins:zdl-to-asyncapi:2.4.0,\ io.zenwave360.sdk.plugins:jdl-to-asyncapi:2.4.0,\ io.zenwave360.sdk.plugins:zdl-to-markdown:2.4.0,\ io.zenwave360.sdk.plugins:openapi-controllers:2.4.0 \ io.zenwave360.sdk:zenwave-sdk-cli:2.4.0 ``` -------------------------------- ### Example ZDL Model Source: https://github.com/zenwave360/zenwave-sdk/blob/main/plugins/zdl-to-asyncapi/README.md An example ZDL model demonstrating a service with an event. Only emitted events are included in the AsyncAPI definition. ```zdl 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 } ``` -------------------------------- ### Install ZenWave SDK with jbang Source: https://github.com/zenwave360/zenwave-sdk/blob/main/index.md Installs the latest release of the ZenWave SDK using jbang. This command adds a fresh alias for easy access. ```shell jbang alias add --fresh --name=zw release@zenwave360/zenwave-sdk ``` -------------------------------- ### Get Help for Zdl To Markdown Plugin Source: https://github.com/zenwave360/zenwave-sdk/blob/main/plugins/zdl-to-markdown/README.md Run this command to display the help message for the Zdl To Markdown plugin, showing available options and usage. ```shell jbang zw -p io.zenwave360.sdk.plugins.ZdlToMarkdownPlugin --help ``` -------------------------------- ### Get Help for OpenAPI Karate Plugin Source: https://github.com/zenwave360/zenwave-sdk/blob/main/plugins/openapi-karate/README.md Command to display help information and available options for the OpenAPI Karate plugin. ```shell jbang zw -p io.zenwave360.sdk.plugins.OpenAPIKaratePlugin --help ``` -------------------------------- ### Get Help for Backend Application Default Plugin Source: https://github.com/zenwave360/zenwave-sdk/blob/main/plugins/backend-application-default/README.md Use this command to display the help message for the Backend Application Default Plugin, showing available options and configurations. ```shell jbang zw -p io.zenwave360.sdk.plugins.BackendApplicationDefaultPlugin --help ``` -------------------------------- ### Get Help for OpenAPI Controllers Plugin Source: https://github.com/zenwave360/zenwave-sdk/blob/main/plugins/openapi-controllers/README.md Use this command to display the help message for the OpenAPI Controllers Plugin, which lists available options and configurations. ```shell jbang zw -p io.zenwave360.sdk.plugins.OpenAPIControllersPlugin --help ``` -------------------------------- ### Get Help for AsyncAPI Generator Plugin Source: https://github.com/zenwave360/zenwave-sdk/blob/main/plugins/asyncapi-generator/README.md Use this command to display the help message for the AsyncAPI Generator Plugin, showing available options and usage instructions. ```shell jbang zw -p io.zenwave360.sdk.plugins.AsyncAPIGeneratorPlugin --help ``` -------------------------------- ### Generate Terraform for Hybrid Setup Source: https://github.com/zenwave360/zenwave-sdk/blob/main/plugins/asyncapi-ops/README.md Configure a hybrid setup for Confluent Kafka resources and a standalone Schema Registry provider. This command specifies the API file, Avro imports, server, template, and target folder. ```shell jbang zw -p AsyncAPIOpsGeneratorPlugin \ apiFile=asyncapi.yml \ avroImports=classpath:shared-avro/avro \ server=staging \ templates=TerraformConfluentHybrid \ targetFolder=terraform/inventory-adjustment ``` -------------------------------- ### JDL Model Example Source: https://github.com/zenwave360/zenwave-sdk/blob/main/plugins/jdl-to-asyncapi/README.md An example of a JDL entity definition for a Customer. ```jdl 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) } ``` -------------------------------- ### Get Help for ZDL to AsyncAPI Plugin Source: https://github.com/zenwave360/zenwave-sdk/blob/main/plugins/zdl-to-asyncapi/README.md Use the jbang command with the --help flag to display all available options for the ZDL to AsyncAPI plugin. ```shell jbang zw -p io.zenwave360.sdk.plugins.ZDLToAsyncAPIPlugin --help ``` -------------------------------- ### Get Help for Avro Schema Generator Plugin Source: https://github.com/zenwave360/zenwave-sdk/blob/main/plugins/avro-schema-compiler/README.md Use this command to display help information for the Avro Schema Generator plugin, listing available options and their descriptions. ```shell jbang zw -p io.zenwave360.sdk.plugins.AvroSchemaGeneratorPlugin --help ``` -------------------------------- ### Kafka Channel Binding with Topic Configuration and Environment Overrides Source: https://github.com/zenwave360/zenwave-sdk/blob/main/plugins/asyncapi-ops/README.md Example demonstrating Kafka channel bindings with topic configuration, including partitions, replicas, cleanup policy, and retention time. It also shows per-environment overrides for development and staging. ```yaml channels: reserve-stock-command: bindings: kafka: partitions: 20 replicas: 3 topicConfiguration: cleanup.policy: ["delete", "compact"] retention.ms: 604800000 x-env-server-overrides: dev: partitions: 1 replicas: 1 staging: partitions: 3 replicas: 2 ``` -------------------------------- ### Kafka Topic Resource Example Source: https://github.com/zenwave360/zenwave-sdk/blob/main/plugins/asyncapi-ops/README.md Example of a generated `kafka_topic` Terraform resource. This resource is created for each owned channel, including retry and DLQ topics, with names derived from the full Kafka topic address. ```hcl resource "kafka_topic" "merchandising_inventory_inventory_adjustment_reserve_stock_command_avro_v0" { name = "merchandising.inventory.inventory-adjustment.reserve-stock.command.avro.v0" replication_factor = 3 partitions = 3 config = { "cleanup.policy" = "delete,compact" "retention.ms" = "604800000" } } ``` -------------------------------- ### Get Help for OpenAPI to JDL Plugin Source: https://github.com/zenwave360/zenwave-sdk/blob/main/plugins/zdl-to-openapi/README.md To view all available options and usage instructions for the OpenAPI to JDL generator, use the `--help` flag with the `jbang` command. ```shell jbang zw -p io.zenwave360.sdk.plugins.OpenAPIToJDLPlugin --help ``` -------------------------------- ### Get Help for ZDL to OpenAPI Plugin Source: https://github.com/zenwave360/zenwave-sdk/blob/main/plugins/zdl-to-openapi/README.md To view all available options and usage instructions for the ZDL to OpenAPI generator, use the `--help` flag with the `jbang` command. ```shell jbang zw -p io.zenwave360.sdk.plugins.ZDLToOpenAPIPlugin --help ``` -------------------------------- ### Getting Help with the ZenWave CLI Source: https://github.com/zenwave360/zenwave-sdk/blob/main/plugins/asyncapi-spring-cloud-streams3/README.md Use the jbang command to display help information for the Spring Cloud Streams 3 plugin, including available options and configurations. ```shell jbang zw -p io.zenwave360.sdk.plugins.SpringCloudStreams3Plugin --help ``` -------------------------------- ### AsyncAPI Client Configuration with External References Source: https://github.com/zenwave360/zenwave-sdk/blob/main/plugins/asyncapi-ops/README.md Example of an AsyncAPI client configuration where channels are defined as external references. This configuration contributes ACLs only, without provisioning topics or schemas. ```yaml # asyncapi-client.yml — all channels are external refs channels: replenish-stock-command: $ref: '../stock-replenishment/asyncapi.yml#/channels/replenish-stock-command' ``` -------------------------------- ### Select Terraform Template Target Source: https://github.com/zenwave360/zenwave-sdk/blob/main/plugins/asyncapi-ops/README.md Example of selecting a Terraform template target using the jbang command. Specify the API file, the desired template, and the output folder. ```shell jbang zw -p AsyncAPIOpsGeneratorPlugin \ apiFile=asyncapi.yml \ templates=TerraformConfluent \ targetFolder=terraform/out ``` -------------------------------- ### Generate Terraform from Remote Files with Authentication Source: https://github.com/zenwave360/zenwave-sdk/blob/main/plugins/asyncapi-ops/README.md Generate Terraform HCL from remote AsyncAPI and Avro files using the TerraformConfluent provider. This example includes authentication details for accessing remote resources. ```shell jbang zw -p AsyncAPIOpsGeneratorPlugin \ authentication.key=Authorization \ authentication.value="Bearer $TOKEN" \ authentication.type=HEADER \ authentication.urlPatterns[0]='https://raw.githubusercontent.com/.*' \ apiFile=https://raw.githubusercontent.com/ZenWave360/zenwave-playground/refs/heads/main/examples/asyncapi-shopping-cart/apis/asyncapi.yml \ avroImports=\ https://raw.githubusercontent.com/ZenWave360/zenwave-playground/refs/heads/main/examples/asyncapi-shopping-cart/apis/avro/Item.avsc,\ https://raw.githubusercontent.com/ZenWave360/zenwave-playground/refs/heads/main/examples/asyncapi-shopping-cart/apis/avro/ShoppingCart.avsc \ templates=TerraformConfluent \ targetFolder=confluent/work ``` -------------------------------- ### Display Plugin Help Source: https://github.com/zenwave360/zenwave-sdk/blob/main/plugins/asyncapi-jsonschema2pojo/README.md Use this command to display the help information for the AsyncAPI JSON Schema to POJO plugin. ```shell jbang zw -p io.zenwave360.sdk.plugins.AsyncApiJsonSchema2PojoPlugin --help ``` -------------------------------- ### Sample ZDL Configuration for Backend Application Source: https://github.com/zenwave360/zenwave-sdk/blob/main/plugins/backend-application-default/README.md Demonstrates a sample configuration for the Backend Application Default Plugin, specifying base package, persistence, database type, project layout, and ZDL file path. Includes plugin-specific options like Lombok usage and force overwrite. ```zdl config { basePackage "com.example" persistence jpa databaseType postgresql layout CleanHexagonalProjectLayout // The IDE will automatically use the active .zdl file // Alternatively, specify the path here to maintain separation between models and plugins zdlFile "models/example.zdl" plugins { BackendApplicationDefaultPlugin { useLombok true --force // overwrite all files } } } ``` -------------------------------- ### List Available Plugins Source: https://github.com/zenwave360/zenwave-sdk/blob/main/README.md Command to list all available Zenwave SDK plugins, including standard and custom ones. ```shell jbang zw -h list ``` -------------------------------- ### Display Help for Spring WebTestClient Plugin Source: https://github.com/zenwave360/zenwave-sdk/blob/main/plugins/openapi-spring-webtestclient/README.md Use this command to display all available options and their descriptions for the Spring WebTestClient plugin. ```shell jbang zw -p io.zenwave360.sdk.plugins.SpringWebTestClientPlugin --help ``` -------------------------------- ### JDL To AsyncAPI Plugin Help Source: https://github.com/zenwave360/zenwave-sdk/blob/main/plugins/jdl-to-asyncapi/README.md Command to display help information for the JDL to AsyncAPI plugin. ```shell jbang zw -p io.zenwave360.sdk.plugins.JDLToAsyncAPIPlugin --help ``` -------------------------------- ### Run Zenwave SDK CLI Source: https://github.com/zenwave360/zenwave-sdk/blob/main/README.md Basic command to run the Zenwave SDK CLI with a plugin configuration and options. ```shell jbang zw -p optionName=value optionName2=value ``` -------------------------------- ### Build and Run Application Source: https://github.com/zenwave360/zenwave-sdk/blob/main/e2e/src/test/resources/projects/online-food-delivery-mongo/README.md Instructions to build and run the food delivery service application using Docker Compose and Maven. Assumes the repository has been cloned. ```shell docker-compose -f modulith/src/main/docker/docker-compose.yml up -d mvn clean install -DskipTests mvn spring-boot:run -f modulith ``` -------------------------------- ### Include toc.html Snippet Source: https://github.com/zenwave360/zenwave-sdk/blob/main/docs/_includes/toc.html This is an example of how to include the toc.html snippet in your Jekyll project. It demonstrates passing various parameters to customize the generated table of contents. ```html {% capture tocWorkspace %} {% comment %} Version 1.0.6 https://github.com/allejo/jekyll-toc "...like all things liquid - where there's a will, and ~36 hours to spare, there's usually a/some way" ~jaybe Usage: {% include toc.html html=content sanitize=true class="inline_toc" id="my_toc" h_min=2 h_max=3 %} Parameters: * html (string) - the HTML of compiled markdown generated by kramdown in Jekyll Optional Parameters: * sanitize (bool) : false - when set to true, the headers will be stripped of any HTML in the TOC * class (string) : '' - a CSS class assigned to the TOC * id (string) : '' - an ID to assigned to the TOC * h_min (int) : 1 - the minimum TOC header level to use; any header lower than this value will be ignored * h_max (int) : 6 - the maximum TOC header level to use; any header greater than this value will be ignored * ordered (bool) : false - when set to true, an ordered list will be outputted instead of an unordered list * item_class (string) : '' - add custom class(es) for each list item; has support for '%level%' placeholder, which is the current heading level * baseurl (string) : '' - add a base url to the TOC links for when your TOC is on another page than the actual content * anchor_class (string) : '' - add custom class(es) for each anchor element Output: An ordered or unordered list representing the table of contents of a markdown block. This snippet will only generate the table of contents and will NOT output the markdown given to it {% endcomment %} {% capture my_toc %}{% endcapture %} {% assign orderedList = include.ordered | default: false %} {% assign minHeader = include.h_min | default: 1 %} {% assign maxHeader = include.h_max | default: 6 %} {% assign nodes = include.html | split: ' maxHeader %} {% continue %} {% endif %} {% if firstHeader %} {% assign firstHeader = false %} {% assign minHeader = headerLevel %} {% endif %} {% assign indentAmount = headerLevel | minus: minHeader | add: 1 %} {% assign _workspace = node | split: '' | first }}>{% endcapture %} {% assign header = _workspace[0] | replace: _hAttrToStrip, '' %} {% assign space = '' %} {% for i in (1..indentAmount) %} {% assign space = space | prepend: ' ' %} {% endfor %} {% unless include.item_class == blank %} {% capture listItemClass %}{:.{{ include.item_class | replace: '%level%', headerLevel }}}{% endcapture %} {% endunless %} {% capture my_toc %}{{ my_toc }} {{ space }}{{ listModifier }} {{ listItemClass }} [{{ header | strip_html }}]({% if include.baseurl %}{{ include.baseurl }}{% endif %}#{{ html_id }}){% if include.anchor_class %}{:.{{ include.anchor_class }}}{% endif %}{% endcapture %} {% endfor %} {% if include.class %} {% capture my_toc %}{:.{{ include.class }}} {{ my_toc | lstrip }}{% endcapture %} {% endif %} {% if include.id %} {% capture my_toc %}{: #{{ include.id }}} {{ my_toc | lstrip }}{% endcapture %} {% endif %} {% endcapture %}{% assign tocWorkspace = '' %}{{ my_toc | markdownify | strip }} ``` -------------------------------- ### Generate POJOs with Schema Overlays Source: https://github.com/zenwave360/zenwave-sdk/blob/main/plugins/asyncapi-jsonschema2pojo/README.md This command demonstrates using overlay files to patch an AsyncAPI schema before it's used for POJO generation. Overlay files are applied sequentially and can be local or classpath resources. ```shell jbang zw -p io.zenwave360.sdk.plugins.AsyncApiJsonSchema2PojoPlugin \ apiFile=src/main/resources/model/asyncapi.yml \ apiOverlayFiles=src/main/resources/model/asyncapi-overlay.yml \ modelPackage=io.zenwave360.example.core.domain.events \ targetFolder=. ``` -------------------------------- ### Configure ZenWave MCP Server in Visual Studio Code Source: https://github.com/zenwave360/zenwave-sdk/blob/main/plugins/zenwave-mcp-server/README.md Use this command in the Visual Studio Code 'Add MCP Server' wizard to connect to the ZenWave MCP server. ```shell jbang --quiet io.zenwave360.sdk.plugins:zenwave-mcp-server:2.0.0-SNAPSHOT ``` -------------------------------- ### Spring Cloud Stream Producer Binding Configuration Source: https://github.com/zenwave360/zenwave-sdk/blob/main/plugins/asyncapi-generator/README.md Configure Spring Cloud Stream bindings for producing messages. This example shows how to set up a binding for a 'shopping-cart-channel-out' using Avro encoding. ```yaml spring: cloud: stream: bindings: shopping-cart-channel-out: # AsyncAPI channel name (kebab-case) with the `-out` suffix (no `-0`) destination: shopping-cart content-type: application/*+avro producer: use-native-encoding: true ``` -------------------------------- ### Maven Plugin Configuration for AsyncAPI Generation Source: https://github.com/zenwave360/zenwave-sdk/blob/main/plugins/asyncapi-generator/README.md Configure the zenwave-sdk-maven-plugin to generate code from an AsyncAPI specification. Specify input files, generator name, and configuration options like role, templates, and package names. ```xml io.zenwave360.sdk zenwave-sdk-maven-plugin ${zenwave.version} ${asyncapi.inputSpec} false true true API_KEY XXXXXX generate-asyncapi generate-sources generate AsyncAPIGenerator provider ${zenwave.asyncapiGenerator.templates} ${asyncApiModelPackage} ${asyncApiProducerApiPackage} ${asyncApiConsumerApiPackage} ${asyncapi.avro.imports} io.zenwave360.sdk.plugins asyncapi-generator ${zenwave.version} org.apache.avro avro-compiler ${avro.version} com.fasterxml.jackson.core jackson-core com.fasterxml.jackson.core jackson-databind ``` -------------------------------- ### Jekyll TOC Include Usage Example Source: https://github.com/zenwave360/zenwave-sdk/blob/main/_includes/toc.html This snippet demonstrates how to include the `toc.html` file in your Jekyll project to generate a table of contents. It shows common parameters like `html`, `sanitize`, `class`, `id`, `h_min`, and `h_max`. ```html {% include toc.html html=content sanitize=true class="inline_toc" id="my_toc" h_min=2 h_max=3 %} ``` -------------------------------- ### JDL To AsyncAPI Plugin Execution Source: https://github.com/zenwave360/zenwave-sdk/blob/main/plugins/jdl-to-asyncapi/README.md Command to run the JDL to AsyncAPI plugin with specified options. ```shell 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 ``` -------------------------------- ### Configure ZenWave MCP Server in Claude Desktop Source: https://github.com/zenwave360/zenwave-sdk/blob/main/plugins/zenwave-mcp-server/README.md Add this JSON configuration to your Claude Desktop settings to connect to the ZenWave MCP server. ```json { "mcpServers": { "zenwave-mcp-server": { "type": "stdio", "command": "jbang", "args": [ "--quiet", "io.zenwave360.sdk.plugins:zenwave-mcp-server:2.0.0-SNAPSHOT" ] } } } ``` -------------------------------- ### Base Maven Plugin Configuration Source: https://github.com/zenwave360/zenwave-sdk/blob/main/plugins/asyncapi-spring-cloud-streams3/README.md This is the base configuration for the zenwave-sdk-maven-plugin. It includes settings for adding source roots and defines a sample execution for AsyncAPI generation. ```xml io.zenwave360.sdk zenwave-sdk-maven-plugin ${zenwave.version} true true generate-asyncapi-xxx generate-sources generate spring-cloud-streams3 classpath:model/asyncapi.yml com.example.apis asyncapis ${apis.version} io.zenwave360.sdk.plugins asyncapi-spring-cloud-streams3 ${zenwave.version} io.zenwave360.sdk.plugins asyncapi-jsonschema2pojo ${zenwave.version} ``` -------------------------------- ### Configure AsyncAPI Generator Task in Gradle Source: https://github.com/zenwave360/zenwave-sdk/blob/main/zenwave-sdk-maven-plugin/README.md This snippet shows how to configure a Gradle task to generate producer and consumer code from an AsyncAPI specification using the ZenWave SDK CLI and the AsyncAPI generator plugin. ```kotlin val asyncapiPrefix = "classpath:io/example/asyncapi/shoppingcart/apis" val asyncapiInputSpec = "$asyncapiPrefix/asyncapi.yml" val asyncapiAvroImports = "$asyncapiPrefix/avro/" val asyncapiGeneratorTemplates = "SpringKafka" val asyncApiProducerApiPackage = "io.zenwave360.examples.events" val asyncApiConsumerApiPackage = "io.zenwave360.examples.commands" plugins { java id("dev.jbang") version "0.3.0" } tasks.register("generateAsyncApiProvider") { group = "asyncapi" description = "Generates Producer and Consumer code from AsyncAPI specification" script.set("io.zenwave360.sdk:zenwave-sdk-cli:RELEASE") jbangArgs.set(listOf( "--deps=" + "org.slf4j:slf4j-simple:1.7.36," + "io.zenwave360.sdk.plugins:asyncapi-generator:RELEASE," + "org.apache.avro:avro-compiler:1.11.1" )) args.set(listOf( "-p", "AsyncAPIGenerator", "role=provider", "templates=$asyncapiGeneratorTemplates", "apiFile=$asyncapiInputSpec", "targetFolder=${layout.buildDirectory.dir("generated-sources/zenwave").get().asFile.absolutePath}", "transactionalOutbox=modulith", "modelPackage=$asyncApiModelPackage", "producerApiPackage=$asyncApiProducerApiPackage", "consumerApiPackage=$asyncApiConsumerApiPackage", "avroCompilerProperties.imports=$asyncapiAvroImports" )) } sourceSets { main { java { srcDir(layout.buildDirectory.dir("generated-sources/zenwave/src/main/java").get().asFile) } } test { java { srcDir(layout.buildDirectory.dir("generated-sources/zenwave/src/test/java").get().asFile) } } } ``` -------------------------------- ### Maven Configuration for AsyncAPI Client Generation Source: https://github.com/zenwave360/zenwave-sdk/blob/main/plugins/asyncapi-spring-cloud-streams3/README.md Configure Maven to generate the consumer side of an existing API using the 'client' role. Specify the generator, input AsyncAPI specification, and desired output packages. ```xml generate-asyncapi-client-imperative generate-sources generate spring-cloud-streams3 ${pom.basedir}/src/main/resources/model/asyncapi.yml client io.zenwave360.example.api.events.model io.zenwave360.example.api.events ``` -------------------------------- ### Configure ZenWave Maven Plugin for AsyncAPI Generation Source: https://github.com/zenwave360/zenwave-sdk/blob/main/zenwave-sdk-maven-plugin/README.md This snippet shows how to configure the zenwave-sdk-maven-plugin to generate code from an AsyncAPI specification. It includes configurations for both a Spring Cloud Streams 3 producer and JSON schema to POJO conversion for DTOs. ```xml io.zenwave360.sdk zenwave-sdk-maven-plugin ${zenwave.version} generate-asyncapi-producer generate-sources generate spring-cloud-streams3 ${pom.basedir}/src/main/resources/model/asyncapi.yml provider io.zenwave360.example.adapters.events.producer io.zenwave360.example.adapters.events.model generate-asyncapi-producer-dtos generate-sources generate jsonschema2pojo ${pom.basedir}/src/main/resources/model/asyncapi.yml io.zenwave360.example.adapters.events io.zenwave360.example.adapters.events.model io.zenwave360.sdk.plugins asyncapi-spring-cloud-streams3 ${zenwave.version} io.zenwave360.sdk.plugins asyncapi-jsonschema2pojo ${zenwave.version} ``` -------------------------------- ### Generate with OpenAPI Overlay Files Source: https://github.com/zenwave360/zenwave-sdk/blob/main/plugins/openapi-controllers/README.md Utilize `apiOverlayFiles` to patch the OpenAPI source before dereferencing and `allOf` merge. Overlay files are applied in order and are intended for local files and file-backed classpath resources. ```shell jbang zw -p io.zenwave360.sdk.plugins.OpenAPIControllersPlugin \ openapiFile=src/main/resources/model/openapi.yml \ apiOverlayFiles=src/main/resources/model/openapi-overlay.yml \ zdlFile=src/main/resources/model/orders-model.jdl \ targetFolder=. ``` -------------------------------- ### Generate Consumer Adapters with JBang Source: https://github.com/zenwave360/zenwave-sdk/blob/main/plugins/asyncapi-spring-cloud-streams3/README.md Use the `jbang` command with the `SpringCloudStreams3AdaptersPlugin` to generate skeleton consumer adapters. Specify the AsyncAPI spec file, ZDL file, role, style, base package, and specific adapter packages. ```shell jbang zw -p io.zenwave360.sdk.plugins.SpringCloudStreams3AdaptersPlugin --help ``` ```shell jbang zw -p io.zenwave360.sdk.plugins.SpringCloudStreams3AdaptersPlugin \ specFile=src/main/resources/model/asyncapi.yml \ zdlFile=src/main/resources/model/orders-jdl \ role=provider \ style=imperative \ basePackage=io.zenwave360.example \ consumerApiPackage=io.zenwave360.example.adapters.events \ modelPackage=io.zenwave360.example.core.domain.events \ targetFolder=. ``` -------------------------------- ### Maven Plugin Configuration for AsyncAPI Code Generation Source: https://github.com/zenwave360/zenwave-sdk/blob/main/plugins/asyncapi-jsonschema2pojo/README.md Configure the ZenWave Maven Plugin to generate Java code from an AsyncAPI specification. This snippet shows how to specify the generator, input file, and jsonschema2pojo configuration options. ```xml io.zenwave360.sdk zenwave-sdk-maven-plugin ${zenwave.version} generate-asyncapi-producer generate-sources generate jsonschema2pojo ${pom.basedir}/src/main/resources/model/asyncapi.yml io.zenwave360.example.adapters.events.model ${pom.basedir}/src/main/resources/model/asyncapi-overlay.yml true io.zenwave360.sdk.plugins asyncapi-jsonschema2pojo ${zenwave.version} ``` -------------------------------- ### Generate Markdown Glossary from ZDL File Source: https://github.com/zenwave360/zenwave-sdk/blob/main/plugins/zdl-to-markdown/README.md Use this command to generate a Markdown glossary from a specified ZDL file. The output is written to a target file. ```shell jbang zw -p io.zenwave360.sdk.plugins.ZdlToMarkdownPlugin \ specFile=src/main/resources/model/customer-address.zdl \ targetFile=src/main/resources/model/customer-address.md ``` -------------------------------- ### Generate Terraform with Overlays Source: https://github.com/zenwave360/zenwave-sdk/blob/main/plugins/asyncapi-ops/README.md Utilize overlay files to patch AsyncAPI specifications before dereferencing and merging. This command demonstrates applying overlay files to multiple input API specifications. ```shell jbang zw -p AsyncAPIOpsGeneratorPlugin \ apiFiles=asyncapi.yml,asyncapi-client.yml \ apiOverlayFiles=asyncapi-overlay.yml \ server=staging \ targetFolder=terraform/out ``` -------------------------------- ### Configure OpenAPI Generator for Compatibility Source: https://github.com/zenwave360/zenwave-sdk/blob/main/plugins/openapi-controllers/README.md This XML configuration snippet shows compatible options for the `openapi-generator-maven-plugin` (version 7.8.0) with ZenWave360 SDK. Ensure `sortParamsByRequiredFlag` is set to `false`. ```xml org.openapitools openapi-generator-maven-plugin 7.8.0 generate generate-sources ${project.basedir}/src/main/resources/public/apis/openapi.yml true spring ${openApiApiPackage} ${openApiModelPackage} DTO true false Double=java.math.BigDecimal true none false false true true true false false ``` -------------------------------- ### Generate Avro Schemas from Remote URLs using ZenWave CLI Source: https://github.com/zenwave360/zenwave-sdk/blob/main/plugins/avro-schema-compiler/README.md Use this command to generate Java classes from Avro schemas hosted on remote HTTP URLs. Specify the schema file paths and the target folders for generated sources. ```shell jbang zw -p io.zenwave360.sdk.plugins.AvroSchemaGeneratorPlugin \ avroFiles="https://raw.githubusercontent.com/ZenWave360/zenwave-sdk/main/plugins/avro-schema-compiler/src/test/resources/avros/customer-event/Address.avsc, \ https://raw.githubusercontent.com/ZenWave360/zenwave-sdk/main/plugins/avro-schema-compiler/src/test/resources/avros/customer-event/PaymentMethod.avsc, \ https://raw.githubusercontent.com/ZenWave360/zenwave-sdk/main/plugins/avro-schema-compiler/src/test/resources/avros/customer-event/PaymentMethodType.avsc, \ https://raw.githubusercontent.com/ZenWave360/zenwave-sdk/main/plugins/avro-schema-compiler/src/test/resources/avros/customer-event/CustomerEvent.avsc" \ sourceFolder=src/main/java \ targetFolder=target/generated-sources/avro ``` -------------------------------- ### Generate APIs from AsyncAPI using JBang Source: https://github.com/zenwave360/zenwave-sdk/blob/main/plugins/asyncapi-generator/README.md Use this command to generate producer, consumer, and model APIs from an AsyncAPI file. It allows specifying authentication details, Avro schema imports, and the target output folder. ```shell jbang zw -p AsyncAPIGeneratorPlugin \ authentication[0].key=API_KEY \ authentication[0].value=API_KEY_VALUE \ apiFile=https://raw.githubusercontent.com/ZenWave360/zenwave-playground/refs/heads/main/examples/asyncapi-shopping-cart/apis/asyncapi.yml \ consumerApiPackage=io.example.api.consumer \ producerApiPackage=io.example.api.producer \ modelPackage=io.example.api.model \ avroCompilerProperties.imports="\ https://raw.githubusercontent.com/ZenWave360/zenwave-playground/refs/heads/main/examples/asyncapi-shopping-cart/apis/avro/Item.avsc,\ https://raw.githubusercontent.com/ZenWave360/zenwave-playground/refs/heads/main/examples/asyncapi-shopping-cart/apis/avro/ShoppingCart.avsc" \ targetFolder=target/generated-sources ``` -------------------------------- ### Generate APIs with AsyncAPI Overlays using JBang Source: https://github.com/zenwave360/zenwave-sdk/blob/main/plugins/asyncapi-generator/README.md This command generates APIs by first patching the main AsyncAPI file with an overlay file before processing. It's useful for applying local modifications or configurations. ```shell jbang zw -p AsyncAPIGeneratorPlugin \ apiFile=src/main/resources/asyncapi.yml \ apiOverlayFiles=src/main/resources/asyncapi-overlay.yml \ modelPackage=io.example.api.model \ producerApiPackage=io.example.api.producer \ consumerApiPackage=io.example.api.consumer \ targetFolder=target/generated-sources ```