OpenAPI-AsyncAPI
OpenAPI-AsyncAPI
The Zilla config uses many of the same parameters as the public and open-source interface definition languages OpenAPI and AsyncAPI. Services and tools are available to describe your existing APIs and infrastructure using OpenAPI and AsyncAPI definitions. These specs enable more consistent documentation, versioning, and code generation. Using the openapi and asyncapi bindings enables the use of existing interface specs to configure Zilla.
Zilla leverages the interface definitions in these specs to generate the necessary zilla.yaml
config to implement the defined services. Zilla doesn't generate code that needs to be maintained. Instead, it generates the underlying configuration necessary to implement a functioning interface. Both standard and complex use cases are implemented easily with Zilla.
You can see a working Petstore Demo using OpenAPI/AsyncAPI schemas. Zilla can also define and proxy MQTT endpoints utilizing a pair of AsyncAPI schemas. Check out the Taxi Demo to see a Zilla MQTT proxy defined using AsyncAPI, which is deployed Live using Kubernetes.
OpenAPI-AsyncAPI proxy
The openapi-asyncapi proxy binding for adapting openapi
operations to asyncapi
operations.
openapi_asyncapi_proxy:
type: openapi-asyncapi
kind: proxy
options:
specs:
openapi:
my-openapi-spec:
catalog:
my_catalog:
subject: petstore
version: latest
asyncapi:
my-asyncapi-spec:
catalog:
my_catalog:
subject: petstore
version: latest
routes:
- when:
- api-id: my-openapi-spec
exit: asyncapi_client
with:
api-id: my-asyncapi-spec
Configuration (* required)
options
object
Property | Type | Description |
---|---|---|
options.specs | object | OpenAPI and AsyncAPI specs definition. |
options.specs.openapi* | Map<string, object> | Options for each configured OpenAPI spec. |
openapi.catalog | Map<string, object> | The Catalog specific options. |
options.catalog.subject* | string | Subject name used when storing the catalog artifact. |
options.catalog.version | string | Default: latest |
options.specs.asyncapi* | Map<string, object> | Options for each configured AsyncAPI spec. |
options.asyncapi.catalog | Map<string, object> | The catalog catalog specific options. |
options.catalog.subject* | string | Subject name used when storing the catalog artifact. |
options.catalog.version | string | Default: latest |
Examples
The openapi-asyncapi
specific options.
options:
specs:
openapi:
my-openapi-spec:
catalog:
my_catalog:
subject: petstore
version: latest
asyncapi:
my-asyncapi-spec:
catalog:
my_catalog:
subject: petstore
version: latest
routes
object[]
Property | Type | Description |
---|---|---|
routes[].guarded | Map<string, string[]> | List of roles required by each named guard to authorize this route. |
routes[].when | object[] | List of conditions to match this route when adapting openapi request-response streams to asyncapi streams. Read more: When a route matches |
routes[].when[].api-id | string | OpenAPI spec identifier that matches from the openapi binding request stream. |
routes[].when[].operation-id | string | OpenAPI OperationId that can be mapped between OpenAPI and AsyncAPI spec |
routes[].exit | string | Next binding when following this route. |
routes[].with* | object | Defines the route with the AsyncAPI spec identifier and OperationId. |
routes[].with.api-id | string | AsyncAPI spec identifier that the route exits with to the next binding. |
routes[].with.operation-id | string | AsyncAPI OperationId that the route exits with to the next binding. |
Examples
Conditional openapi-asyncapi
specific routes.
routes:
- guarded:
my_guard:
- read:items
with:
api-id: my-asyncapi-spec