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

W:14931280: add complete asyncApi for 2.1 and 2.2 fixing syntax #1957

Merged
merged 1 commit into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
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