Features #
- AsyncAPI >=3.0.0 support (2.6.0 is not supported)
- Support the majority of AsyncAPI entities
- Servers, channels, operations, messages, schemas, parameters, correlation IDs, etc. (see below)
- JSONSchema
- JSONSchema polymorphism (oneOf, anyOf, allOf)
- Specification extensions (
x-
fields), that control the code generation process
- Support many protocols
- Support several AsyncAPI documents at once
- YAML configuration file
- Generating the no-code CLI client executable with basic send-receive functionality
- Generating the infrastructure-as-code (IaC) files in supported engines.
- Go code generation
- Implementation-agnostic code
- Built-in ready to use implementations based on most
popular libraries
- At least one implementation for every supported protocol
- Automatic injection to the generated code (optional)
- You can make your own implementation and use it in the generated code
- Partial generation of the AsyncAPI document
- Pub/sub only generation
- Ignoring particular AsyncAPI entities in document and in go-asyncapi config
- Content types support
- Adding a new content type
- Replacing the default encoder/decoder code for the supported content type
- Flexible customization of code layout
- Code reuse
- Automatic formatting by
gofmt
- Automatic determining the user project’s module name
sync.Pool
-friendly code
- Support of internal references (
$ref
) in document - Support of external references (
$ref
) in document to other AsyncAPI documents- Locating a document in local files, by making HTTP(S) requests
- For complex scenarios you can provide a custom locator shell command
- Output customization via templates in text/template format
- Plenty of functions available. Provided by github.com/go-sprout/sprout
- Templates are organized in a tree structure, allowing customization on any granularity level
- Tracing of function calls, easing the pain of template debugging
- Verbose logging in debug and trace levels
Protocols #
Here are the protocols that are supported by go-asyncapi
for now:
* - not described in the AsyncAPI specification
AsyncAPI support #
The marked items below are supported by the go-asyncapi
tool, unmarked items are in the roadmap.
For the reference, see AsyncAPI specification
AsyncAPI Entities:
- AsyncAPI object
- Identifier object (
$id
) - Info object
- Contact object
- License object
- Default Content Type
- Servers object
- Server object
- Server Variable object
- Server Bindings object
- Server object
- Channels object
- Channel object
- Channel Bindings object
- Channel object
- Messages object
- Message object
- Message Example object
- Message Bindings object
- Message object
- Operations object
- Operation object
- Operation Trait object
- Operation Reply object
- Operation Reply Address object
- Operation Bindings object
- Operation object
- Parameters object
- Parameter object
- Tags object
- Tag object
- External Documentation object
- Components object
- Security Scheme object
- OAuth Flows object
- OAuth Flow object
- Correlation ID object
Other features:
- Reference object (
$ref
) - Schema object
- Primitive types (number, string, boolean, etc.)
- Object types
- Array types
- Polymorphism: OneOf, AnyOf, AllOf
- Channel Address Expressions
- Multi Format Schema object (link to non-AsyncAPI document)
- Runtime Expression
- Traits merge mechanism
Content types #
The following content types (MIME types) has the default implementation in the generated code:
- application/json: encoding/json
- application/yaml, application/x-yaml, text/yaml, text/x-yaml, text/vnd.yaml: gopkg.in/yaml.v3
You also can add any content type and its encoder/decoder code in templates, see more.
Infrastructure as code (IaC) generation #
The go-asyncapi
tool supports the generation for the following engines: