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

fix: client security scheme now works with spec v3 #588

Merged
merged 10 commits into from
Dec 13, 2023
159 changes: 107 additions & 52 deletions examples/anime-http/client/asyncapi.yaml
Original file line number Diff line number Diff line change
@@ -1,82 +1,137 @@
asyncapi: 2.4.0
asyncapi: 3.0.0
info:
title: AsyncAPI IMDB client
version: 1.0.0
description: This app creates a client that subscribes to the server for getting the top 10 trending/upcoming anime.
description: >-
This app creates a client that subscribes to the server for getting the top
10 trending/upcoming anime.
servers:
trendingAnime:
url: http://localhost:8081
host: 'localhost:8081'
protocol: http
security:
- token: []
- userPass: []
- apiKey: []
- UserOrPassKey: []
- oauth:
- write:pets
- read:pets
- $ref: '#/components/securitySchemes/token'
- $ref: '#/components/securitySchemes/userPass'
- $ref: '#/components/securitySchemes/apiKey'
- $ref: '#/components/securitySchemes/UserOrPassKey'
- type: oauth2
flows:
implicit:
authorizationUrl: 'https://example.com/api/oauth/dialog'
availableScopes:
'write:pets': modify pets in your account
'read:pets': read your pets
authorizationCode:
authorizationUrl: 'https://example.com/api/oauth/dialog'
tokenUrl: 'https://example.com/api/oauth/dialog'
availableScopes:
'delete:pets': modify pets in your account
'update:pets': read your pets
scopes:
- 'write:pets'
- 'read:pets'
testwebhook:
url: ws://localhost:9000
host: 'localhost:9000'
protocol: ws
x-remoteServers:
- trendingAnime
channels:
/test:
test:
address: '/test'
bindings:
ws:
bindingVersion: 0.1.0
publish:
operationId: index
message:
$ref: '#/components/messages/test'
messages:
testMessage:
$ref: '#/components/messages/testMessage'
servers:
- $ref: '#/servers/testwebhook'
trendingAnime:
address: '/trendingAnime'
bindings:
http:
type: request
method: POST
bindingVersion: 0.1.0
servers:
- trendingAnime
publish:
operationId: trendingAnimeListRecieverController
message:
$ref: "../server/asyncapi.yaml#/components/messages/trendingAnime"
subscribe:
message:
payload:
type: object
- $ref: '#/servers/trendingAnime'
messages:
trendingAnimeMessage:
$ref: '#/components/messages/trendingAnimeMessage'
operations:
index:
action: receive
channel:
$ref: '#/channels/test'
messages:
- $ref: '#/components/messages/testMessage'
trendingAnimeListRecieverController:
action: send
channel:
$ref: '#/channels/trendingAnime'
messages:
- $ref: '#/components/messages/trendingAnimeMessage'
reply:
channel:
$ref: '#/channels/trendingAnime'
messages:
- $ref: '#/components/messages/trendingAnimeReply'
components:
messages:
test:
testMessage:
summary: ping client
payload:
type: object
trendingAnimeMessage:
summary: Data required to populate trending anime
payload:
type: object
required:
- name
- rating
- genre
- studio
properties:
name:
type: string
description: Name of the anime.
rating:
type: string
description: Rating of the show.
genre:
type: string
description: The genre of anime.
studio:
type: string
description: The studio of anime.
trendingAnimeReply:
payload:
type: object
securitySchemes:
token:
type: http
scheme: bearer
bearerFormat: JWT
userPass:
type: userPassword
apiKey:
type: httpApiKey
name: api_key
in: query
UserOrPassKey:
type: apiKey
in: user
oauth:
token:
type: http
scheme: bearer
bearerFormat: JWT
userPass:
type: userPassword
apiKey:
type: httpApiKey
name: api_key
in: query
UserOrPassKey:
type: apiKey
in: user
oauth:
type: oauth2
flows:
implicit:
authorizationUrl: https://example.com/api/oauth/dialog
scopes:
write:pets: modify pets in your account
read:pets: read your pets
authorizationUrl: 'https://example.com/api/oauth/dialog'
availableScopes:
'write:pets': modify pets in your account
'read:pets': read your pets
authorizationCode:
authorizationUrl: https://example.com/api/oauth/dialog
tokenUrl: https://example.com/api/oauth/dialog
scopes:
delete:pets: modify pets in your account
update:pets: read your pets

