AsyncAPI documents

An AsyncAPI 3 document is recognized by the asyncapi field of its root and formatted with the asyncapi section of commands.format. The section takes format, indent, force_array_indent and style, with the values described in Layout and YAML styles, and property_order, with the orders of the OpenAPI section and the objects below. The presets of extends apply to AsyncAPI documents as to the others.

Example - Recommended settings for both specifications, with a custom property order for AsyncAPI Operation objects

commands:
  format:
    extends:
      - recommended
    asyncapi:
      indent: 2
      property_order:
        channels: sorted
        operation:
          - action
          - channel
          - summary
          - description
          - messages
          - reply

Objects

The keys of property_order are default and the names of the objects of AsyncAPI 3 below. Each key takes sorted, original or an array of property names; the last column is the order of the recommended preset.

Key Object Recommended order
asyncapi AsyncAPI (document root) asyncapi, id, info, servers, defaultContentType, channels, operations, components
info Info title, version, description, termsOfService, contact, license, tags, externalDocs
contact Contact name, url, email
license License name, url
servers Servers original
server Server host, protocol, protocolVersion, pathname, title, summary, description, variables, security, tags, externalDocs, bindings
serverVariable Server Variable enum, default, description, examples
channels Channels sorted
channel Channel address, title, summary, description, servers, parameters, messages, tags, externalDocs, bindings
parameter Parameter enum, default, description, examples, location
operations Operations original
operation Operation action, channel, title, summary, description, security, tags, externalDocs, bindings, traits, messages, reply
operationTrait Operation Trait title, summary, description, security, tags, externalDocs, bindings
operationReply Operation Reply address, channel, messages
operationReplyAddress Operation Reply Address description, location
message Message name, title, summary, description, contentType, correlationId, headers, payload, tags, externalDocs, bindings, examples, traits
messageTrait Message Trait name, title, summary, description, contentType, correlationId, headers, tags, externalDocs, bindings, examples
messageExample Message Example name, summary, headers, payload
correlationId Correlation ID description, location
tag Tag name, description, externalDocs
externalDocumentation External Documentation description, url
components Components schemas, servers, channels, operations, messages, securitySchemes, serverVariables, parameters, correlationIds, replies, replyAddresses, externalDocs, tags, operationTraits, messageTraits, serverBindings, channelBindings, operationBindings, messageBindings
reference Reference $ref
schema Schema (component, message payload/headers) title, description, type, format, const, enum, default, examples, minimum, exclusiveMinimum, maximum, exclusiveMaximum, multipleOf, minLength, maxLength, pattern, items, contains, minItems, maxItems, uniqueItems, required, properties, …
securityScheme Security Scheme type, description, name, in, scheme, bearerFormat, flows, openIdConnectUrl, scopes
oauthFlows OAuth Flows implicit, password, clientCredentials, authorizationCode
oauthFlow OAuth Flow authorizationUrl, tokenUrl, refreshUrl, availableScopes
bindings Server, Channel, Operation, Message Bindings sorted

Properties that are not listed in a fixed order are placed after the listed ones, in the same order as in the input file.

Was this helpful?