The New Era Approaches

Jonas Lagoni

Jonas Lagoni

ยท6 min read

Back in March 2022, you heard the first official words around AsyncAPI 3.0. Since then, a lot of people have been working diligently across many expertise to bring it to life. And with its current state, it's finally time to give an update on the progress.

Show Me the Money!

We are not going to give any lengthy description of features, fixes, and changes. Instead, I will just show you the money as a teaser. ๐Ÿ˜‰

Below is an AsyncAPI v3 document that defines how you, a public application, can interact with my Smartylighting Streetlights system, where you can turn on a specific streetlight through WebSocket and get real-time information about environmental lighting conditions through Kafka.

See how many features you can spot just from this example. Some changes are absent in the example, but I tried to cramp as many changes into it as possible. Below the example is a short list of changes you'll be able to fact-check your guess with.

1asyncapi: "3.0.0"
2info:
3  title: Smartylighting Streetlights public API
4  version: "1.0.0"
5  description: |
6    The Smartylighting Streetlights public API allows you to remotely manage the city lights through Kafka and WebSocket.
7
8    ### Check out its awesome features:
9
10    * Turn a specific streetlight on ๐ŸŒƒ
11    * Receive real-time information about environmental lighting conditions ๐Ÿ“ˆ
12  license:
13    name: Apache 2.0
14    url: https://www.apache.org/licenses/LICENSE-2.0
15
16servers:
17  kafka:
18    host: test.mykafkacluster.org:8092
19    protocol: kafka-secure
20    description: Test Kafka broker
21    security:
22      - $ref: '#/components/securitySchemes/saslScram'
23  websocket:
24    host: test.websocket.org:1999
25    protocol: ws
26    description: Test WebSocket server
27
28defaultContentType: application/json
29
30channels:
31  turnStreetlightOnChannel:
32    address: "/"
33    messages:
34      turnOn: 
35        $ref: "#/components/messages/turnOn"
36    servers:
37      - $ref: "#/servers/websocket"
38
39  turnStreetlightOnReplyChannel:
40    address: "/"
41    messages:
42      turnOnReply: 
43        $ref: "#/components/messages/turnOnReply"
44    servers:
45      - $ref: "#/servers/websocket"
46
47  lightMeasured:
48    description: The topic on which measured values may be produced and consumed.
49    address: "smartylighting.streetlights.1.0.event.{streetlightId}.lighting.measured"
50    parameters:
51      streetlightId:
52        $ref: "#/components/parameters/streetlightId"
53    messages:
54      lightMeasured: 
55        $ref: "#/components/messages/lightMeasured"
56    servers:
57      - $ref: "#/servers/kafka"
58
59operations:
60  turnOn:
61    action: send
62    operationId: turnOn
63    channel:
64      $ref: "#/channels/turnStreetlightOnChannel"
65    reply:
66      channel:
67        $ref: "#/channels/turnStreetlightOnReplyChannel"
68
69  lightMeasured:
70    action: receive
71    summary: Inform about environmental lighting conditions of a particular streetlight.
72    operationId: receiveLightMeasurement
73    channel:
74      $ref: "#/channels/lightMeasured"
75    traits:
76      - $ref: "#/components/operationTraits/kafka"
77
78components:
79  messages:
80    turnOn:
81      name: turnOn
82      title: Turn on
83      summary: Command a particular streetlight to turn the lights on.
84      payload:
85        $ref: "#/components/schemas/turnOnPayload"
86
87    turnOnReply:
88      name: turnOnReply
89      title: Turn on reply
90      summary: Reply from turning on the lights
91      payload:
92        $ref: "#/components/schemas/turnOnReplyPayload"
93
94    lightMeasured:
95      name: lightMeasured
96      title: Light measured
97      summary: Inform about environmental lighting conditions of a particular streetlight.
98      contentType: application/json
99      traits:
100        - $ref: "#/components/messageTraits/commonHeaders"
101      payload:
102        $ref: "#/components/schemas/lightMeasuredPayload"
103
104  schemas:
105    turnOnPayload:
106      type: object
107      properties:
108        streetlightId:
109          description: The ID of the streetlight.
110          type: string
111        sentAt:
112          type: string
113          format: date-time
114          description: Date and time when the request was sent
115
116    turnOnReplyPayload:
117      type: object
118      properties:
119        turnedOnTimestamp:
120          type: string
121          format: date-time
122          description: Date and time when the light was actually turned on.
123
124    lightMeasuredPayload:
125      schemaFormat: "application/vnd.apache.avro;version=1.9.0"
126      schema:
127        type: record
128        name: User
129        namespace: com.company
130        doc: User information
131        fields:
132          - name: lumens
133            type: int
134          - name: sentAt
135            type: timestamp_ms
136
137  securitySchemes:
138    saslScram:
139      type: scramSha256
140      description: Provide your username and password for SASL/SCRAM authentication
141
142  parameters:
143    streetlightId:
144      description: The ID of the streetlight.
145
146  messageTraits:
147    commonHeaders:
148      headers:
149        type: object
150        properties:
151          my-app-header:
152            type: integer
153            minimum: 0
154            maximum: 100
155
156  operationTraits:
157    kafka:
158      bindings:
159        kafka:
160          clientId: public

As of the pre-release v3.0.0-next-major-spec.12, this is a valid AsyncAPI document. You can always find the most recent pre-release version here: https://www.asyncapi.com/docs/reference.

All the changes in 3.0 up until now are the following:

  • Request/reply pattern.
  • Introduce the new Channel Object, detached from operations.
  • Introduce the new Operation object, detached from channels.
  • Channels are no longer identified with address/topic/path.
  • Optional channels.
  • Schemas and schema formats are now naturally bound.
  • Cleaned up the root object.
  • Added additional meta fields for Server Object, Channel Object, Operation Object, and Operation Trait Object.
  • External Documentation Object and Tag Object can now be reused and referenced.
  • Unified referencing behavior.

In due time we will give you a complete rundown about all the changes in 3.0 and extended documentation that explains the features in more in-depth, including a migration guide and release blog post.

The Remaining Effort

The specification work is nearly done; only one change is still being discussed which is changing traits behavior to an inheritance that can be overwritten.

However, at AsyncAPI, a specification is nothing without documentation and tools, which is why the majority of the remaining effort resolves just that.

For documentation, you have probably noticed that since the first release of 2.0, we now have concepts, tutorials, and guides. Some of those docs will be updated due to 3.0.

Regarding tooling, it's impossible to give you a clear overview of what exactly will support 3.0 right out the gate because there are many different code owners and contributors with individual priorities. So if you want a tool to support 3.0 right out the gate, please do head over to the issue and voice the need, add a ๐Ÿ‘, write a comment, or maybe even contribute the needed changes!

The only tools we can say for sure that will support 3.0 right out the gate are the JS parser and the specification JSON Schema documents because they need to be updated for any specification change to be accepted ๐Ÿ˜†

Currently, we are using completed tasks as the release date for 3.0. Once all tasks are completed, we'll release 3.0.

Release Date

That leaves the big question... When is the release then?

Honestly, we tried to stick with a release date, and more specifically, we thought the July release period (yes, next month). However as you can probably guess with the remaining work, that's most likely not going to happen. As we are learning, major changes take time, and schedules in open source are, hard, to say the least. ๐Ÿ˜„

While all the specification changes are most likely done by July, my best guess, right now, is for everything to be released in September.

The more people help out, the faster it will get done. ๐Ÿ˜‰

The next time you will hear from me will be the release blog post for 3.0. ๐Ÿ‘‹

Photo by Tim Marshall on Unsplash