authorizationUrl: 'https://example.com/api/oauth/dialog'
tokenUrl: 'https://example.com/api/oauth/dialog'
availableScopes:
'delete:pets': modify pets in your account
'update:pets': read your pets
x-remoteServers:
- trendingAnime
108 changes: 5 additions & 103 deletions examples/anime-http/client/docs/asyncapi.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,12 @@ This app creates a client that subscribes to the server for getting the top 10 t
* [Servers](#servers)
* [trendingAnime](#trendinganime-server)
* [testwebhook](#testwebhook-server)
* [Operations](#operations)
* [PUB /test](#pub-test-operation)
* [PUB trendingAnime](#pub-trendinganime-operation)
* [SUB trendingAnime](#sub-trendinganime-operation)

## Servers

### `trendingAnime` Server

* URL: `http://localhost:8081`
* URL: `http://localhost:8081/`
* Protocol: `http`


Expand Down Expand Up @@ -63,8 +59,10 @@ This app creates a client that subscribes to the server for getting the top 10 t

| Flow | Auth URL | Token URL | Refresh URL | Scopes |
|---|---|---|---|---|
| Implicit | [https://example.com/api/oauth/dialog](https://example.com/api/oauth/dialog) | - | - | `write:pets`, `read:pets` |
| Authorization Code | [https://example.com/api/oauth/dialog](https://example.com/api/oauth/dialog) | [https://example.com/api/oauth/dialog](https://example.com/api/oauth/dialog) | - | `delete:pets`, `update:pets` |
| Client credentials | - | - | - | - |
| Implicit | [https://example.com/api/oauth/dialog](https://example.com/api/oauth/dialog) | - | - | `write:pets`, `read:pets` |
| Password | - | - | - | - |



Expand All @@ -76,106 +74,10 @@ This app creates a client that subscribes to the server for getting the top 10 t

### `testwebhook` Server

* URL: `ws://localhost:9000`
* URL: `ws://localhost:9000/`
* Protocol: `ws`



## Operations

### PUB `/test` Operation

* Operation ID: `index`

#### `ws` Channel specific information

| Name | Type | Description | Value | Constraints | Notes |
|---|---|---|---|---|---|
| bindingVersion | - | - | `"0.1.0"` | - | - |

#### Message `test`

*ping client*

##### Payload

| Name | Type | Description | Value | Constraints | Notes |
|---|---|---|---|---|---|
| (root) | object | - | - | - | **additional properties are allowed** |

> Examples of payload _(generated)_

```json
{}
```



### PUB `trendingAnime` Operation

* Operation ID: `trendingAnimeListRecieverController`
* Available only on servers: [trendingAnime](#trendinganime-server)

#### `http` Channel specific information

| Name | Type | Description | Value | Constraints | Notes |
|---|---|---|---|---|---|
| type | - | - | `"request"` | - | - |
| method | - | - | `"POST"` | - | - |
| bindingVersion | - | - | `"0.1.0"` | - | - |

#### Message `<anonymous-message-2>`

*Data required to populate trending anime*

##### Payload

| Name | Type | Description | Value | Constraints | Notes |
|---|---|---|---|---|---|
| (root) | object | - | - | - | **additional properties are allowed** |
| name | string | Name of the anime. | - | - | **required** |
| rating | string | Rating of the show. | - | - | **required** |
| genre | string | The genre of anime. | - | - | **required** |
| studio | string | The studio of anime. | - | - | **required** |

> Examples of payload _(generated)_

```json
{
"name": "string",
"rating": "string",
"genre": "string",
"studio": "string"
}
```



### SUB `trendingAnime` Operation

* Available only on servers: [trendingAnime](#trendinganime-server)

#### `http` Channel specific information

| Name | Type | Description | Value | Constraints | Notes |
|---|---|---|---|---|---|
| type | - | - | `"request"` | - | - |
| method | - | - | `"POST"` | - | - |
| bindingVersion | - | - | `"0.1.0"` | - | - |

#### Message `<anonymous-message-3>`

##### Payload

| Name | Type | Description | Value | Constraints | Notes |
|---|---|---|---|---|---|
| (root) | object | - | - | - | **additional properties are allowed** |

> Examples of payload _(generated)_

```json
{}
```



Loading