Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: adding document for extending the AsyncAPI specification #2407

Merged
merged 4 commits into from
Dec 16, 2023
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
title: Extending Specification
alequetzalli marked this conversation as resolved.
Show resolved Hide resolved
weight: 240
---

Extending the AsyncAPI specification is a technique that allows you to include domain-specific or use case specific information not supported by the base specification or protocol-specific bindings. This extension capability provides customization, enabling APIs to accommodate unique details that would not otherwise fit within the confines of the standard AsyncAPI specification.
alequetzalli marked this conversation as resolved.
Show resolved Hide resolved

## Specification extensions

The AsyncAPI Specification allows the addition of custom properties through patterned fields prefixed with `x-`. This helps you create unique things without causing problems with future updates.
alequetzalli marked this conversation as resolved.
Show resolved Hide resolved

The `x-` prefix is used to define custom properties. These properties are user-defined and won't conflict with future specification versions because any property starting with `x-` is reserved for user definitions.

Extensions can be use in any part of AsyncAPI document.
alequetzalli marked this conversation as resolved.
Show resolved Hide resolved

Here is an example of how to extend the AsyncAPI document with custom property:
alequetzalli marked this conversation as resolved.
Show resolved Hide resolved

```yml
asyncapi: 3.0.0
info:
title: Cool Example
version: 0.1.0
x-linkedin: '/company/asyncapi'
```

In the above document, you can see an `info` object extended with custom information about LinkedIn account of company owning the application. Custom information is represented by custom property called `x-linkedin`.
alequetzalli marked this conversation as resolved.
Show resolved Hide resolved

<Remember>
All available tooling might not support AsyncAPI extensions. The tooling can be extended to understand and handle the added data, especially if the tools are internal or open source.
alequetzalli marked this conversation as resolved.
Show resolved Hide resolved
</Remember>

## Extending unsupported features

When facing a case where the AsyncAPI specification does not support the required feature, that functionality can be extended using these extensions. If the extended part also benefits other developers, you could contribute to the AsyncAPI specification. This contribution can be made by [creating an issue](https://github.com/asyncapi/spec) on the AsyncAPI GitHub repository. Please get familiar with [contribution guide](https://github.com/asyncapi/spec/blob/master/CONTRIBUTING.md) before making an contribution.
alequetzalli marked this conversation as resolved.
Show resolved Hide resolved