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: update examples to v3 #947

Merged
merged 10 commits into from
Aug 2, 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
6 changes: 3 additions & 3 deletions examples/adeo-kafka-request-reply.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ channels:
kafka:
replicas: 3
partitions: 3
topicConfiguration
cleanup.policy: delete
retention.ms: 7 days
topicConfiguration:
cleanup.policy: delete
retention.ms: 7 days
jonaslagoni marked this conversation as resolved.
Show resolved Hide resolved
messages:
costingRequest:
$ref: "#/components/messages/costingRequestV1"
Expand Down
25 changes: 15 additions & 10 deletions examples/anyof.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
asyncapi: '2.5.0'
asyncapi: 3.0.0
info:
title: AnyOf example
version: '1.0.0'

version: 1.0.0
channels:
test:
publish:
message:
address: test
messages:
publish.message:
$ref: '#/components/messages/testMessages'

operations:
test.publish:
action: receive
channel:
$ref: '#/channels/test'
messages:
- $ref: '#/components/messages/testMessages'
components:
messages:
testMessages:
payload:
anyOf: # anyOf in payload schema
- $ref: "#/components/schemas/objectWithKey"
- $ref: "#/components/schemas/objectWithKey2"

anyOf:
- $ref: '#/components/schemas/objectWithKey'
- $ref: '#/components/schemas/objectWithKey2'
schemas:
objectWithKey:
type: object
Expand Down
54 changes: 29 additions & 25 deletions examples/application-headers.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
asyncapi: '2.5.0'
asyncapi: 3.0.0
info:
title: Application Headers example
version: '1.0.0'
description: A cut of the Streetlights API to test application header changes supporting #112
version: 1.0.0
description: A cut of the Streetlights API to test application header changes supporting
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jonaslagoni #112 is missing here, otherwise the meaning is not correct.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, it's a bug with the converter 🤔

Mind adding a bug issue?

license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0

url: 'https://www.apache.org/licenses/LICENSE-2.0'
defaultContentType: application/json
servers:
production:
url: test.mosquitto.org:{port}
host: 'test.mosquitto.org:{port}'
protocol: mqtt
description: Test broker
variables:
Expand All @@ -19,28 +19,36 @@ servers:
enum:
- '1883'
- '8883'

defaultContentType: application/json

channels:
smartylighting/streetlights/1/0/event/{streetlightId}/lighting/measured:
'smartylighting/streetlights/1/0/event/{streetlightId}/lighting/measured':
address: 'smartylighting/streetlights/1/0/event/{streetlightId}/lighting/measured'
messages:
receiveLightMeasurement.message:
$ref: '#/components/messages/lightMeasured'
parameters:
streetlightId:
$ref: '#/components/parameters/streetlightId'
publish:
summary: Inform about environmental lighting conditions of a particular streetlight.
operationId: receiveLightMeasurement
message:
$ref: '#/components/messages/lightMeasured'

operations:
receiveLightMeasurement:
action: receive
channel:
$ref: >-
#/channels/smartylighting~1streetlights~11~10~1event~1{streetlightId}~1lighting~1measured
summary: >-
Inform about environmental lighting conditions of a particular
streetlight.
messages:
- $ref: '#/components/messages/lightMeasured'
components:
messages:
lightMeasured:
name: lightMeasured
title: Light measured
summary: Inform about environmental lighting conditions of a particular streetlight.
summary: >-
Inform about environmental lighting conditions of a particular
streetlight.
correlationId:
location: "$message.header#/MQMD/CorrelId"
location: $message.header#/MQMD/CorrelId
contentType: application/json
headers:
type: object
Expand All @@ -54,10 +62,9 @@ components:
maxLength: 24
format: binary
applicationInstanceId:
$ref: "#/components/schemas/applicationInstanceId"
$ref: '#/components/schemas/applicationInstanceId'
payload:
$ref: "#/components/schemas/lightMeasuredPayload"

$ref: '#/components/schemas/lightMeasuredPayload'
schemas:
lightMeasuredPayload:
type: object
Expand All @@ -67,17 +74,14 @@ components:
minimum: 0
description: Light intensity measured in lumens.
sentAt:
$ref: "#/components/schemas/sentAt"
$ref: '#/components/schemas/sentAt'
sentAt:
type: string
format: date-time
description: Date and time when the message was sent.
applicationInstanceId:
description: Unique identifier for a given instance of the publishing application
type: string

parameters:
streetlightId:
description: The ID of the streetlight.
schema:
type: string
124 changes: 81 additions & 43 deletions examples/correlation-id.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
asyncapi: '2.5.0'
asyncapi: 3.0.0
info:
title: Correlation ID Example
version: '1.0.0'
version: 1.0.0
description: A cut of the Streetlights API to test Correlation ID
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0

url: 'https://www.apache.org/licenses/LICENSE-2.0'
defaultContentType: application/json
servers:
production:
url: test.mosquitto.org:{port}
host: 'test.mosquitto.org:{port}'
protocol: mqtt
description: Test broker
variables:
Expand All @@ -20,55 +20,97 @@ servers:
- '1883'
- '8883'
security:
- apiKey: []
- supportedOauthFlows:
- streetlights:on
- streetlights:off
- streetlights:dim
- openIdConnectWellKnown: []

defaultContentType: application/json

