From 3059384c5e61c6242f6444b98ca7e5d1e7fea620 Mon Sep 17 00:00:00 2001 From: Animesh Kumar Date: Fri, 21 Jun 2024 15:20:54 +0530 Subject: [PATCH 1/5] fix: add missing parameter and values in example Changes: - modify examples in Operation Object --- spec/asyncapi.md | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/spec/asyncapi.md b/spec/asyncapi.md index dc5877f7..652229a7 100644 --- a/spec/asyncapi.md +++ b/spec/asyncapi.md @@ -861,6 +861,19 @@ This object MAY be extended with [Specification Extensions](#specificationExtens "action": "send", "security": [ { + "type": "oauth2", + "description": "The oauth security descriptions", + "flows": { + "clientCredentials": { + "tokenUrl": "https://example.com/api/oauth/dialog", + "availableScopes": { + "subscribe:auth_revocations": "Scope required for authorization revocation topic" + } + } + }, + "scopes": [ + "subscribe:auth_revocations" + ], "petstore_auth": [ "write:pets", "read:pets" @@ -891,7 +904,7 @@ This object MAY be extended with [Specification Extensions](#specificationExtens "$ref": "#/channels/userSignupReply" }, "messages": [ - { "$ref": "/components/messages/userSignedUpReply" } + { "$ref": "#/channels/userSignupReply/messages/userSignedUpReply" } ] } } @@ -906,9 +919,18 @@ channel: $ref: '#/channels/userSignup' action: send security: - - petstore_auth: - - write:pets - - read:pets + - type: oauth2 + description: The oauth security descriptions + flows: + clientCredentials: + tokenUrl: 'https://example.com/api/oauth/dialog' + availableScopes: + 'subscribe:auth_revocations': Scope required for authorization revocation topic + scopes: + - 'subscribe:auth_revocations' + petstore_auth: + - 'write:pets' + - 'read:pets' tags: - name: user - name: signup @@ -917,16 +939,16 @@ bindings: amqp: ack: false traits: - - $ref: "#/components/operationTraits/kafka" + - $ref: '#/components/operationTraits/kafka' messages: - - $ref: '#/components/messages/userSignedUp' + - $ref: /components/messages/userSignedUp reply: address: location: '$message.header#/replyTo' channel: $ref: '#/channels/userSignupReply' messages: - - $ref: '#/components/messages/userSignedUpReply' + - $ref: '#/channels/userSignupReply/messages/userSignedUpReply' ``` #### Operation Trait Object From 4ef63f7fe90fb3123babea4dcc73cf39c0fa8bd1 Mon Sep 17 00:00:00 2001 From: Animesh Kumar Date: Fri, 21 Jun 2024 16:01:19 +0530 Subject: [PATCH 2/5] fix: replace references to correct position --- spec/asyncapi.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/asyncapi.md b/spec/asyncapi.md index 652229a7..eeb2665d 100644 --- a/spec/asyncapi.md +++ b/spec/asyncapi.md @@ -894,7 +894,7 @@ This object MAY be extended with [Specification Extensions](#specificationExtens { "$ref": "#/components/operationTraits/kafka" } ], "messages": [ - { "$ref": "/components/messages/userSignedUp" } + { "$ref": "#/channels/userSignup/messages/userSignedUp" } ], "reply": { "address": { @@ -941,7 +941,7 @@ bindings: traits: - $ref: '#/components/operationTraits/kafka' messages: - - $ref: /components/messages/userSignedUp + - $ref: '#/channels/userSignup/messages/userSignedUp' reply: address: location: '$message.header#/replyTo' From 54fab4bd1f172a81e43ecd6a2058a4160f1f4e06 Mon Sep 17 00:00:00 2001 From: Animesh Kumar Date: Wed, 26 Jun 2024 21:44:35 +0530 Subject: [PATCH 3/5] fix: potential example fixes, convert to URI --- spec/asyncapi.md | 185 ++++++++++++++++++++++++----------------------- 1 file changed, 93 insertions(+), 92 deletions(-) diff --git a/spec/asyncapi.md b/spec/asyncapi.md index eeb2665d..df2a349b 100644 --- a/spec/asyncapi.md +++ b/spec/asyncapi.md @@ -273,7 +273,7 @@ This object MAY be extended with [Specification Extensions](#specificationExtens ##### Info Object Example - + ```json { "title": "AsyncAPI Sample App", @@ -301,7 +301,7 @@ This object MAY be extended with [Specification Extensions](#specificationExtens } ``` - + ```yaml title: AsyncAPI Sample App version: 1.0.1 @@ -335,7 +335,7 @@ Field Name | Type | Description This object MAY be extended with [Specification Extensions](#specificationExtensions). - + ```json { "name": "API Support", @@ -344,7 +344,7 @@ This object MAY be extended with [Specification Extensions](#specificationExtens } ``` - + ```yaml name: API Support url: https://www.example.com/support @@ -366,7 +366,7 @@ This object MAY be extended with [Specification Extensions](#specificationExtens ##### License Object Example - + ```json { "name": "Apache 2.0", @@ -374,7 +374,7 @@ This object MAY be extended with [Specification Extensions](#specificationExtens } ``` - + ```yaml name: Apache 2.0 url: https://www.apache.org/licenses/LICENSE-2.0.html @@ -392,7 +392,7 @@ Field Pattern | Type | Description ##### Servers Object Example - + ```json { "development": { @@ -434,7 +434,7 @@ Field Pattern | Type | Description } ``` - + ```yaml development: host: localhost:5672 @@ -487,7 +487,7 @@ Field Name | Type | Description A single server would be described as: - + ```json { "host": "kafka.in.mycompany.com:9092", @@ -497,7 +497,7 @@ A single server would be described as: } ``` - + ```yaml host: kafka.in.mycompany.com:9092 description: Production Kafka broker. @@ -507,7 +507,7 @@ protocolVersion: '3.2' An example of a server that has a `pathname`: - + ```json { "host": "rabbitmq.in.mycompany.com:5672", @@ -517,7 +517,7 @@ An example of a server that has a `pathname`: } ``` - + ```yaml host: rabbitmq.in.mycompany.com:5672 pathname: /production @@ -542,7 +542,7 @@ This object MAY be extended with [Specification Extensions](#specificationExtens ##### Server Variable Object Example - + ```json { "host": "rabbitmq.in.mycompany.com:5672", @@ -561,7 +561,7 @@ This object MAY be extended with [Specification Extensions](#specificationExtens } ``` - + ```yaml host: 'rabbitmq.in.mycompany.com:5672' pathname: '/{env}' @@ -583,14 +583,14 @@ In case a message can't be encoded/decoded using this value, schema parsers MUST ##### Default Content Type Example - + ```json { "defaultContentType": "application/json" } ``` - + ```yaml defaultContentType: application/json ``` @@ -607,7 +607,7 @@ Field Pattern | Type | Description ##### Channels Object Example - + ```json { "userSignedUp": { @@ -621,7 +621,7 @@ Field Pattern | Type | Description } ``` - + ```yaml userSignedUp: address: 'user.signedup' @@ -653,7 +653,7 @@ This object MAY be extended with [Specification Extensions](#specificationExtens ##### Channel Object Example - + ```json { "address": "users.{userId}", @@ -695,7 +695,7 @@ This object MAY be extended with [Specification Extensions](#specificationExtens } ``` - + ```yaml address: 'users.{userId}' title: Users channel @@ -742,7 +742,7 @@ Field Pattern | Type | Description ##### Messages Object Example - + ```json { "userSignedUp": { @@ -754,7 +754,7 @@ Field Pattern | Type | Description } ``` - + ```yaml userSignedUp: $ref: '#/components/messages/userSignedUp' @@ -776,7 +776,7 @@ Field Pattern | Type | Description ##### Operations Object Example - + ```json { "onUserSignUp": { @@ -804,7 +804,7 @@ Field Pattern | Type | Description } ``` - + ```yaml onUserSignUp: title: User sign up @@ -849,7 +849,7 @@ This object MAY be extended with [Specification Extensions](#specificationExtens ##### Operation Object Example - + ```json { "title": "User sign up", @@ -910,7 +910,7 @@ This object MAY be extended with [Specification Extensions](#specificationExtens } ``` - + ```yaml title: User sign up summary: Action to sign a user up. @@ -973,7 +973,7 @@ This object MAY be extended with [Specification Extensions](#specificationExtens ##### Operation Trait Object Example - + ```json { "bindings": { @@ -984,7 +984,7 @@ This object MAY be extended with [Specification Extensions](#specificationExtens } ``` - + ```yaml bindings: amqp: @@ -1022,7 +1022,7 @@ This object MAY be extended with [Specification Extensions](#specificationExtens ##### Examples - + ```json { "description": "Consumer inbox", @@ -1030,7 +1030,7 @@ This object MAY be extended with [Specification Extensions](#specificationExtens } ``` - + ```yaml description: Consumer Inbox location: $message.header#/replyTo @@ -1050,7 +1050,7 @@ Field Pattern | Type | Description ##### Parameters Object Example - + ```json { "address": "user/{userId}/signedup", @@ -1062,7 +1062,7 @@ Field Pattern | Type | Description } ``` - + ```yaml address: user/{userId}/signedup parameters: @@ -1088,7 +1088,7 @@ This object MAY be extended with [Specification Extensions](#specificationExtens ##### Parameter Object Example - + ```json { "address": "user/{userId}/signedup", @@ -1101,7 +1101,7 @@ This object MAY be extended with [Specification Extensions](#specificationExtens } ``` - + ```yaml address: user/{userId}/signedup parameters: @@ -1256,7 +1256,7 @@ This object MAY be extended with [Specification Extensions](#specificationExtens ##### Message Object Example - + ```json { "name": "UserSignup", @@ -1321,7 +1321,7 @@ This object MAY be extended with [Specification Extensions](#specificationExtens } ``` - + ```yaml name: UserSignup title: User signup @@ -1368,7 +1368,7 @@ examples: Example using Avro to define the payload: - + ```json { "name": "UserSignup", @@ -1389,7 +1389,7 @@ Example using Avro to define the payload: } ``` - + ```yaml name: UserSignup title: User signup @@ -1431,14 +1431,14 @@ This object MAY be extended with [Specification Extensions](#specificationExtens ##### Message Trait Object Example - + ```json { "contentType": "application/json" } ``` - + ```yaml contentType: application/json ``` @@ -1460,7 +1460,7 @@ This object MAY be extended with [Specification Extensions](#specificationExtens ##### Message Example Object Example - + ```json { "name": "SimpleSignup", @@ -1480,7 +1480,7 @@ This object MAY be extended with [Specification Extensions](#specificationExtens } ``` - + ```yaml name: SimpleSignup summary: A simple UserSignup example message @@ -1514,7 +1514,7 @@ This object MAY be extended with [Specification Extensions](#specificationExtens ##### Tag Object Example - + ```json { "name": "user", @@ -1522,7 +1522,7 @@ This object MAY be extended with [Specification Extensions](#specificationExtens } ``` - + ```yaml name: user description: User-related messages @@ -1543,7 +1543,7 @@ This object MAY be extended with [Specification Extensions](#specificationExtens ##### External Documentation Object Example - + ```json { "description": "Find more info here", @@ -1551,7 +1551,7 @@ This object MAY be extended with [Specification Extensions](#specificationExtens } ``` - + ```yaml description: Find more info here url: https://example.com @@ -1575,14 +1575,14 @@ This object cannot be extended with additional properties and any properties add ##### Reference Object Example - + ```json { "$ref": "#/components/schemas/Pet" } ``` - + ```yaml $ref: '#/components/schemas/Pet' ``` @@ -1632,7 +1632,7 @@ my.org.User ##### Components Object Example - + ```json { "components": { @@ -1766,7 +1766,7 @@ my.org.User } ``` - + ```yaml components: schemas: @@ -1888,7 +1888,7 @@ Name | Allowed values | Notes ###### Multi Format Schema Object Example with Avro - + ```yaml channels: example: @@ -1994,7 +1994,7 @@ As such, inline schema definitions, which do not have a given id, _cannot_ be us ###### Primitive Sample - + ```json { "type": "string", @@ -2002,7 +2002,7 @@ As such, inline schema definitions, which do not have a given id, _cannot_ be us } ``` - + ```yaml type: string format: email @@ -2010,7 +2010,7 @@ format: email ###### Simple Model - + ```json { "type": "object", @@ -2033,7 +2033,7 @@ format: email } ``` - + ```yaml type: object required: @@ -2053,7 +2053,7 @@ properties: For a simple string to string mapping: - + ```json { "type": "object", @@ -2063,7 +2063,7 @@ For a simple string to string mapping: } ``` - + ```yaml type: object additionalProperties: @@ -2072,7 +2072,7 @@ additionalProperties: For a string to model mapping: - + ```json { "type": "object", @@ -2082,7 +2082,7 @@ For a string to model mapping: } ``` - + ```yaml type: object additionalProperties: @@ -2091,7 +2091,7 @@ additionalProperties: ###### Model with Example - + ```json { "type": "object", @@ -2116,7 +2116,7 @@ additionalProperties: } ``` - + ```yaml type: object properties: @@ -2134,7 +2134,7 @@ examples: ###### Model with Boolean Schemas - + ```json { "type": "object", @@ -2148,7 +2148,7 @@ examples: } ``` - + ```yaml type: object required: @@ -2160,7 +2160,7 @@ properties: ###### Models with Composition - + ```json { "schemas": { @@ -2203,7 +2203,7 @@ properties: } ``` - + ```yaml schemas: ErrorModel: @@ -2231,7 +2231,7 @@ schemas: ###### Models with Polymorphism Support - + ```json { "schemas": { @@ -2325,7 +2325,7 @@ schemas: } ``` - + ```yaml schemas: Pet: @@ -2423,21 +2423,21 @@ This object MAY be extended with [Specification Extensions](#specificationExtens ###### User/Password Authentication Sample - + ```json { "type": "userPassword" } ``` - + ```yaml type: userPassword ``` ###### API Key Authentication Sample - + ```json { "type": "apiKey", @@ -2445,7 +2445,7 @@ type: userPassword } ``` - + ```yaml type: apiKey in: user @@ -2453,35 +2453,35 @@ in: user ###### X.509 Authentication Sample - + ```json { "type": "X509" } ``` - + ```yaml type: X509 ``` ###### End-to-end Encryption Authentication Sample - + ```json { "type": "symmetricEncryption" } ``` - + ```yaml type: symmetricEncryption ``` ###### Basic Authentication Sample - + ```json { "type": "http", @@ -2489,7 +2489,7 @@ type: symmetricEncryption } ``` - + ```yaml type: http scheme: basic @@ -2497,7 +2497,7 @@ scheme: basic ###### API Key Sample - + ```json { "type": "httpApiKey", @@ -2506,7 +2506,7 @@ scheme: basic } ``` - + ```yaml type: httpApiKey name: api_key @@ -2515,7 +2515,7 @@ in: header ###### JWT Bearer Sample - + ```json { "type": "http", @@ -2524,7 +2524,7 @@ in: header } ``` - + ```yaml type: http scheme: bearer @@ -2533,7 +2533,7 @@ bearerFormat: JWT ###### Implicit OAuth2 Sample - + ```json { "type": "oauth2", @@ -2552,7 +2552,7 @@ bearerFormat: JWT } ``` - + ```yaml type: oauth2 flows: @@ -2567,14 +2567,14 @@ scopes: ###### SASL Sample - + ```json { "type": "scramSha512" } ``` - + ```yaml type: scramSha512 ``` @@ -2611,10 +2611,9 @@ This object MAY be extended with [Specification Extensions](#specificationExtens ##### OAuth Flow Object Examples - + ```json { - "authorizationUrl": "https://example.com/api/oauth/dialog", "tokenUrl": "https://example.com/api/oauth/token", "availableScopes": { "write:pets": "modify pets in your account", @@ -2622,15 +2621,17 @@ This object MAY be extended with [Specification Extensions](#specificationExtens } } ``` - - + + + ```yaml -authorizationUrl: https://example.com/api/oauth/dialog tokenUrl: https://example.com/api/oauth/token availableScopes: write:pets: modify pets in your account read:pets: read your pets ``` + + ### Correlation ID Object @@ -2649,7 +2650,7 @@ This object MAY be extended with [Specification Extensions](#specificationExtens ##### Examples - + ```json { "description": "Default Correlation ID", @@ -2657,7 +2658,7 @@ This object MAY be extended with [Specification Extensions](#specificationExtens } ``` - + ```yaml description: Default Correlation ID location: $message.header#/correlationId From 882a512d3e5eb8fe58bfc03ecdc3cce928d9055a Mon Sep 17 00:00:00 2001 From: Animesh Kumar Date: Tue, 2 Jul 2024 21:46:41 +0530 Subject: [PATCH 4/5] fix: OAuth Flow Object example fix Changes: - modify example to match the correct format of the spec - add new sub-heading to denote what kind of OAuth Flow is - applied suggestion from: https://github.com/asyncapi/spec/pull/1059#discussion_r1662021068 --- spec/asyncapi.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/asyncapi.md b/spec/asyncapi.md index df2a349b..e4c514c7 100644 --- a/spec/asyncapi.md +++ b/spec/asyncapi.md @@ -2611,6 +2611,8 @@ This object MAY be extended with [Specification Extensions](#specificationExtens ##### OAuth Flow Object Examples +###### clientCredentials Oauth Flow Object Example + ```json { @@ -2621,8 +2623,6 @@ This object MAY be extended with [Specification Extensions](#specificationExtens } } ``` - - ```yaml tokenUrl: https://example.com/api/oauth/token From b0d36e7d35c023c8a67ed298e0320067fd5409c9 Mon Sep 17 00:00:00 2001 From: Animesh Kumar Date: Tue, 2 Jul 2024 22:05:21 +0530 Subject: [PATCH 5/5] chore: remove comments --- spec/asyncapi.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/spec/asyncapi.md b/spec/asyncapi.md index e4c514c7..f4747096 100644 --- a/spec/asyncapi.md +++ b/spec/asyncapi.md @@ -2630,8 +2630,6 @@ availableScopes: write:pets: modify pets in your account read:pets: read your pets ``` - - ### Correlation ID Object