@asyncapi/generator
Version:
The AsyncAPI generator. It can generate documentation, code, anything!
391 lines (374 loc) • 11.3 kB
YAML
asyncapi: '2.3.0'
externalDocs:
description: Find more info here
url: https://www.asyncapi.com
info:
title: Dummy example with all spec features included
version: '0.0.1'
description: |
This is an example of AsyncAPI specification file that is suppose to include all possible features of the AsyncAPI specification. Do not use it on production.
It's goal is to support development of documentation and code generation with the [AsyncAPI Generator](https://github.com/asyncapi/generator/) and [Template projects](https://github.com/search?q=topic%3Aasyncapi+topic%3Agenerator+topic%3Atemplate)
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0
contact:
name: API Support
url: http://www.asyncapi.com/support
email: info@asyncapi.io
x-twitter: '@AsyncAPISpec'
tags:
- name: root-tag1
externalDocs:
description: External docs description 1
url: https://www.asyncapi.com/
- name: root-tag2
description: Description 2
externalDocs:
url: "https://www.asyncapi.com/"
- name: root-tag3
- name: root-tag4
description: Description 4
- name: root-tag5
externalDocs:
url: "https://www.asyncapi.com/"
servers:
dummy-mqtt:
$ref: '#/components/servers/dummyMQTT'
dummy-amqp:
url: amqp://localhost:{port}
protocol: amqp
description: dummy AMQP broker
protocolVersion: "0.9.1"
variables:
port:
enum:
- '15672'
- '5672'
security:
- user-password: []
dummy-kafka:
url: http://localhost:{port}
protocol: kafka
description: dummy Kafka broker
variables:
port:
default: '9092'
defaultContentType: application/json
channels:
dummy/channel/with/{dummy}/parameter/create:
x-dummy-security:
$ref: '#/components/securitySchemes/supportedOauthFlows/flows/clientCredentials'
description: Dummy channel description.
parameters:
dummy:
$ref: '#/components/parameters/dummy'
publish:
summary: Inform whenever something dummy is created.
description: |
Longer description.
Still dummy though.
operationId: receiveNewDummyInfo
tags:
- name: oparation-tag1
externalDocs:
description: External docs description 1
url: https://www.asyncapi.com/
- name: oparation-tag2
description: Description 2
externalDocs:
url: "https://www.asyncapi.com/"
- name: oparation-tag3
- name: oparation-tag4
description: Description 4
- name: oparation-tag5
externalDocs:
url: "https://www.asyncapi.com/"
traits:
- $ref: '#/components/operationTraits/kafka'
message:
$ref: '#/components/messages/dummyCreated'
dummy/channel/without/parameter:
$ref: '#/components/channels/dummyChannel'
components:
servers:
dummyMQTT:
url: mqtt://localhost
protocol: mqtt
description: dummy MQTT broker
bindings:
mqtt:
clientId: guest
cleanSession: true
channels:
dummyChannel:
bindings:
amqp:
is: routingKey
subscribe:
operationId: receiveSystemInfo
bindings:
amqp:
expiration: 100000
userId: guest
cc: [ 'user.logs' ]
priority: 10
deliveryMode: 2
mandatory: false
bcc: [ 'external.audit' ]
replyTo: user.signedup
timestamp: true
ack: false
bindingVersion: 0.1.0
message:
$ref: '#/components/messages/dummyInfo'
messages:
dummyCreated:
name: dummyCreated
title: Dummy created message
summary: This is just a dummy create message
correlationId:
description: This is a dummy correlation ID.
location: $message.header#/correlationId
tags:
- name: message-tag1
externalDocs:
description: External docs description 1
url: https://www.asyncapi.com/
- name: message-tag2
description: Description 2
externalDocs:
url: "https://www.asyncapi.com/"
- name: message-tag3
- name: message-tag4
description: Description 4
- name: message-tag5
externalDocs:
url: "https://www.asyncapi.com/"
headers:
type: object
properties:
my-custom-app-header:
type: string
correlationId:
type: string
payload:
$ref: "#/components/schemas/dummyCreated"
bindings:
kafka:
key:
type: object
properties:
id:
type: string
format: uuid
type:
type: string
enum: [ 'type1', "type2" ]
bindingVersion: '0.1.0'
amqp:
contentEncoding: gzip
messageType: 'user.signup'
bindingVersion: 0.1.0
x-response:
$ref: "#/components/messages/dummyInfo"
dummyInfo:
name: dummyInfo
title: Dummy system info
summary: This is just a dummy info message
correlationId:
location: $message.header#/correlationId
description: |
More description for a dummy message.
It is a dummy system info message.
traits:
- $ref: '#/components/messageTraits/commonHeaders'
payload:
$ref: "#/components/schemas/dummyInfo"
examples:
- name: option1example
summary: this is dummy summary for option1example
headers:
my-app-header: 12
payload:
prop1: option1
sentAt: 2020-01-31T13:24:53Z
- name: headerExample
headers:
my-app-header: 13
- payload:
prop1: option2
sentAt: 2020-01-31T13:24:53Z
schemas:
dummyCreated:
type: object
required:
- prop2
x-schema-extensions-as-object:
type: object
properties:
prop1:
type: string
prop2:
type: integer
minimum: 0
x-schema-extensions-as-primitive: dummy
x-schema-extensions-as-array:
- "item1"
- "item2"
properties:
prop1:
type: integer
minimum: 0
description: Dummy prop1
x-prop1-dummy: dummy extension
prop2:
type: string
description: Dummy prop2
sentAt:
$ref: "#/components/schemas/sentAt"
dummyArrayWithObject:
$ref: "#/components/schemas/dummyArrayWithObject"
dummyArrayWithArray:
$ref: "#/components/schemas/dummyArrayWithArray"
dummyObject:
$ref: "#/components/schemas/dummyObject"
dummyArrayRank:
$ref: '#/components/schemas/dummyArrayRank'
dummyInfo:
type: object
required:
- prop1
properties:
prop1:
type: string
enum:
- option1
- option2
description: Dummy prop1
sentAt:
$ref: "#/components/schemas/sentAt"
dummyArrayWithObject:
type: array
items:
$ref: "#/components/schemas/dummyInfo"
dummyArrayWithArray:
type: array
items:
- $ref: "#/components/schemas/dummyInfo"
- type: string
- type: number
dummyObject:
type: object
properties:
dummyObjectProp1:
$ref: "#/components/schemas/sentAt"
dummyObjectProp2:
$ref: "#/components/schemas/dummyRecursiveObject"
dummyObjectProp3:
type: object
additionalProperties: true
dummyObjectProp4:
type: object
additionalProperties: false
dummyRecursiveObject:
type: object
properties:
dummyRecursiveProp1:
$ref: "#/components/schemas/dummyObject"
dummyRecursiveProp2:
type: string
sentAt:
type: string
format: date-time
description: Date and time when the message was sent.
dummyArrayRank:
type: object
properties:
dummyArrayValueRank:
$ref: '#/components/schemas/dummyArrayValueRank'
dummyArrayDimensions:
$ref: '#/components/schemas/dummyArrayArrayDimensions'
dummyArrayValueRank:
description: >
This Attribute indicates whether the val Attribute of the datapoint is an
array and how many dimensions the array has.
type: integer
default: -1
examples:
- 2
oneOf:
- const: -1
description: 'Scalar: The value is not an array.'
- const: 0
description: 'OneOrMoreDimensions: The value is an array with one or more dimensions.'
- const: 1
description: 'OneDimension: The value is an array with one dimension.'
- const: 2
description: 'The value is an array with two dimensions.'
dummyArrayArrayDimensions:
type: array
items:
type: integer
minimum: 0
examples:
- [3, 5]
securitySchemes:
user-password:
type: userPassword
apiKey:
type: apiKey
in: user
description: Provide your API key as the user and leave the password empty.
supportedOauthFlows:
type: oauth2
description: Flows to support OAuth 2.0
flows:
implicit:
authorizationUrl: 'https://authserver.example/auth'
scopes:
'dummy:created': Ability to create dummy message
'dymmy:read': Ability to read dummy info
password:
tokenUrl: 'https://authserver.example/token'
scopes:
'dummy:created': Ability to create dummy message
'dymmy:read': Ability to read dummy info
clientCredentials:
tokenUrl: 'https://authserver.example/token'
scopes:
'dummy:created': Ability to create dummy message
'dymmy:read': Ability to read dummy info
authorizationCode:
authorizationUrl: 'https://authserver.example/auth'
tokenUrl: 'https://authserver.example/token'
refreshUrl: 'https://authserver.example/refresh'
scopes:
'dummy:created': Ability to create dummy message
'dymmy:read': Ability to read dummy info
openIdConnectWellKnown:
type: openIdConnect
openIdConnectUrl: 'https://authserver.example/.well-known'
parameters:
dummy:
description: The ID of the new dummy message.
schema:
type: string
description: Description that not be rendered, as parameter has explicit description.
messageTraits:
commonHeaders:
headers:
type: object
properties:
my-app-header:
type: integer
minimum: 0
maximum: 100
correlationId:
type: string
operationTraits:
kafka:
bindings:
kafka:
groupId: my-app-group-id
clientId: my-app-client-id
bindingVersion: '0.1.0'