Class AsyncApiGenerator

java.lang.Object
org.sdase.commons.shared.asyncapi.AsyncApiGenerator

public class AsyncApiGenerator extends Object
Generator used to build AsyncAPI specs from a template base file and schemas generated from code. The schemas are referenced via custom class $references in an AsyncAPI yaml template like at the very end of the following example AsyncAPI:
   asyncapi: '2.5.0'
   id: urn:com:example:entity
   defaultContentType: application/json
   info:
     title: Example App
     description: This example is about events of an example.
     version: '1.0.0'

   channels:
     'partner-created':
       publish:
         operationId: publishPartnerCreatedEvents
         summary: Partner Created Events
         description: A new partner was created
         message:
           oneOf:
             - $ref: '#/components/messages/SomeEvent'

   components:
     messages:
       SomeEvent:
         title: Some Event
         description: Something happened.
         payload:
           # Reference to a class in the classpath.
           # The reference will by replaced by the local path of the generated schema, e.g.
           # $ref: '#/components/schemas/SomeEvent'
           $ref: class://com.example.entity.model.SomeEvent
 
These referenced files are automatically created from Java classes annotated with Jackson, Swagger and Jakarta Validation annotations. Afterwards everything is embedded into a single self-contained AsyncAPI yaml file.