Skip to content

Commit

Permalink
Merge pull request #1957 from aml-org/W-14931280
Browse files Browse the repository at this point in the history
W:14931280: add complete asyncApi for 2.1 and 2.2 fixing syntax
  • Loading branch information
damianpedra authored Apr 4, 2024
2 parents ac29106 + 2e2fa01 commit c5d161d
Show file tree
Hide file tree
Showing 5 changed files with 221 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ object Async21VersionFactory {
def apply()(implicit ctx: AsyncWebApiContext): Async21VersionFactory = new Async21VersionFactory()(ctx)
}

class Async22VersionFactory()(implicit ctx: AsyncWebApiContext) extends Async20VersionFactory {
class Async22VersionFactory()(implicit ctx: AsyncWebApiContext) extends Async21VersionFactory {
override def endPointParser(entry: YMapEntry, parentId: String, collector: List[EndPoint]): OasLikeEndpointParser =
new Async22EndpointParser(entry, parentId, collector)(ctx)
}
Expand All @@ -79,7 +79,7 @@ object Async22VersionFactory {
def apply()(implicit ctx: AsyncWebApiContext): Async22VersionFactory = new Async22VersionFactory()(ctx)
}

class Async23VersionFactory()(implicit ctx: AsyncWebApiContext) extends Async21VersionFactory {
class Async23VersionFactory()(implicit ctx: AsyncWebApiContext) extends Async22VersionFactory {
override def endPointParser(entry: YMapEntry, parentId: String, collector: List[EndPoint]): OasLikeEndpointParser =
new Async23EndpointParser(entry, parentId, collector)(ctx)
override def serversParser(map: YMap, api: AsyncApi): AsyncServersParser = new Async23ServersParser(map, api)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ object Async21Syntax extends SpecSyntax {
"objectName",
"durablePermitted",
"lastMsgRetained"
),
"message examples" -> Set(
"name",
"summary"
)
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
asyncapi: 2.1.0
info:
title: Market Data API
version: 1.0.0
description: This API provides real-time market data updates.
servers:
theName:
url: some.com
protocol: ibmmq
bindings:
ibmmq:
groupId: test
ccdtQueueManagerName: test
cipherSpec: test
multiEndpointServer: true
heartBeatInterval: 123
channels:
user/sarasa:
subscribe:
summary: Subscribe to market updates
message:
name: errorMessage
summary: Message with market data information.
description: |
test
payload:
type: object
properties:
prop1:
type: string
examples:
-
name: error
summary: example
headers:
exampleHeader: InlineHeader
payload:
userId: user345
status: offline
some-channel:
bindings:
ibmmq:
destinationType: test
queue:
objectName: test
isPartitioned: true
exclusive: false
topic:
string: test
objectName: test
durablePermitted: true
lastMsgRetained: false
maxMsgLength: 123
bindingVersion: test
description: some channel
publish:
bindings:
ibmmq: {}
message:
bindings:
ibmmq:
type: test
description: test
expiry: 123
bindingVersion: test
headers: test1, test2, test3
payload:
type: string
components:
messages:
marketData:
name: messageName
summary: Message with market data information.
description: |
test
payload:
$ref: "#/components/schemas/market"
examples:
-
name: updatemessage
summary: explain
payload:
userId: user123
status: online
headers:
exampleHeader: HeaderValue
schemas:
market:
type: object
properties:
type:
type: string
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
asyncapi: 2.2.0
info:
title: Market Data API
version: 1.0.0
description: This API provides real-time market data updates.
servers:
theName:
url: some.com
protocol: ibmmq
bindings:
ibmmq:
groupId: test
ccdtQueueManagerName: test
cipherSpec: test
multiEndpointServer: true
heartBeatInterval: 123
channels:
user/sarasa:
subscribe:
summary: Subscribe to market updates
message:
name: errorMessage
summary: Message with market data information.
description: |
test
payload:
type: object
properties:
prop1:
type: string
examples:
-
name: error
summary: example
headers:
exampleHeader: InlineHeader
payload:
userId: user345
status: offline
some-channel:
bindings:
ibmmq:
destinationType: test
queue:
objectName: test
isPartitioned: true
exclusive: false
topic:
string: test
objectName: test
durablePermitted: true
lastMsgRetained: false
maxMsgLength: 123
bindingVersion: test
description: some channel
publish:
bindings:
ibmmq: {}
message:
bindings:
ibmmq:
type: test
description: test
expiry: 123
bindingVersion: test
headers: test1, test2, test3
payload:
type: string
another-channel:
bindings:
anypointmq:
destination: test
destinationType: test
bindingVersion: 0.1.0
description: some channel
publish:
bindings:
anypointmq: {}
message:
bindings:
anypointmq:
headers:
type: object
properties:
messageId:
type: string
bindingVersion: 0.1.0
payload:
type: string
components:
messages:
marketData:
name: messageName
summary: Message with market data information.
description: |
test
payload:
$ref: "#/components/schemas/market"
examples:
-
name: updatemessage
summary: explain
payload:
userId: user123
status: online
headers:
exampleHeader: HeaderValue
schemas:
market:
type: object
properties:
type:
type: string
10 changes: 10 additions & 0 deletions amf-cli/shared/src/test/scala/amf/emit/Async20CycleTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,16 @@ class Async20CycleTest extends FunSuiteCycleTests {
"async 2.4+ implicit security field in operation bindings",
"operation-security-implicit.yaml",
"operation-security-implicit.yaml"
),
FixtureData(
"Async 2.1 all",
"asyncApi-2.1-all.yaml",
"asyncApi-2.1-all.yaml"
),
FixtureData(
"Async 2.2 all",
"asyncApi-2.2-all.yaml",
"asyncApi-2.2-all.yaml"
)

// TODO: figure out why this test is commented out
Expand Down

0 comments on commit c5d161d

Please sign in to comment.