- $ref: '#/components/securitySchemes/apiKey'
- type: oauth2
description: Flows to support OAuth 2.0
flows:
implicit:
authorizationUrl: 'https://authserver.example/auth'
availableScopes:
'streetlights:on': Ability to switch lights on
'streetlights:off': Ability to switch lights off
'streetlights:dim': Ability to dim the lights
password:
tokenUrl: 'https://authserver.example/token'
availableScopes:
'streetlights:on': Ability to switch lights on
'streetlights:off': Ability to switch lights off
'streetlights:dim': Ability to dim the lights
clientCredentials:
tokenUrl: 'https://authserver.example/token'
availableScopes:
'streetlights:on': Ability to switch lights on
'streetlights:off': Ability to switch lights off
'streetlights:dim': Ability to dim the lights
authorizationCode:
authorizationUrl: 'https://authserver.example/auth'
tokenUrl: 'https://authserver.example/token'
refreshUrl: 'https://authserver.example/refresh'
availableScopes:
'streetlights:on': Ability to switch lights on
'streetlights:off': Ability to switch lights off
'streetlights:dim': Ability to dim the lights
scopes:
- 'streetlights:on'
- 'streetlights:off'
- 'streetlights:dim'
- $ref: '#/components/securitySchemes/openIdConnectWellKnown'
channels:
smartylighting/streetlights/1/0/event/{streetlightId}/lighting/measured:
'smartylighting/streetlights/1/0/event/{streetlightId}/lighting/measured':
address: 'smartylighting/streetlights/1/0/event/{streetlightId}/lighting/measured'
messages:
receiveLightMeasurement.message:
$ref: '#/components/messages/lightMeasured'
parameters:
streetlightId:
$ref: '#/components/parameters/streetlightId'
publish:
summary: Inform about environmental lighting conditions of a particular streetlight.
operationId: receiveLightMeasurement
message:
$ref: '#/components/messages/lightMeasured'

smartylighting/streetlights/1/0/action/{streetlightId}/dim:
'smartylighting/streetlights/1/0/action/{streetlightId}/dim':
address: 'smartylighting/streetlights/1/0/action/{streetlightId}/dim'
messages:
dimLight.message:
$ref: '#/components/messages/dimLight'
parameters:
streetlightId:
$ref: '#/components/parameters/streetlightId'
subscribe:
operationId: dimLight
message:
$ref: '#/components/messages/dimLight'

operations:
receiveLightMeasurement:
action: receive
channel:
$ref: >-
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't knew this notion >- is it to allow multi-lines in that case why not having #/channels/smartylighting~1streetlights~11~10~1event~1{streetlightId}~1lighting~1measured in the same line.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's part of the converter logic somewhere 🤔

Might be because the string is too long 🧐

#/channels/smartylighting~1streetlights~11~10~1event~1{streetlightId}~1lighting~1measured
summary: >-
Inform about environmental lighting conditions of a particular
streetlight.
messages:
- $ref: '#/components/messages/lightMeasured'
dimLight:
action: send
channel:
$ref: >-
#/channels/smartylighting~1streetlights~11~10~1action~1{streetlightId}~1dim
messages:
- $ref: '#/components/messages/dimLight'
components:
messages:
lightMeasured:
name: lightMeasured
title: Light measured
summary: Inform about environmental lighting conditions of a particular streetlight.
summary: >-
Inform about environmental lighting conditions of a particular
streetlight.
correlationId:
location: "$message.header#/MQMD/CorrelId"
location: $message.header#/MQMD/CorrelId
contentType: application/json
payload:
$ref: "#/components/schemas/lightMeasuredPayload"
$ref: '#/components/schemas/lightMeasuredPayload'
dimLight:
name: dimLight
title: Dim light
summary: Command a particular streetlight to dim the lights.
correlationId:
$ref: "#/components/correlationIds/sentAtCorrelator"
$ref: '#/components/correlationIds/sentAtCorrelator'
payload:
$ref: "#/components/schemas/dimLightPayload"

$ref: '#/components/schemas/dimLightPayload'
schemas:
lightMeasuredPayload:
type: object
Expand All @@ -78,7 +120,7 @@ components:
minimum: 0
description: Light intensity measured in lumens.
sentAt:
$ref: "#/components/schemas/sentAt"
$ref: '#/components/schemas/sentAt'
dimLightPayload:
type: object
properties:
Expand All @@ -88,18 +130,14 @@ components:
minimum: 0
maximum: 100
sentAt:
$ref: "#/components/schemas/sentAt"
$ref: '#/components/schemas/sentAt'
sentAt:
type: string
format: date-time
description: Date and time when the message was sent.

parameters:
streetlightId:
description: The ID of the streetlight.
schema:
type: string

correlationIds:
sentAtCorrelator:
description: Data from message payload used as correlation ID
Expand All @@ -115,27 +153,27 @@ components:
flows:
implicit:
authorizationUrl: 'https://authserver.example/auth'
scopes:
availableScopes:
'streetlights:on': Ability to switch lights on
'streetlights:off': Ability to switch lights off
'streetlights:dim': Ability to dim the lights
password:
tokenUrl: 'https://authserver.example/token'
scopes:
availableScopes:
'streetlights:on': Ability to switch lights on
'streetlights:off': Ability to switch lights off
'streetlights:dim': Ability to dim the lights
clientCredentials:
tokenUrl: 'https://authserver.example/token'
scopes:
availableScopes:
'streetlights:on': Ability to switch lights on
'streetlights:off': Ability to switch lights off
'streetlights:dim': Ability to dim the lights
authorizationCode:
authorizationUrl: 'https://authserver.example/auth'
tokenUrl: 'https://authserver.example/token'
refreshUrl: 'https://authserver.example/refresh'
scopes:
availableScopes:
'streetlights:on': Ability to switch lights on
'streetlights:off': Ability to switch lights off
'streetlights:dim': Ability to dim the lights
Expand Down
Loading