diff --git a/springwolf-examples/springwolf-amqp-example/src/test/resources/asyncapi.json b/springwolf-examples/springwolf-amqp-example/src/test/resources/asyncapi.json index 72a57381d..3c6fdb09c 100644 --- a/springwolf-examples/springwolf-amqp-example/src/test/resources/asyncapi.json +++ b/springwolf-examples/springwolf-amqp-example/src/test/resources/asyncapi.json @@ -25,6 +25,30 @@ } }, "channels": { + "#": { + "address": "#", + "messages": { + "io.github.springwolf.examples.amqp.dtos.ExamplePayloadDto": { + "$ref": "#/components/messages/io.github.springwolf.examples.amqp.dtos.ExamplePayloadDto" + }, + "io.github.springwolf.examples.amqp.dtos.GenericPayloadDto": { + "$ref": "#/components/messages/io.github.springwolf.examples.amqp.dtos.GenericPayloadDto" + } + }, + "bindings": { + "amqp": { + "is": "routingKey", + "exchange": { + "name": "CRUD-topic-exchange-1", + "type": "topic", + "durable": true, + "autoDelete": false, + "vhost": "/" + }, + "bindingVersion": "0.3.0" + } + } + }, "another-queue": { "address": "another-queue", "messages": { @@ -119,6 +143,48 @@ "bindingVersion": "0.3.0" } } + }, + "queue-create": { + "address": "queue-create", + "messages": { + "io.github.springwolf.examples.amqp.dtos.GenericPayloadDto": { + "$ref": "#/components/messages/io.github.springwolf.examples.amqp.dtos.GenericPayloadDto" + } + }, + "bindings": { + "amqp": { + "is": "queue", + "queue": { + "name": "queue-create", + "durable": true, + "exclusive": false, + "autoDelete": false, + "vhost": "/" + }, + "bindingVersion": "0.3.0" + } + } + }, + "queue-delete": { + "address": "queue-delete", + "messages": { + "io.github.springwolf.examples.amqp.dtos.GenericPayloadDto": { + "$ref": "#/components/messages/io.github.springwolf.examples.amqp.dtos.GenericPayloadDto" + } + }, + "bindings": { + "amqp": { + "is": "queue", + "queue": { + "name": "queue-delete", + "durable": true, + "exclusive": false, + "autoDelete": false, + "vhost": "/" + }, + "bindingVersion": "0.3.0" + } + } } }, "components": { @@ -216,6 +282,25 @@ "someEnum", "someString" ] + }, + "io.github.springwolf.examples.amqp.dtos.GenericPayloadDto": { + "title": "GenericPayloadDto", + "type": "object", + "properties": { + "genericValue": { + "type": "object", + "description": "Generic Payload field" + } + }, + "description": "Generic payload model", + "examples": [ + { + "genericValue": { } + } + ], + "required": [ + "genericValue" + ] } }, "messages": { @@ -255,10 +340,68 @@ "bindingVersion": "0.3.0" } } + }, + "io.github.springwolf.examples.amqp.dtos.GenericPayloadDto": { + "headers": { + "$ref": "#/components/schemas/SpringRabbitListenerDefaultHeaders" + }, + "payload": { + "schemaFormat": "application/vnd.aai.asyncapi+json;version=3.0.0", + "schema": { + "$ref": "#/components/schemas/io.github.springwolf.examples.amqp.dtos.GenericPayloadDto" + } + }, + "name": "io.github.springwolf.examples.amqp.dtos.GenericPayloadDto", + "title": "GenericPayloadDto", + "bindings": { + "amqp": { + "bindingVersion": "0.3.0" + } + } } } }, "operations": { + "#_receive_bindingsRead": { + "action": "receive", + "channel": { + "$ref": "#/channels/#" + }, + "bindings": { + "amqp": { + "expiration": 0, + "cc": [ + "#" + ], + "bindingVersion": "0.3.0" + } + }, + "messages": [ + { + "$ref": "#/channels/#/messages/io.github.springwolf.examples.amqp.dtos.ExamplePayloadDto" + } + ] + }, + "#_receive_bindingsUpdate": { + "action": "receive", + "channel": { + "$ref": "#/channels/#" + }, + "bindings": { + "amqp": { + "expiration": 0, + "cc": [ + "#" + ], + "bindingVersion": "0.3.0" + } + }, + "messages": [ + { + "$ref": "#/channels/#/messages/io.github.springwolf.examples.amqp.dtos.GenericPayloadDto" + } + ] + }, "another-queue_receive_receiveAnotherPayload": { "action": "receive", "channel": { @@ -366,6 +509,46 @@ "$ref": "#/channels/multi-payload-queue/messages/io.github.springwolf.examples.amqp.dtos.ExamplePayloadDto" } ] + }, + "queue-create_receive_queuesToDeclareCreate": { + "action": "receive", + "channel": { + "$ref": "#/channels/queue-create" + }, + "bindings": { + "amqp": { + "expiration": 0, + "cc": [ + "queue-create" + ], + "bindingVersion": "0.3.0" + } + }, + "messages": [ + { + "$ref": "#/channels/queue-create/messages/io.github.springwolf.examples.amqp.dtos.GenericPayloadDto" + } + ] + }, + "queue-delete_receive_queuesToDeclareDelete": { + "action": "receive", + "channel": { + "$ref": "#/channels/queue-delete" + }, + "bindings": { + "amqp": { + "expiration": 0, + "cc": [ + "queue-delete" + ], + "bindingVersion": "0.3.0" + } + }, + "messages": [ + { + "$ref": "#/channels/queue-delete/messages/io.github.springwolf.examples.amqp.dtos.GenericPayloadDto" + } + ] } } } \ No newline at end of file diff --git a/springwolf-examples/springwolf-amqp-example/src/test/resources/asyncapi.yaml b/springwolf-examples/springwolf-amqp-example/src/test/resources/asyncapi.yaml index 3448e0941..e5dd88239 100644 --- a/springwolf-examples/springwolf-amqp-example/src/test/resources/asyncapi.yaml +++ b/springwolf-examples/springwolf-amqp-example/src/test/resources/asyncapi.yaml @@ -16,13 +16,16 @@ info: defaultContentType: application/json servers: amqp-server: - host: amqp:5672 + host: localhost:5672 protocol: amqp channels: - 'CRUD-topic-exchange-1_#': + '#': + address: "#" messages: + io.github.springwolf.examples.amqp.dtos.ExamplePayloadDto: + $ref: "#/components/messages/io.github.springwolf.examples.amqp.dtos.ExamplePayloadDto" io.github.springwolf.examples.amqp.dtos.GenericPayloadDto: - $ref: '#/components/messages/io.github.springwolf.examples.amqp.dtos.GenericPayloadDto' + $ref: "#/components/messages/io.github.springwolf.examples.amqp.dtos.GenericPayloadDto" bindings: amqp: is: routingKey @@ -33,24 +36,11 @@ channels: autoDelete: false vhost: / bindingVersion: 0.3.0 - 'CRUD-topic-exchange-2_#': - messages: - io.github.springwolf.examples.amqp.dtos.ExamplePayloadDto: - $ref: '#/components/messages/io.github.springwolf.examples.amqp.dtos.ExamplePayloadDto' - bindings: - amqp: - is: routingKey - exchange: - name: CRUD-topic-exchange-2 - type: topic - durable: true - autoDelete: false - vhost: / - bindingVersion: 0.3.0 another-queue: + address: another-queue messages: io.github.springwolf.examples.amqp.dtos.AnotherPayloadDto: - $ref: '#/components/messages/io.github.springwolf.examples.amqp.dtos.AnotherPayloadDto' + $ref: "#/components/messages/io.github.springwolf.examples.amqp.dtos.AnotherPayloadDto" bindings: amqp: is: queue @@ -62,9 +52,10 @@ channels: vhost: / bindingVersion: 0.3.0 example-queue: + address: example-queue messages: io.github.springwolf.examples.amqp.dtos.ExamplePayloadDto: - $ref: '#/components/messages/io.github.springwolf.examples.amqp.dtos.ExamplePayloadDto' + $ref: "#/components/messages/io.github.springwolf.examples.amqp.dtos.ExamplePayloadDto" bindings: amqp: is: queue @@ -76,13 +67,15 @@ channels: vhost: / bindingVersion: 0.3.0 example-topic-exchange: + address: example-topic-exchange messages: io.github.springwolf.examples.amqp.dtos.AnotherPayloadDto: - $ref: '#/components/messages/io.github.springwolf.examples.amqp.dtos.AnotherPayloadDto' + $ref: "#/components/messages/io.github.springwolf.examples.amqp.dtos.AnotherPayloadDto" example-topic-routing-key: + address: example-topic-routing-key messages: io.github.springwolf.examples.amqp.dtos.AnotherPayloadDto: - $ref: '#/components/messages/io.github.springwolf.examples.amqp.dtos.AnotherPayloadDto' + $ref: "#/components/messages/io.github.springwolf.examples.amqp.dtos.AnotherPayloadDto" bindings: amqp: is: routingKey @@ -94,11 +87,12 @@ channels: vhost: / bindingVersion: 0.3.0 multi-payload-queue: + address: multi-payload-queue messages: io.github.springwolf.examples.amqp.dtos.AnotherPayloadDto: - $ref: '#/components/messages/io.github.springwolf.examples.amqp.dtos.AnotherPayloadDto' + $ref: "#/components/messages/io.github.springwolf.examples.amqp.dtos.AnotherPayloadDto" io.github.springwolf.examples.amqp.dtos.ExamplePayloadDto: - $ref: '#/components/messages/io.github.springwolf.examples.amqp.dtos.ExamplePayloadDto' + $ref: "#/components/messages/io.github.springwolf.examples.amqp.dtos.ExamplePayloadDto" bindings: amqp: is: queue @@ -110,9 +104,10 @@ channels: vhost: / bindingVersion: 0.3.0 queue-create: + address: queue-create messages: io.github.springwolf.examples.amqp.dtos.GenericPayloadDto: - $ref: '#/components/messages/io.github.springwolf.examples.amqp.dtos.GenericPayloadDto' + $ref: "#/components/messages/io.github.springwolf.examples.amqp.dtos.GenericPayloadDto" bindings: amqp: is: queue @@ -123,24 +118,11 @@ channels: autoDelete: false vhost: / bindingVersion: 0.3.0 - queue-update: - messages: - io.github.springwolf.examples.amqp.dtos.GenericPayloadDto: - $ref: '#/components/messages/io.github.springwolf.examples.amqp.dtos.GenericPayloadDto' - bindings: - amqp: - is: queue - queue: - name: queue-update - durable: true - exclusive: false - autoDelete: false - vhost: / - bindingVersion: 0.3.0 queue-delete: + address: queue-delete messages: io.github.springwolf.examples.amqp.dtos.GenericPayloadDto: - $ref: '#/components/messages/io.github.springwolf.examples.amqp.dtos.GenericPayloadDto' + $ref: "#/components/messages/io.github.springwolf.examples.amqp.dtos.GenericPayloadDto" bindings: amqp: is: queue @@ -154,24 +136,28 @@ channels: components: schemas: HeadersNotDocumented: + title: HeadersNotDocumented type: object properties: {} description: "There can be headers, but they are not explicitly documented." examples: - {} SpringRabbitListenerDefaultHeaders: + title: SpringRabbitListenerDefaultHeaders type: object properties: {} examples: - {} io.github.springwolf.examples.amqp.dtos.AnotherPayloadDto: + title: AnotherPayloadDto type: object properties: example: - $ref: '#/components/schemas/io.github.springwolf.examples.amqp.dtos.ExamplePayloadDto' + $ref: "#/components/schemas/io.github.springwolf.examples.amqp.dtos.ExamplePayloadDto" foo: type: string description: Foo field + maxLength: 100 examples: - bar description: Another payload model @@ -184,6 +170,7 @@ components: required: - example io.github.springwolf.examples.amqp.dtos.ExamplePayloadDto: + title: ExamplePayloadDto type: object properties: someEnum: @@ -199,6 +186,7 @@ components: type: integer description: Some long field format: int64 + minimum: 0 examples: - 5 someString: @@ -215,6 +203,7 @@ components: - someEnum - someString io.github.springwolf.examples.amqp.dtos.GenericPayloadDto: + title: GenericPayloadDto type: object properties: genericValue: @@ -228,11 +217,11 @@ components: messages: io.github.springwolf.examples.amqp.dtos.AnotherPayloadDto: headers: - $ref: '#/components/schemas/HeadersNotDocumented' + $ref: "#/components/schemas/HeadersNotDocumented" payload: schemaFormat: application/vnd.aai.asyncapi+json;version=3.0.0 schema: - $ref: '#/components/schemas/io.github.springwolf.examples.amqp.dtos.AnotherPayloadDto' + $ref: "#/components/schemas/io.github.springwolf.examples.amqp.dtos.AnotherPayloadDto" name: io.github.springwolf.examples.amqp.dtos.AnotherPayloadDto title: AnotherPayloadDto description: Another payload model @@ -241,11 +230,11 @@ components: bindingVersion: 0.3.0 io.github.springwolf.examples.amqp.dtos.ExamplePayloadDto: headers: - $ref: '#/components/schemas/SpringRabbitListenerDefaultHeaders' + $ref: "#/components/schemas/SpringRabbitListenerDefaultHeaders" payload: schemaFormat: application/vnd.aai.asyncapi+json;version=3.0.0 schema: - $ref: '#/components/schemas/io.github.springwolf.examples.amqp.dtos.ExamplePayloadDto' + $ref: "#/components/schemas/io.github.springwolf.examples.amqp.dtos.ExamplePayloadDto" name: io.github.springwolf.examples.amqp.dtos.ExamplePayloadDto title: ExamplePayloadDto bindings: @@ -253,11 +242,11 @@ components: bindingVersion: 0.3.0 io.github.springwolf.examples.amqp.dtos.GenericPayloadDto: headers: - $ref: '#/components/schemas/SpringRabbitListenerDefaultHeaders' + $ref: "#/components/schemas/SpringRabbitListenerDefaultHeaders" payload: schemaFormat: application/vnd.aai.asyncapi+json;version=3.0.0 schema: - $ref: '#/components/schemas/io.github.springwolf.examples.amqp.dtos.GenericPayloadDto' + $ref: "#/components/schemas/io.github.springwolf.examples.amqp.dtos.GenericPayloadDto" name: io.github.springwolf.examples.amqp.dtos.GenericPayloadDto title: GenericPayloadDto bindings: @@ -267,31 +256,31 @@ operations: '#_receive_bindingsRead': action: receive channel: - $ref: '#/channels/CRUD-topic-exchange-2_#' + $ref: "#/channels/#" bindings: amqp: expiration: 0 cc: - - '#' + - "#" bindingVersion: 0.3.0 messages: - - $ref: '#/channels/#/messages/io.github.springwolf.examples.amqp.dtos.ExamplePayloadDto' + - $ref: "#/channels/#/messages/io.github.springwolf.examples.amqp.dtos.ExamplePayloadDto" '#_receive_bindingsUpdate': action: receive channel: - $ref: '#/channels/CRUD-topic-exchange-1_#' + $ref: "#/channels/#" bindings: amqp: expiration: 0 cc: - - '#' + - "#" bindingVersion: 0.3.0 messages: - - $ref: '#/channels/#/messages/io.github.springwolf.examples.amqp.dtos.GenericPayloadDto' + - $ref: "#/channels/#/messages/io.github.springwolf.examples.amqp.dtos.GenericPayloadDto" another-queue_receive_receiveAnotherPayload: action: receive channel: - $ref: '#/channels/another-queue' + $ref: "#/channels/another-queue" bindings: amqp: expiration: 0 @@ -299,11 +288,11 @@ operations: - another-queue bindingVersion: 0.3.0 messages: - - $ref: '#/channels/another-queue/messages/io.github.springwolf.examples.amqp.dtos.AnotherPayloadDto' + - $ref: "#/channels/another-queue/messages/io.github.springwolf.examples.amqp.dtos.AnotherPayloadDto" example-queue_receive_receiveExamplePayload: action: receive channel: - $ref: '#/channels/example-queue' + $ref: "#/channels/example-queue" bindings: amqp: expiration: 0 @@ -311,11 +300,11 @@ operations: - example-queue bindingVersion: 0.3.0 messages: - - $ref: '#/channels/example-queue/messages/io.github.springwolf.examples.amqp.dtos.ExamplePayloadDto' + - $ref: "#/channels/example-queue/messages/io.github.springwolf.examples.amqp.dtos.ExamplePayloadDto" example-topic-exchange_send_sendMessage: action: send channel: - $ref: '#/channels/example-topic-exchange' + $ref: "#/channels/example-topic-exchange" title: example-topic-exchange_send description: "Custom, optional description defined in the AsyncPublisher annotation" bindings: @@ -329,11 +318,11 @@ operations: ack: false bindingVersion: 0.3.0 messages: - - $ref: '#/channels/example-topic-exchange/messages/io.github.springwolf.examples.amqp.dtos.AnotherPayloadDto' + - $ref: "#/channels/example-topic-exchange/messages/io.github.springwolf.examples.amqp.dtos.AnotherPayloadDto" example-topic-routing-key_receive_bindingsExample: action: receive channel: - $ref: '#/channels/example-topic-routing-key' + $ref: "#/channels/example-topic-routing-key" bindings: amqp: expiration: 0 @@ -341,11 +330,11 @@ operations: - example-topic-routing-key bindingVersion: 0.3.0 messages: - - $ref: '#/channels/example-topic-routing-key/messages/io.github.springwolf.examples.amqp.dtos.AnotherPayloadDto' + - $ref: "#/channels/example-topic-routing-key/messages/io.github.springwolf.examples.amqp.dtos.AnotherPayloadDto" multi-payload-queue_receive_bindingsBeanExample: action: receive channel: - $ref: '#/channels/multi-payload-queue' + $ref: "#/channels/multi-payload-queue" bindings: amqp: expiration: 0 @@ -353,12 +342,12 @@ operations: - multi-payload-queue bindingVersion: 0.3.0 messages: - - $ref: '#/channels/multi-payload-queue/messages/io.github.springwolf.examples.amqp.dtos.AnotherPayloadDto' - - $ref: '#/channels/multi-payload-queue/messages/io.github.springwolf.examples.amqp.dtos.ExamplePayloadDto' + - $ref: "#/channels/multi-payload-queue/messages/io.github.springwolf.examples.amqp.dtos.AnotherPayloadDto" + - $ref: "#/channels/multi-payload-queue/messages/io.github.springwolf.examples.amqp.dtos.ExamplePayloadDto" queue-create_receive_queuesToDeclareCreate: action: receive channel: - $ref: '#/channels/queue-create' + $ref: "#/channels/queue-create" bindings: amqp: expiration: 0 @@ -366,11 +355,11 @@ operations: - queue-create bindingVersion: 0.3.0 messages: - - $ref: '#/channels/queue-create/messages/io.github.springwolf.examples.amqp.dtos.GenericPayloadDto' + - $ref: "#/channels/queue-create/messages/io.github.springwolf.examples.amqp.dtos.GenericPayloadDto" queue-delete_receive_queuesToDeclareDelete: action: receive channel: - $ref: '#/channels/queue-delete' + $ref: "#/channels/queue-delete" bindings: amqp: expiration: 0 @@ -378,4 +367,4 @@ operations: - queue-delete bindingVersion: 0.3.0 messages: - - $ref: '#/channels/queue-delete/messages/io.github.springwolf.examples.amqp.dtos.GenericPayloadDto' \ No newline at end of file + - $ref: "#/channels/queue-delete/messages/io.github.springwolf.examples.amqp.dtos.GenericPayloadDto" \ No newline at end of file