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

chore: clean up the repository #121

Merged
merged 22 commits into from
Jul 18, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
127 changes: 10 additions & 117 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Extensions catalog

This is a placeholder for definitions of AsyncAPI specification extensions and bindings objects.
This is a repository for definitions of AsyncAPI specification extensions.

#### Index:
#### Table of Contents

<!-- TOC depthFrom:2 depthTo:2 -->

- [What's an extension?](#whats-an-extension)
- [Examples of extension definition](#examples-of-extension-definition)
- [Types of extensions](#types-of-extensions)
- [Usage in an AsyncAPI document](#usage-in-an-AsyncAPI-document)
- [List of extensions](#list-of-extensions)
derberg marked this conversation as resolved.
Show resolved Hide resolved
- [Adding your extension to the catalog](#adding-your-extension-to-the-catalog)
- [Questions?](#questions)

Expand All @@ -18,128 +18,21 @@ This is a placeholder for definitions of AsyncAPI specification extensions and b

Extensions are the mechanism AsyncAPI has to allow you use custom or protocol-specific features. Extensions follow a separate release cycle and everyone can create their own. This repository is meant to contain a list of official and community supported extensions.

## Examples of extension definition

> Both, JSON or YAML, are supported formats. Please, take into account that only the subset of YAML that can be translated to JSON is allowed.

### Twitter

This is the definition of a generic extension that allows you to add information about your team/company Twitter account.

```yaml
id: twitter
type: generic # Means it's an "x-" type of extension. In this case, x-twitter.
title: Twitter information
description: This extension allows you to place the Twitter account of the team/company in charge of the API.
version: '0.1.0'
author: Mike Ralphson
contributors:
- Fran Mendez <fmvilas@gmail.com> (fmvilas.com)
definitions:
- hooks:
- 'info' # JMESPath query to indicate where this extension is allowed in the AsyncAPI document. In this case, it's only allowed in the "info" object.
schema:
type: string
pattern: '^@?(\\w){1,15}$'
examples:
- example: '@PermittedSoc'
```

#### Usage in an AsyncAPI document
AsyncAPI extensions are those that are preceded by `x-`, e.g., `x-twitter`. They can be placed in the AsyncAPI document in locations specified by documentation of given extension.

```yaml
asyncapi: '2.0.0'
info:
title: My wonderful API
version: '12.4.2'
x-twitter: '@wonderapi'
...
```

### HTTP Binding

This is the example definition of an HTTP bindings extension.

```yaml
id: http
type: bindings # Means it's a "bindings" type of extension.
title: HTTP Binding Extension
description: This object allows you to define HTTP-specific details in AsyncAPI.
version: '0.1.0'
author: Fran Mendez <fmvilas@gmail.com> (fmvilas.com)
definitions:
- hooks: # JMESPath queries to indicate where this extension is allowed in the AsyncAPI document. In this case, it's allowed in all the operation (publish/subscribe) objects.
- 'channels.*.subscribe'
- 'channels.*.publish'
schema: # This is the schema that validates the extension content. It's in JSON Schema Draft 07.
type: object
required:
- version
properties:
version:
type: string
const: '0.1.0' # It's a good idea to specify what version of the extension are you using. It will facilitate things to tooling and will allow you to have different versions of the same extension in a single document.
response:
type: object
additionalProperties: false
properties:
headers:
type: object
additionalProperties: true
propertyNames:
type: string
pattern: '^[a-zA-Z0-9\\.\\-_]+$'
request:
type: object
additionalProperties: false
properties:
headers:
type: object
additionalProperties: true
propertyNames:
type: string
pattern: '^[a-zA-Z0-9\\.\\-_]+$'
examples:
- description: Usage for HTTP streaming APIs.
example:
http:
version: '0.1.0'
response:
headers:
Transfer-Encoding: chunked
Trailer: '\\r\\n'
```

#### Usage in an AsyncAPI document

```yaml
asyncapi: '2.0.0'
...
channels:
/tweets:
subscribe:
bindings:
http:
version: '0.1.0'
response:
headers:
Transfer-Encoding: chunked
Trailer: '\\r\\n'
...
```

## Types of extensions

Extensions can be of type `generic` or `bindings`.

Generic extensions are those that are preceeded by `x-`, e.g., `x-twitter`, and they can be placed anywhere in the AsyncAPI document.

Bindings extensions are those that live inside a `bindings` object and are related to protocol-specific functionality or characteristics. E.g., `http`, `kafka`, `amqp`, etc. As opposed to generic extensions, these can only be applied in a very limited set of places, namely, where the `bindings` is allowed, i.e., a channel object, an operation object or a message object.
## List of Extensions
- [Twitter Extension](./extensions/twitter/)
derberg marked this conversation as resolved.
Show resolved Hide resolved

## Adding your extension to the catalog

If you'd like to add your extension to the catalog, please submit a pull request to this repository. Make sure the extension doesn't exist already, in which case it would be better to improve the existing one so everybody benefits from it.



## Questions?

If you have questions, please submit an issue to this repository or [join our Slack workspace](https://join.slack.com/t/asyncapi/shared_invite/enQtNDY3MzI0NjU5OTQyLWU4ZGU2MTg1MDIyZDFjMTI2YjkxYTdlMzc1NjgzYTAxZDM1YTg1NDhhMTE2NDliMjlhZjYxNzk0ZTE5ZGU1ZTg).
If you have questions, please submit an issue to this repository or [join our Slack workspace](https://asyncapi.com/slack-invite).
1 change: 0 additions & 1 deletion _config.yml

This file was deleted.

47 changes: 0 additions & 47 deletions extensions/http/0.1.0.yaml

This file was deleted.

117 changes: 0 additions & 117 deletions extensions/sqs/0.1.0.yml

This file was deleted.

16 changes: 0 additions & 16 deletions extensions/twitter/0.1.0.yaml

This file was deleted.

36 changes: 36 additions & 0 deletions extensions/twitter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Twitter extension
This document defines how to use `twitter` extension in AsyncAPI documents.

## Twitter Object
sambhavgupta0705 marked this conversation as resolved.
Show resolved Hide resolved
The `twitter` object must contain:

Field Name | Type | Description
---|:---:|---
<a name="extensionId"></a>`id` | string | **Required**. Id of the extension.
<a name="extensionTitle"></a>`title` | string |**Required**. The title of the extension.
<a name="extensionDescription"></a>`description` |string| The description of the Twitter extension.
<a name="extensionPayload"></a>`payload` | Json Object |**Required**. A JSON object containing the detail of the Twitter account.



<a name="payloadObject"></a>
## Payload Object
Field Name | Type | Description
---|:---:|---
<a name="extensionSchema"></a>`schema` | Schema Object |**Required**. A Schama object containing the detail of the twitter account. | **Required** The schema of the twitter account. We provide the pattern and the thpe of the payload.
<a name="extensionExamples"></a>`examples` | string |**Required**. An array of examples.


## Example

```yaml
id: twitter
title: Twitter information
description: This extension allows you to place the Twitter account of the team/company in charge of the API.
payload:
schema:
type: string
pattern: '^@?(\\w){1,15}$'
examples:
- example: '@PermittedSoc'
```
Loading