AsyncAPI Spec 2.1.0 Release Notes

Lukasz Gornicki

·4 min read

The last AsyncAPI release (2.0.0) took place on the 11th of September, 2019. In 2020 the focus went into growing community and adoption and stabilization of basic tooling for specification. This year was a year of "formalizm" 😃 aka getting into the foundation, setting up governance model and contribution guide to enable work on next spec release. We are good to go forward. The 2.1.0 release is out in the wild 🎉

Message examples object extended with additional fields

Thanks to work done by Laurent Broudoux, you can now clearly describe message examples. New properties name and summary are optional. These properties help not only to properly describe the example in documentation but make it easier to work with mocking and testing tools (like microcks), so you can better identify what example to use for mocking and what it does.

Example of new properties added to existing WebSocket example for Gemini API:

1components:
2  messages:
3    marketData:
4      summary: Message with marked data information.
5      description: |
6        The initial response message will show the existing state of the order book. Subsequent messages will show all executed trades, as well as all other changes to the order book from orders placed or canceled.
7      payload:
8        $ref: '#/components/schemas/market'
9      examples:
10        - name: updateMessage
11          summary: Example of an update message that contains a change in price information.
12          payload:
13            type: update
14            eventId: 36902233362
15            timestamp: 1619769673
16            timestampms: 1619769673527
17            socket_sequence: 661
18            events:
19              - type: change
20                side: bid
21                price: '54350.40'
22                remaining: '0.002'
23                delta: '0.002'
24                reason: place
25        - name: heartbeatMessage
26          summary: Example of additional heartbeat message when you enable them. 
27          payload:
28            type: heartbeat
29            socket_sequence: 1656

Rendering of new example properties in React component and HTML template:

For more details, check out this pull request.

New protocol bindings

The specification is now extended to support the following custom protocols through the bindings feature:

Support for Avro and OpenAPI schemas changed from mandatory to recommended through contribution from Fran Mendez. For more details, check out this pull request

New security schemes

Thanks to Dale Lane, you can now describe secured Kafka clusters with SASL security schemes (scramSha256, scramSha512, gssapi). For more details, check out this pull request.

Old new defaultContentType property in root object

We used and supported defaultContentType property to specify the default content type when encoding/decoding a message's payload. Lucas Block spotted that we do not have it defined in the specification. For more details, check out this pull request.

Tooling support

The following official AsyncAPI tools are already updated to support 2.1.0 version of the specification:

  • JSON Schema that supports validation of AsyncAPI documents is updated in this repository. Also @asyncapi/specs package has been updated on NPM to version 2.8.0, and it contains the 2.1.0 JSON Schema.
  • JavaScript Parser uses latest @asyncapi/specs package and can be used to parse and validate 2.1.0 documents. Upgrade to 1.7.0 version.
  • AsyncAPI Generator uses the latest @asyncapi/parser package, so while generating output, it can validate 2.1.0 documents. Upgrade to 1.8.0 version
  • Generator filters functions getPayloadExamples and getHeadersExamples support new message example properties. Upgrade to 2.0.0 version.
  • React component supports rendering of new message example properties. Upgrade to v1.0.0-next.10 version.
  • Markdown template supports rendering of new message example properties. Upgrade to 0.14.0 version.
  • HTML template uses the latest @asyncapi/react-component package. Upgrade to 0.23.0 version.
  • JavaScript Converter enables conversion from any AsyncAPI version into the 2.1.0 version of the spec. Upgrade to 0.5.0 version.
  • Modelina now also accepts AsyncAPI documents valid against the 2.1.0 version of the spec. Upgrade to 0.16.0 version.

Last but not least is the AsyncAPI Playground. Check new playground that uses latest HTML template and Markdown template with this example.

Big thanks to Maciej Urbanczyk and Jonas Lagoni for updating most relevant tooling.

This is not all! Not only official AsyncAPI tools are updated. Thanks to Laurent Broudoux also Microcks now supports version 2.1.0 and its new example's properties. Upgrade to 1.3.0 version.

Thank you

I want to send a special thank you to Aayush Kumar Sahu, who helped us to automate the part of the release responsible for updating the specification Markdown document on the AsyncAPI website, right after triggering the release, even the release candidate. Thank you 🙇.

Photo by Doug Swinson on Unsplash