I am new using AsyncAPI specification. I have defined an AsyncAPI definition in a YAML file. As the definition is growing up I wanted to split it among several files. But I have no idea about how to do this.
I have search some examples on Google, but any decent result was found. Could anyone show me some examples about this topic? Or guide me to do this.
Thanks in advance.
The short answer is, by using the Reference Object(
$ref
) where possible, so make sure to check the AsyncAPI specification to figure out where references can be used.That way you can use relative references to achieve splitting up the AsyncAPI document into multiple files:
If you employ ownership of messages (say application A owns a message application B consumes) you could reference them as such:
We currently have some discussions around what ways you can define an AsyncAPI document and how reusability plays a role (with different examples) - https://github.com/asyncapi/spec/issues/628#issuecomment-968050476
Tools
When you split up your AsyncAPI document, you might want to have some tools help you out to easier work with them.
Bundler
Now that you have started with reusability, you might encounter use-cases where you want to bundle things back together. That is where the AsyncAPI Bundler comes into play.
Optimizer
If you already have AsyncAPI documents that you wish to split up into more reusable chunks, you can use the AsyncAPI optimizer to help you in that effort.