From 21f77fbe101572160d19a06f8f7e24e620be3777 Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Fri, 10 Feb 2023 22:31:11 +0400 Subject: [PATCH] feat(AsyncAPI 2.6.0): Channel - Operation - Operation draft - Channel, Message, Operation Bindings draft https://github.com/asyncapi/jasyncapi/issues/126 --- .../_6_0/binding/channel/ChannelBinding.java | 12 ++ .../channel/amqp/AMQPChannelBinding.java | 126 +++++++++++++++ .../channel/amqp1/AMQP1ChannelBinding.java | 21 +++ .../anypointmq/AnypointMQChannelBinding.java | 48 ++++++ .../GooglePubSubChannelBinding.java | 116 +++++++++++++ .../channel/http/HTTPChannelBinding.java | 21 +++ .../channel/ibmmq/IBMMQChannelBinding.java | 153 ++++++++++++++++++ .../channel/jms/JMSChannelBinding.java | 21 +++ .../channel/kafka/KafkaChannelBinding.java | 111 +++++++++++++ .../mercure/MercureChannelBinding.java | 21 +++ .../channel/mqtt/MQTTChannelBinding.java | 21 +++ .../channel/mqtt5/MQTT5ChannelBinding.java | 21 +++ .../channel/nats/NATSChannelBinding.java | 21 +++ .../channel/pulsar/PulsarChannelBinding.java | 103 ++++++++++++ .../channel/redis/RedisChannelBinding.java | 21 +++ .../channel/sns/SNSChannelBinding.java | 21 +++ .../channel/solace/SolaceChannelBinding.java | 20 +++ .../channel/sqs/SQSChannelBinding.java | 21 +++ .../channel/stomp/STOMPChannelBinding.java | 21 +++ .../channel/ws/WebSocketsChannelBinding.java | 61 +++++++ .../_6_0/binding/message/MessageBinding.java | 12 ++ .../message/amqp/AMQPMessageBinding.java | 43 +++++ .../message/amqp1/AMQP1MessageBinding.java | 21 +++ .../anypointmq/AnypointMQMessageBinding.java | 39 +++++ .../GooglePubSubMessageBinding.java | 78 +++++++++ .../message/http/HTTPMessageBinding.java | 40 +++++ .../message/ibmmq/IBMMQMessageBinding.java | 70 ++++++++ .../message/jms/JMSMessageBinding.java | 21 +++ .../message/kafka/KafkaMessageBinding.java | 59 +++++++ .../mercure/MercureMessageBinding.java | 21 +++ .../message/mqtt/MQTTMessageBinding.java | 32 ++++ .../message/mqtt5/MQTT5MessageBinding.java | 21 +++ .../message/nats/NATSMessageBinding.java | 21 +++ .../message/pulsar/PulsarMessageBinding.java | 20 +++ .../message/redis/RedisMessageBinding.java | 21 +++ .../message/sns/SNSMessageBinding.java | 21 +++ .../message/solace/SolaceMessageBinding.java | 20 +++ .../message/sqs/SQSMessageBinding.java | 21 +++ .../message/stomp/STOMPMessageBinding.java | 21 +++ .../message/ws/WebSocketsMessageBinding.java | 21 +++ .../binding/operation/OperationBinding.java | 12 ++ .../operation/amqp/AMQPOperationBinding.java | 111 +++++++++++++ .../amqp1/AMQP1OperationBinding.java | 21 +++ .../AnypointMQOperationBinding.java | 21 +++ .../GooglePubSubOperationBinding.java | 21 +++ .../operation/http/HTTPOperationBinding.java | 57 +++++++ .../ibmmq/IBMMQOperationBinding.java | 20 +++ .../operation/jms/JMSOperationBinding.java | 21 +++ .../kafka/KafkaOperationBinding.java | 50 ++++++ .../mercure/MercureOperationBinding.java | 21 +++ .../operation/mqtt/MQTTOperationBinding.java | 51 ++++++ .../mqtt5/MQTT5OperationBinding.java | 21 +++ .../operation/nats/NATSOperationBinding.java | 37 +++++ .../pulsar/PulsarOperationBinding.java | 23 +++ .../redis/RedisOperationBinding.java | 21 +++ .../operation/sns/SNSOperationBinding.java | 21 +++ .../solace/SolaceOperationBinding.java | 122 ++++++++++++++ .../operation/sqs/SQSOperationBinding.java | 21 +++ .../stomp/STOMPOperationBinding.java | 21 +++ .../ws/WebSocketsOperationBinding.java | 21 +++ .../v2/_6_0/model/channel/ChannelItem.java | 91 +++++++++++ .../model/channel/operation/Operation.java | 122 ++++++++++++++ .../channel/amqp/AMQPChannelBindingTest.kt | 48 ++++++ .../AnypointMQChannelBindingTest.kt | 35 ++++ .../GooglePubSubChannelBindingTest.kt | 51 ++++++ .../channel/ibmmq/IBMMQChannelBindingTest.kt | 45 ++++++ .../channel/kafka/KafkaChannelBindingTest.kt | 44 +++++ .../pulsar/PulsarChannelBindingTest.kt | 40 +++++ .../ws/WebSocketsChannelBindingTest.kt | 52 ++++++ .../message/amqp/AMQPMessageBindingTest.kt | 31 ++++ .../AnypointMQMessageBindingTest.kt | 39 +++++ .../GooglePubSubMessageBindingTest.kt | 33 ++++ .../message/http/HTTPMessageBindingTest.kt | 38 +++++ .../message/ibmmq/IBMMQMessageBindingTest.kt | 33 ++++ .../message/kafka/KafkaMessageBindingTest.kt | 36 +++++ .../message/mqtt/MQTTMessageBindingTest.kt | 29 ++++ .../amqp/AMQPOperationBindingTest.kt | 39 +++++ .../http/HTTPOperationBindingTest.kt | 43 +++++ .../kafka/KafkaOperationBindingTest.kt | 37 +++++ .../mqtt/MQTTOperationBindingTest.kt | 31 ++++ .../nats/NATSOperationBindingTest.kt | 31 ++++ .../solace/SolaceOperationBindingTest.kt | 54 +++++++ .../channel/amqp/amqpChannelBinding.json | 18 +++ .../anypoint/anypointMQChannelBinding.json | 5 + .../googlePubSubChannelBinding.json | 24 +++ .../channel/ibmmq/ibmMQChannelBinding.json | 16 ++ .../channel/kafka/kafkaChannelBinding.json | 16 ++ .../channel/pulsar/pulsarChannelBinding.json | 16 ++ .../channel/ws/webSocketsChannelBinding.json | 21 +++ .../message/amqp/amqpMessageBinding.json | 5 + .../anypointmq/anypointMQMessageBinding.json | 12 ++ .../googlePubSubMessageBinding.json | 7 + .../message/http/httpMessageBinding.json | 14 ++ .../message/ibmmq/ibmMQMessageBinding.json | 7 + .../message/kafka/kafkaMessageBinding.json | 12 ++ .../message/mqtt/mqttMessageBinding.json | 3 + .../operation/amqp/amqpOperationBinding.json | 17 ++ .../operation/http/httpOperationBinding.json | 19 +++ .../kafka/kafkaOperationBinding.json | 15 ++ .../operation/mqtt/mqttOperationBinding.json | 5 + .../operation/nats/natsOperationBinding.json | 4 + .../solace/solaceOperationBinding.json | 31 ++++ 102 files changed, 3587 insertions(+) create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/ChannelBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/amqp/AMQPChannelBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/amqp1/AMQP1ChannelBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/anypointmq/AnypointMQChannelBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/googlepubsub/GooglePubSubChannelBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/http/HTTPChannelBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/ibmmq/IBMMQChannelBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/jms/JMSChannelBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/kafka/KafkaChannelBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/mercure/MercureChannelBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/mqtt/MQTTChannelBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/mqtt5/MQTT5ChannelBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/nats/NATSChannelBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/pulsar/PulsarChannelBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/redis/RedisChannelBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/sns/SNSChannelBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/solace/SolaceChannelBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/sqs/SQSChannelBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/stomp/STOMPChannelBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/ws/WebSocketsChannelBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/MessageBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/amqp/AMQPMessageBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/amqp1/AMQP1MessageBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/anypointmq/AnypointMQMessageBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/googlepubsub/GooglePubSubMessageBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/http/HTTPMessageBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/ibmmq/IBMMQMessageBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/jms/JMSMessageBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/kafka/KafkaMessageBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/mercure/MercureMessageBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/mqtt/MQTTMessageBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/mqtt5/MQTT5MessageBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/nats/NATSMessageBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/pulsar/PulsarMessageBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/redis/RedisMessageBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/sns/SNSMessageBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/solace/SolaceMessageBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/sqs/SQSMessageBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/stomp/STOMPMessageBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/ws/WebSocketsMessageBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/OperationBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/amqp/AMQPOperationBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/amqp1/AMQP1OperationBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/anypointmq/AnypointMQOperationBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/googlepubsub/GooglePubSubOperationBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/http/HTTPOperationBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/ibmmq/IBMMQOperationBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/jms/JMSOperationBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/kafka/KafkaOperationBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/mercure/MercureOperationBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/mqtt/MQTTOperationBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/mqtt5/MQTT5OperationBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/nats/NATSOperationBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/pulsar/PulsarOperationBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/redis/RedisOperationBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/sns/SNSOperationBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/solace/SolaceOperationBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/sqs/SQSOperationBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/stomp/STOMPOperationBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/ws/WebSocketsOperationBinding.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/model/channel/ChannelItem.java create mode 100644 asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/model/channel/operation/Operation.java create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/channel/amqp/AMQPChannelBindingTest.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/channel/anypointmq/AnypointMQChannelBindingTest.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/channel/googlepubsub/GooglePubSubChannelBindingTest.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/channel/ibmmq/IBMMQChannelBindingTest.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/channel/kafka/KafkaChannelBindingTest.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/channel/pulsar/PulsarChannelBindingTest.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/channel/ws/WebSocketsChannelBindingTest.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/message/amqp/AMQPMessageBindingTest.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/message/anypointmq/AnypointMQMessageBindingTest.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/message/googlepubsub/GooglePubSubMessageBindingTest.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/message/http/HTTPMessageBindingTest.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/message/ibmmq/IBMMQMessageBindingTest.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/message/kafka/KafkaMessageBindingTest.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/message/mqtt/MQTTMessageBindingTest.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/operation/amqp/AMQPOperationBindingTest.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/operation/http/HTTPOperationBindingTest.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/operation/kafka/KafkaOperationBindingTest.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/operation/mqtt/MQTTOperationBindingTest.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/operation/nats/NATSOperationBindingTest.kt create mode 100644 asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/operation/solace/SolaceOperationBindingTest.kt create mode 100644 asyncapi-core/src/test/resources/json/2.6.0/binding/channel/amqp/amqpChannelBinding.json create mode 100644 asyncapi-core/src/test/resources/json/2.6.0/binding/channel/anypoint/anypointMQChannelBinding.json create mode 100644 asyncapi-core/src/test/resources/json/2.6.0/binding/channel/googlepubsub/googlePubSubChannelBinding.json create mode 100644 asyncapi-core/src/test/resources/json/2.6.0/binding/channel/ibmmq/ibmMQChannelBinding.json create mode 100644 asyncapi-core/src/test/resources/json/2.6.0/binding/channel/kafka/kafkaChannelBinding.json create mode 100644 asyncapi-core/src/test/resources/json/2.6.0/binding/channel/pulsar/pulsarChannelBinding.json create mode 100644 asyncapi-core/src/test/resources/json/2.6.0/binding/channel/ws/webSocketsChannelBinding.json create mode 100644 asyncapi-core/src/test/resources/json/2.6.0/binding/message/amqp/amqpMessageBinding.json create mode 100644 asyncapi-core/src/test/resources/json/2.6.0/binding/message/anypointmq/anypointMQMessageBinding.json create mode 100644 asyncapi-core/src/test/resources/json/2.6.0/binding/message/googlepubsub/googlePubSubMessageBinding.json create mode 100644 asyncapi-core/src/test/resources/json/2.6.0/binding/message/http/httpMessageBinding.json create mode 100644 asyncapi-core/src/test/resources/json/2.6.0/binding/message/ibmmq/ibmMQMessageBinding.json create mode 100644 asyncapi-core/src/test/resources/json/2.6.0/binding/message/kafka/kafkaMessageBinding.json create mode 100644 asyncapi-core/src/test/resources/json/2.6.0/binding/message/mqtt/mqttMessageBinding.json create mode 100644 asyncapi-core/src/test/resources/json/2.6.0/binding/operation/amqp/amqpOperationBinding.json create mode 100644 asyncapi-core/src/test/resources/json/2.6.0/binding/operation/http/httpOperationBinding.json create mode 100644 asyncapi-core/src/test/resources/json/2.6.0/binding/operation/kafka/kafkaOperationBinding.json create mode 100644 asyncapi-core/src/test/resources/json/2.6.0/binding/operation/mqtt/mqttOperationBinding.json create mode 100644 asyncapi-core/src/test/resources/json/2.6.0/binding/operation/nats/natsOperationBinding.json create mode 100644 asyncapi-core/src/test/resources/json/2.6.0/binding/operation/solace/solaceOperationBinding.json diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/ChannelBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/ChannelBinding.java new file mode 100644 index 00000000..76f28a1b --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/ChannelBinding.java @@ -0,0 +1,12 @@ +package com.asyncapi.v2._6_0.binding.channel; + +import lombok.EqualsAndHashCode; + +/** + * Describes AsyncAPI channel binding. + * + * @author Pavel Bodiachevskii + */ +@EqualsAndHashCode +public class ChannelBinding { +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/amqp/AMQPChannelBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/amqp/AMQPChannelBinding.java new file mode 100644 index 00000000..9f974c18 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/amqp/AMQPChannelBinding.java @@ -0,0 +1,126 @@ +package com.asyncapi.v2._6_0.binding.channel.amqp; + +import com.asyncapi.v2._6_0.binding.channel.ChannelBinding; +import lombok.*; + +import javax.annotation.CheckForNull; + +/** + * Describes AMQP 0-9-1 channel binding. + *

+ * Contains information about the channel representation in AMQP. + * + * @version 0.2.0 + * @see AMQP channel binding + * @author Pavel Bodiachevskii + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class AMQPChannelBinding extends ChannelBinding { + + /** + * Defines what type of channel is it. Can be either queue or routingKey (default). + */ + @CheckForNull + private String is; + + /** + * When is=routingKey, this object defines the exchange properties. + */ + @CheckForNull + private ExchangeProperties exchange; + + /** + * When is=queue, this object defines the queue properties. + */ + @CheckForNull + private QueueProperties queue; + + @CheckForNull + @Builder.Default + private String bindingVersion = "0.2.0"; + + @Data + @Builder + @NoArgsConstructor + @AllArgsConstructor + @EqualsAndHashCode + public static class ExchangeProperties { + + /** + * The name of the exchange. It MUST NOT exceed 255 characters long. + */ + @CheckForNull + private String name; + + /** + * The type of the exchange. Can be either topic, direct, fanout, default or headers. + */ + @CheckForNull + private String type; + + /** + * Whether the exchange should survive broker restarts or not. + */ + @CheckForNull + private Boolean durable; + + /** + * Whether the exchange should be deleted when the last queue is unbound from it. + */ + @CheckForNull + private Boolean autoDelete; + + /** + * The virtual host of the exchange. Defaults to /. + */ + @CheckForNull + @Builder.Default + private String vhost = "/"; + + } + + @Data + @Builder + @NoArgsConstructor + @AllArgsConstructor + @EqualsAndHashCode + public static class QueueProperties { + + /** + * The name of the queue. It MUST NOT exceed 255 characters long. + */ + @CheckForNull + private String name; + + /** + * Whether the queue should survive broker restarts or not. + */ + @CheckForNull + private Boolean durable; + + /** + * Whether the queue should be used only by one connection or not. + */ + @CheckForNull + private Boolean exclusive; + + /** + * Whether the queue should be deleted when the last consumer unsubscribes. + */ + @CheckForNull + private Boolean autoDelete; + + /** + * The virtual host of the queue. Defaults to /. + */ + @CheckForNull + @Builder.Default + private String vhost = "/"; + + } + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/amqp1/AMQP1ChannelBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/amqp1/AMQP1ChannelBinding.java new file mode 100644 index 00000000..cae3273a --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/amqp1/AMQP1ChannelBinding.java @@ -0,0 +1,21 @@ +package com.asyncapi.v2._6_0.binding.channel.amqp1; + +import com.asyncapi.v2.binding.ChannelBinding; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +/** + * This class MUST NOT contain any properties. Its name is reserved for future use. + *

+ * Describes AMQP 1.0 channel binding. + * + * @version 0.1.0 + * @see AMQP channel binding + * @author Pavel Bodiachevskii + */ +@Data +@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class AMQP1ChannelBinding extends ChannelBinding { +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/anypointmq/AnypointMQChannelBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/anypointmq/AnypointMQChannelBinding.java new file mode 100644 index 00000000..dd5aba8f --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/anypointmq/AnypointMQChannelBinding.java @@ -0,0 +1,48 @@ +package com.asyncapi.v2._6_0.binding.channel.anypointmq; + +import com.asyncapi.v2._6_0.binding.channel.ChannelBinding; +import lombok.*; + +import javax.annotation.CheckForNull; + +/** + * Describes Anypoint MQ channel binding. + * + * @version 0.0.1 + * @see Anypoint MQ channel binding + * @author Pavel Bodiachevskii + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class AnypointMQChannelBinding extends ChannelBinding { + + /** + * OPTIONAL, defaults to the channel name. + *

+ * The destination (queue or exchange) name for this channel. SHOULD only be specified if the channel name differs + * from the actual destination name, such as when the channel name is not a valid destination name in Anypoint MQ. + */ + @CheckForNull + private String destination; + + /** + * OPTIONAL, defaults to queue. + *

+ * The type of destination, which MUST be either exchange or queue or fifo-queue. + * SHOULD be specified to document the messaging model (publish/subscribe, point-to-point, strict message ordering) + * supported by this channel. + */ + @CheckForNull + private String destinationType; + + /** + * OPTIONAL, defaults to latest. The version of this binding. + */ + @CheckForNull + @Builder.Default + private String bindingVersion = "0.0.1"; + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/googlepubsub/GooglePubSubChannelBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/googlepubsub/GooglePubSubChannelBinding.java new file mode 100644 index 00000000..7a6fb154 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/googlepubsub/GooglePubSubChannelBinding.java @@ -0,0 +1,116 @@ +package com.asyncapi.v2._6_0.binding.channel.googlepubsub; + +import com.asyncapi.v2._6_0.binding.message.MessageBinding; +import lombok.*; + +import javax.annotation.CheckForNull; +import java.util.List; +import java.util.Map; + +/** + * The Channel Bindings Object is used to describe the Google Cloud Pub/Sub specific Topic details with AsyncAPI. + *

+ * Describes Google Cloud Pub/Sub channel binding. + * + * @version 0.1.0 + * @see Google Cloud Pub/Sub channel binding + * @author Pavel Bodiachevskii + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class GooglePubSubChannelBinding extends MessageBinding { + + /** + * The Google Cloud Pub/Sub Topic name + */ + private String topic; + + /** + * An object of key-value pairs (These are used to categorize Cloud Resources like Cloud Pub/Sub Topics.) + */ + @CheckForNull + private Map labels; + + /** + * Indicates the minimum duration to retain a message after it is published to the topic (Must be a valid Duration.) + */ + @CheckForNull + private String messageRetentionDuration; + + /** + * Policy constraining the set of Google Cloud Platform regions where messages published to the topic may be stored + */ + @CheckForNull + private MessageStoragePolicy messageStoragePolicy; + + /** + * Settings for validating messages published against a schema + */ + @CheckForNull + private SchemaSettings schemaSettings; + + /** + * OPTIONAL, defaults to latest. The version of this binding. + */ + @CheckForNull + @Builder.Default + private String bindingVersion = "0.1.0"; + + /** + * The Message Storage Policy Object is used to describe the Google Cloud Pub/Sub MessageStoragePolicy Object with AsyncAPI. + */ + @Data + @Builder + @NoArgsConstructor + @AllArgsConstructor + @EqualsAndHashCode + public static class MessageStoragePolicy { + + /** + * A list of IDs of GCP regions where messages that are published to the topic may be persisted in storage + */ + @CheckForNull + private List allowedPersistenceRegions; + + } + + /** + * The Schema Settings Object is used to describe the Google Cloud Pub/Sub SchemaSettings Object with AsyncAPI. + */ + @Data + @Builder + @NoArgsConstructor + @AllArgsConstructor + @EqualsAndHashCode + public static class SchemaSettings { + + /** + * The encoding of the message (Must be one of the possible Encoding values.) + */ + @CheckForNull + private String encoding; + + /** + * The minimum (inclusive) revision allowed for validating messages + */ + @CheckForNull + private String firstRevisionId; + + /** + * The maximum (inclusive) revision allowed for validating messages + */ + @CheckForNull + private String lastRevisionId; + + /** + * The name of the schema that messages published should be validated against (The format is projects/{project}/schemas/{schema}.) + */ + @CheckForNull + private String name; + + } + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/http/HTTPChannelBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/http/HTTPChannelBinding.java new file mode 100644 index 00000000..fe0e1bb2 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/http/HTTPChannelBinding.java @@ -0,0 +1,21 @@ +package com.asyncapi.v2._6_0.binding.channel.http; + +import com.asyncapi.v2._6_0.binding.channel.ChannelBinding; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +/** + * This class MUST NOT contain any properties. Its name is reserved for future use. + *

+ * Describes HTTP channel binding. + * + * @version 0.1.0 + * @see HTTP channel binding + * @author Pavel Bodiachevskii + */ +@Data +@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class HTTPChannelBinding extends ChannelBinding { +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/ibmmq/IBMMQChannelBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/ibmmq/IBMMQChannelBinding.java new file mode 100644 index 00000000..d6768ea2 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/ibmmq/IBMMQChannelBinding.java @@ -0,0 +1,153 @@ +package com.asyncapi.v2._6_0.binding.channel.ibmmq; + +import com.asyncapi.v2._6_0.binding.channel.ChannelBinding; +import lombok.*; + +import javax.annotation.CheckForNull; +import javax.annotation.Nonnull; +import java.util.Map; + +/** + * Describes IBM MQ channel binding. + *

+ * This object contains information about the channel representation in IBM MQ. Each channel corresponds to a Queue or Topic within IBM MQ. + * + * @version 0.1.0 + * @see Redis server binding + * @author Pavel Bodiachevskii + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class IBMMQChannelBinding extends ChannelBinding { + + /** + * Defines the type of AsyncAPI channel. + *

+ * MUST be either topic or queue. For type topic, the AsyncAPI channel name MUST be assumed for the IBM MQ topic string unless overridden. + */ + @CheckForNull + private String destinationType; + + /** + * REQUIRED if destinationType = queue + *

+ * queue and topic fields MUST NOT coexist within a channel binding + */ + @CheckForNull + private Queue queue; + + /** + * Defines the properties of a topic. + *

+ * OPTIONAL if destinationType = topic + *

+ * queue and topic fields MUST NOT coexist within a channel binding. + */ + @CheckForNull + private Topic topic; + + /** + * The maximum length of the physical message (in bytes) accepted by the Topic or Queue. Messages produced that are + * greater in size than this value may fail to be delivered. More information on the maximum message length can be + * found on this page in the IBM MQ Knowledge Center. + *

+ * MUST be 0-104,857,600 bytes (100 MB). + */ + @CheckForNull + private Integer maxMsgLength; + + /** + * The version of this binding. + */ + @Builder.Default + private String bindingVersion = "0.1.0"; + + /** + * Defines the properties of a queue. + */ + @Data + @Builder + @NoArgsConstructor + @AllArgsConstructor + @EqualsAndHashCode + public static class Queue { + + /** + * Defines the name of the IBM MQ queue associated with the channel. + *

+ * A value MUST be specified. MUST NOT exceed 48 characters in length. MUST be a valid IBM MQ queue name + */ + @Nonnull + private String objectName; + + /** + * Defines if the queue is a cluster queue and therefore partitioned. If true, a binding option MAY be specified + * when accessing the queue. More information on binding options can be found on this page in the IBM MQ Knowledge Center. + *

+ * If false, binding options SHOULD NOT be specified when accessing the queue. + */ + @CheckForNull + @Builder.Default + private Boolean isPartitioned = false; + + /** + * Specifies if it is recommended to open the queue exclusively. + */ + @CheckForNull + @Builder.Default + private Boolean exclusive = false; + + } + + /** + * Defines the properties of a topic. + */ + @Data + @Builder + @NoArgsConstructor + @AllArgsConstructor + @EqualsAndHashCode + public static class Topic { + + /** + * The value of the IBM MQ topic string to be used. + *

+ * OPTIONAL + * Note: if specified, SHALL override AsyncAPI channel name. + *

+ * MUST NOT exceed 10240 characters in length. MAY coexist with topic.objectName + */ + @CheckForNull + private String string; + + /** + * The name of the IBM MQ topic object. + *

+ * OPTIONAL + * Note: if specified, SHALL override AsyncAPI channel name. + *

+ * MUST NOT exceed 48 characters in length. MAY coexist with topic.string + */ + @CheckForNull + private String objectName; + + /** + * Defines if the subscription may be durable. + */ + @CheckForNull + @Builder.Default + private Boolean durablePermitted = true; + + /** + * Defines if the last message published will be made available to new subscriptions. + */ + @CheckForNull + @Builder.Default + private Boolean lastMsgRetained = false; + + } + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/jms/JMSChannelBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/jms/JMSChannelBinding.java new file mode 100644 index 00000000..84d902e4 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/jms/JMSChannelBinding.java @@ -0,0 +1,21 @@ +package com.asyncapi.v2._6_0.binding.channel.jms; + +import com.asyncapi.v2.binding.ChannelBinding; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +/** + * This class MUST NOT contain any properties. Its name is reserved for future use. + * + * Describes JMS channel binding. + * + * @version 0.1.0 + * @see JMS channel binding + * @author Pavel Bodiachevskii + */ +@Data +@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class JMSChannelBinding extends ChannelBinding { +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/kafka/KafkaChannelBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/kafka/KafkaChannelBinding.java new file mode 100644 index 00000000..759bb59a --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/kafka/KafkaChannelBinding.java @@ -0,0 +1,111 @@ +package com.asyncapi.v2._6_0.binding.channel.kafka; + +import com.asyncapi.v2._6_0.binding.channel.ChannelBinding; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.*; + +import javax.annotation.CheckForNull; +import java.util.List; + +/** + * Describes Kafka channel binding. + * + * @version 0.4.0 + * @see Kafka channel binding + * @author Pavel Bodiachevskii + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class KafkaChannelBinding extends ChannelBinding { + + /** + * Kafka topic name if different from channel name. + */ + @CheckForNull + private String topic; + + /** + * Number of partitions configured on this topic (useful to know how many parallel consumers you may run). + *

+ * MUST be positive. + */ + @CheckForNull + private Integer partitions; + + /** + * Number of replicas configured on this topic. + *

+ * MUST be positive. + */ + @CheckForNull + private Integer replicas; + + /** + * Topic configuration properties that are relevant for the API. + */ + @CheckForNull + private TopicConfiguration topicConfiguration; + + /** + * The version of this binding. If omitted, "latest" MUST be assumed. + */ + @CheckForNull + @Builder.Default + private String bindingVersion = "0.4.0"; + + /** + * This objects contains information about the API relevant topic configuration in Kafka. + * + * @version 0.4.0 + * @see Kafka channel binding + * @author Pavel Bodiachevskii + */ + @Data + @Builder + @NoArgsConstructor + @AllArgsConstructor + public static class TopicConfiguration { + + /** + * The cleanup.policy configuration option. + *

+ * array may only contain delete and/or compact + */ + @CheckForNull + @JsonProperty("cleanup.policy") + private List cleanupPolicy; + + /** + * The retention.ms configuration option. + */ + @CheckForNull + @JsonProperty("retention.ms") + private Integer retentionMs; + + /** + * The retention.bytes configuration option. + */ + @CheckForNull + @JsonProperty("retention.bytes") + private Integer retentionBytes; + + /** + * The delete.retention.ms configuration option. + */ + @CheckForNull + @JsonProperty("delete.retention.ms") + private Integer deleteRetentionMs; + + /** + * The max.message.bytes configuration option. + */ + @CheckForNull + @JsonProperty("max.message.bytes") + private Integer maxMessageBytes; + + } + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/mercure/MercureChannelBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/mercure/MercureChannelBinding.java new file mode 100644 index 00000000..aa7e8b7b --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/mercure/MercureChannelBinding.java @@ -0,0 +1,21 @@ +package com.asyncapi.v2._6_0.binding.channel.mercure; + +import com.asyncapi.v2._6_0.binding.channel.ChannelBinding; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +/** + * This class MUST NOT contain any properties. Its name is reserved for future use. + *

+ * Describes Mercure channel binding. + * + * @version 0.1.0 + * @see Mercure channel binding + * @author Pavel Bodiachevskii + */ +@Data +@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class MercureChannelBinding extends ChannelBinding { +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/mqtt/MQTTChannelBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/mqtt/MQTTChannelBinding.java new file mode 100644 index 00000000..fb2a8093 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/mqtt/MQTTChannelBinding.java @@ -0,0 +1,21 @@ +package com.asyncapi.v2._6_0.binding.channel.mqtt; + +import com.asyncapi.v2.binding.ChannelBinding; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +/** + * This class MUST NOT contain any properties. Its name is reserved for future use. + *

+ * Describes MQTT channel binding. + * + * @version 0.1.0 + * @see MQTT channel binding + * @author Pavel Bodiachevskii + */ +@Data +@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class MQTTChannelBinding extends ChannelBinding { +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/mqtt5/MQTT5ChannelBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/mqtt5/MQTT5ChannelBinding.java new file mode 100644 index 00000000..6ff8f6ed --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/mqtt5/MQTT5ChannelBinding.java @@ -0,0 +1,21 @@ +package com.asyncapi.v2._6_0.binding.channel.mqtt5; + +import com.asyncapi.v2.binding.ChannelBinding; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +/** + * This class MUST NOT contain any properties. Its name is reserved for future use. + *

+ * Describes MQTT 5 channel binding. + * + * @version 0.2.0 + * @see MQTT 5 channel binding + * @author Pavel Bodiachevskii + */ +@Data +@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class MQTT5ChannelBinding extends ChannelBinding { +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/nats/NATSChannelBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/nats/NATSChannelBinding.java new file mode 100644 index 00000000..506f754e --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/nats/NATSChannelBinding.java @@ -0,0 +1,21 @@ +package com.asyncapi.v2._6_0.binding.channel.nats; + +import com.asyncapi.v2.binding.ChannelBinding; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +/** + * This class MUST NOT contain any properties. Its name is reserved for future use. + *

+ * Describes NATS channel binding. + * + * @version 0.1.0 + * @see NATS channel binding + * @author Pavel Bodiachevskii + */ +@Data +@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class NATSChannelBinding extends ChannelBinding { +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/pulsar/PulsarChannelBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/pulsar/PulsarChannelBinding.java new file mode 100644 index 00000000..e8125301 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/pulsar/PulsarChannelBinding.java @@ -0,0 +1,103 @@ +package com.asyncapi.v2._6_0.binding.channel.pulsar; + +import com.asyncapi.v2._6_0.binding.operation.OperationBinding; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.*; + +import javax.annotation.CheckForNull; +import javax.annotation.Nonnull; +import java.util.List; + +/** + * Describes Pulsar channel binding. + *

+ * This object MUST NOT contain any properties. Its name is reserved for future use. + * + * @version 0.1.0 + * @see Pulsar channel binding + * @author Pavel Bodiachevskii + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class PulsarChannelBinding extends OperationBinding { + + /** + * The namespace the channel is associated with. + */ + @Nonnull + private String namespace; + + /** + * Persistence of the topic in Pulsar. It MUST be either persistent or non-persistent. + */ + @Nonnull + private String persistence; + + /** + * Topic compaction threshold given in Megabytes. + */ + @CheckForNull + private Integer compaction; + + /** + * A list of clusters the topic is replicated to. + */ + @CheckForNull + @JsonProperty("geo-replication") + private List geoReplication; + + /** + * Topic retention policy. + */ + @CheckForNull + private RetentionDefinition retention; + + /** + * Message time-to-live in seconds. + */ + @CheckForNull + private Integer ttl; + + /** + * Message deduplication. When true, it ensures that each message produced on Pulsar topics is persisted to disk only once. + */ + @CheckForNull + private Boolean deduplication; + + /** + * The version of this binding. If omitted, "latest" MUST be assumed. + */ + @CheckForNull + @Builder.Default + private String bindingVersion = "0.1.0"; + + /** + * The Retention Definition Object is used to describe the Pulsar Retention policy. + */ + @Data + @Builder + @NoArgsConstructor + @AllArgsConstructor + @EqualsAndHashCode + public static class RetentionDefinition { + + /** + * Time given in Minutes. + */ + @CheckForNull + @Builder.Default + private Integer time = 0; + + /** + * Size given in MegaBytes. + */ + @CheckForNull + @Builder.Default + private Integer size = 0; + + } + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/redis/RedisChannelBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/redis/RedisChannelBinding.java new file mode 100644 index 00000000..a90f8332 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/redis/RedisChannelBinding.java @@ -0,0 +1,21 @@ +package com.asyncapi.v2._6_0.binding.channel.redis; + +import com.asyncapi.v2.binding.ChannelBinding; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +/** + * This class MUST NOT contain any properties. Its name is reserved for future use. + *

+ * Describes Redis channel binding. + * + * @version 0.1.0 + * @see Redis channel binding + * @author Pavel Bodiachevskii + */ +@Data +@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class RedisChannelBinding extends ChannelBinding { +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/sns/SNSChannelBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/sns/SNSChannelBinding.java new file mode 100644 index 00000000..86d2a205 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/sns/SNSChannelBinding.java @@ -0,0 +1,21 @@ +package com.asyncapi.v2._6_0.binding.channel.sns; + +import com.asyncapi.v2.binding.ChannelBinding; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +/** + * This class MUST NOT contain any properties. Its name is reserved for future use. + *

+ * Describes SNS channel binding. + * + * @version 0.1.0 + * @see SNS channel binding + * @author Pavel Bodiachevskii + */ +@Data +@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class SNSChannelBinding extends ChannelBinding { +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/solace/SolaceChannelBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/solace/SolaceChannelBinding.java new file mode 100644 index 00000000..55a6dfae --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/solace/SolaceChannelBinding.java @@ -0,0 +1,20 @@ +package com.asyncapi.v2._6_0.binding.channel.solace; + +import com.asyncapi.v2._6_0.binding.channel.ChannelBinding; +import lombok.*; + +/** + * This class MUST NOT contain any properties. Its name is reserved for future use. + *

+ * Describes Solace channel binding. + * + * @version 0.3.0 + * @see Solace channel binding + * @author Pavel Bodiachevskii + */ +@Data +@Builder +@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class SolaceChannelBinding extends ChannelBinding { +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/sqs/SQSChannelBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/sqs/SQSChannelBinding.java new file mode 100644 index 00000000..4f5f6356 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/sqs/SQSChannelBinding.java @@ -0,0 +1,21 @@ +package com.asyncapi.v2._6_0.binding.channel.sqs; + +import com.asyncapi.v2.binding.ChannelBinding; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +/** + * This class MUST NOT contain any properties. Its name is reserved for future use. + *

+ * Describes SQS channel binding. + * + * @version 0.1.0 + * @see SQS channel binding + * @author Pavel Bodiachevskii + */ +@Data +@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class SQSChannelBinding extends ChannelBinding { +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/stomp/STOMPChannelBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/stomp/STOMPChannelBinding.java new file mode 100644 index 00000000..13a28d2e --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/stomp/STOMPChannelBinding.java @@ -0,0 +1,21 @@ +package com.asyncapi.v2._6_0.binding.channel.stomp; + +import com.asyncapi.v2.binding.ChannelBinding; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +/** + * This class MUST NOT contain any properties. Its name is reserved for future use. + * + * Describes STOMP channel binding. + * + * @version 0.1.0 + * @see STOMP channel binding + * @author Pavel Bodiachevskii + */ +@Data +@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class STOMPChannelBinding extends ChannelBinding { +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/ws/WebSocketsChannelBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/ws/WebSocketsChannelBinding.java new file mode 100644 index 00000000..cbe403f2 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/channel/ws/WebSocketsChannelBinding.java @@ -0,0 +1,61 @@ +package com.asyncapi.v2._6_0.binding.channel.ws; + +import com.asyncapi.v2._6_0.binding.channel.ChannelBinding; +import lombok.*; + +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + +/** + * Describes WebSockets channel binding. + *

+ * When using WebSockets, the channel represents the connection. Unlike other protocols that support multiple virtual + * channels (topics, routing keys, etc.) per connection, WebSockets doesn't support virtual channels or, put it another + * way, there's only one channel and its characteristics are strongly related to the protocol used for the handshake, + * i.e., HTTP. + * + * @version 0.1.0 + * @see WebSockets channel binding + * @author Pavel Bodiachevskii + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class WebSocketsChannelBinding extends ChannelBinding { + + /** + * The HTTP method to use when establishing the connection. Its value MUST be either GET or POST. + */ + @CheckForNull + private String method; + + /** + * TODO: Schema object + * A Schema object containing the definitions for each query parameter. This schema MUST be of type + * object and have a properties key. + * + * @see Schema object + */ + @CheckForNull + private Object query; + + /** + * TODO: Schema object + * A Schema object containing the definitions of the HTTP headers to use when establishing the connection. + * This schema MUST be of type object and have a properties key. + * + * @see Schema object + */ + @CheckForNull + private Object headers; + + /** + * The version of this binding. If omitted, "latest" MUST be assumed. + */ + @CheckForNull + @Builder.Default + private String bindingVersion = "0.1.0"; + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/MessageBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/MessageBinding.java new file mode 100644 index 00000000..74d91934 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/MessageBinding.java @@ -0,0 +1,12 @@ +package com.asyncapi.v2._6_0.binding.message; + +import lombok.EqualsAndHashCode; + +/** + * Describes AsyncAPI message binding. + * + * @author Pavel Bodiachevskii + */ +@EqualsAndHashCode +public class MessageBinding { +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/amqp/AMQPMessageBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/amqp/AMQPMessageBinding.java new file mode 100644 index 00000000..ddaf07b2 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/amqp/AMQPMessageBinding.java @@ -0,0 +1,43 @@ +package com.asyncapi.v2._6_0.binding.message.amqp; + +import com.asyncapi.v2._6_0.binding.message.MessageBinding; +import lombok.*; + +import javax.annotation.CheckForNull; + +/** + * Describes AMQP 0-9-1 message binding. + *

+ * Contains information about the message representation in AMQP. + * + * @version 0.2.0 + * @see AMQP message binding + * @author Pavel Bodiachevskii + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class AMQPMessageBinding extends MessageBinding { + + /** + * A MIME encoding for the message content. + */ + @CheckForNull + private String contentEncoding; + + /** + * Application-specific message type. + */ + @CheckForNull + private String messageType; + + /** + * The version of this binding. If omitted, "latest" MUST be assumed. + */ + @CheckForNull + @Builder.Default + private String bindingVersion = "0.2.0"; + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/amqp1/AMQP1MessageBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/amqp1/AMQP1MessageBinding.java new file mode 100644 index 00000000..085bb78f --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/amqp1/AMQP1MessageBinding.java @@ -0,0 +1,21 @@ +package com.asyncapi.v2._6_0.binding.message.amqp1; + +import com.asyncapi.v2.binding.MessageBinding; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +/** + * This class MUST NOT contain any properties. Its name is reserved for future use. + * + * Describes AMQP 1.0 message binding. + * + * @version 0.1.0 + * @see AMQP message binding + * @author Pavel Bodiachevskii + */ +@Data +@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class AMQP1MessageBinding extends MessageBinding { +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/anypointmq/AnypointMQMessageBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/anypointmq/AnypointMQMessageBinding.java new file mode 100644 index 00000000..89aeb10c --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/anypointmq/AnypointMQMessageBinding.java @@ -0,0 +1,39 @@ +package com.asyncapi.v2._6_0.binding.message.anypointmq; + +import com.asyncapi.v2._6_0.binding.channel.ChannelBinding; +import lombok.*; + +import javax.annotation.CheckForNull; + +/** + * Describes Anypoint MQ message binding. + * + * @version 0.0.1 + * @see Anypoint MQ channel binding + * @author Pavel Bodiachevskii + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class AnypointMQMessageBinding extends ChannelBinding { + + /** + * OPTIONAL. + *

+ * A Schema object containing the definitions for Anypoint MQ-specific headers (so-called protocol headers). + * This schema MUST be of type object and have a properties key. Examples of Anypoint MQ protocol headers are + * messageId and messageGroupId. + */ + @CheckForNull + private Object headers; + + /** + * OPTIONAL, defaults to latest. The version of this binding. + */ + @CheckForNull + @Builder.Default + private String bindingVersion = "0.0.1"; + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/googlepubsub/GooglePubSubMessageBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/googlepubsub/GooglePubSubMessageBinding.java new file mode 100644 index 00000000..45dccf30 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/googlepubsub/GooglePubSubMessageBinding.java @@ -0,0 +1,78 @@ +package com.asyncapi.v2._6_0.binding.message.googlepubsub; + +import com.asyncapi.v2._6_0.binding.message.MessageBinding; +import lombok.*; + +import javax.annotation.CheckForNull; + +/** + * The Message Binding Object is used to describe the Google Cloud Pub/Sub specific PubsubMessage details, alongside with + * pertintent parts of the Google Cloud Pub/Sub Schema Object, with AsyncAPI. + *

+ * Describes Google Cloud Pub/Sub message binding. + * + * @version 0.1.0 + * @see Google Cloud Pub/Sub operation binding + * @author Pavel Bodiachevskii + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class GooglePubSubMessageBinding extends MessageBinding { + + /** + * If non-empty, identifies related messages for which publish order should be respected (For more information, see ordering messages.) + */ + @CheckForNull + private String orderingKey; + + /** + * Attributes for this message (If this field is empty, the message must contain non-empty data. This can be used to + * filter messages on the subscription.) + */ + @CheckForNull + private Object attributes; + + /** + * Describes the schema used to validate the payload of this message + */ + @CheckForNull + private SchemaDefinition schema; + + /** + * OPTIONAL, defaults to latest. The version of this binding. + */ + @CheckForNull + @Builder.Default + private String bindingVersion = "0.1.0"; + + /** + * The Schema Definition Object is used to describe the Google Cloud Pub/Sub Schema Object with AsyncAPI. + * While some of this information could be, or is, described using native AsyncAPI, for consistency it makes sense to + * provide this information here at all times, especially for cases where AsyncAPI does not natively support describing + * payloads using a supported Google Cloud Pub/Sub schema format like Protobuf. + */ + @Data + @Builder + @NoArgsConstructor + @AllArgsConstructor + @EqualsAndHashCode + public static class SchemaDefinition { + + /** + * The name of the schema + */ + @CheckForNull + private String name; + + /** + * The type of the schema + */ + @CheckForNull + private String type; + + } + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/http/HTTPMessageBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/http/HTTPMessageBinding.java new file mode 100644 index 00000000..9b2822a0 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/http/HTTPMessageBinding.java @@ -0,0 +1,40 @@ +package com.asyncapi.v2._6_0.binding.message.http; + +import com.asyncapi.v2.binding.MessageBinding; +import lombok.*; + +import javax.annotation.CheckForNull; + +/** + * Describes HTTP message binding. + *

+ * Contains information about the message representation in HTTP. + * + * @version 0.1.0 + * @see HTTP message binding + * @author Pavel Bodiachevskii + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class HTTPMessageBinding extends MessageBinding { + + /** + * A Schema object containing the definitions for each query parameter. This schema MUST be of type object + * and have a properties key. + * + * @see Schema object + */ + @CheckForNull + private Object headers; + + /** + * The version of this binding. If omitted, "latest" MUST be assumed. + */ + @CheckForNull + @Builder.Default + private String bindingVersion = "0.1.0"; + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/ibmmq/IBMMQMessageBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/ibmmq/IBMMQMessageBinding.java new file mode 100644 index 00000000..eb667134 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/ibmmq/IBMMQMessageBinding.java @@ -0,0 +1,70 @@ +package com.asyncapi.v2._6_0.binding.message.ibmmq; + +import com.asyncapi.v2._6_0.binding.message.MessageBinding; +import lombok.*; + +import javax.annotation.CheckForNull; + +/** + * Describes IBM MQ message binding. + *

+ * This object contains information about the message representation in IBM MQ. + * + * @version 0.1.0 + * @see IBM MQ server binding + * @author Pavel Bodiachevskii + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class IBMMQMessageBinding extends MessageBinding { + + /** + * The type of the message. + *

+ * MUST be either string, jms or binary + */ + @CheckForNull + private String type; + + /** + * Defines the IBM MQ message headers to include with this message. More than one header can be specified as a comma + * separated list. Supporting information on IBM MQ message formats can be found on this page in the IBM MQ Knowledge Center. + *

+ * OPTIONAL if type = binary + *

+ * headers MUST NOT be specified if type = string or jms + */ + @CheckForNull + private String headers; + + /** + * Provides additional information for application developers: describes the message type or format. + *

+ * The description field of the IBM MQ message binding object MAY include CommonMark markdown formatting. + * A minimum markdown syntax as described by CommonMark 0.27 is assumed. + */ + @CheckForNull + private String description; + + /** + * The recommended setting the client should use for the TTL (Time-To-Live) of the message. + * This is a period of time expressed in milliseconds and set by the application that puts the message. + * expiry values are API dependant e.g., MQI and JMS use different units of time and default values for unlimited. + * General information on IBM MQ message expiry can be found on this page in the IBM MQ Knowledge Center. + *

+ * expiry value MUST be either zero (unlimited) or greater than zero. + */ + @CheckForNull + private Integer expiry; + + /** + * The version of this binding. + */ + @CheckForNull + @Builder.Default + private String bindingVersion = "0.1.0"; + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/jms/JMSMessageBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/jms/JMSMessageBinding.java new file mode 100644 index 00000000..cdd4a5ff --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/jms/JMSMessageBinding.java @@ -0,0 +1,21 @@ +package com.asyncapi.v2._6_0.binding.message.jms; + +import com.asyncapi.v2.binding.MessageBinding; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +/** + * This class MUST NOT contain any properties. Its name is reserved for future use. + * + * Describes JMS message binding. + * + * @version 0.1.0 + * @see JMS message binding + * @author Pavel Bodiachevskii + */ +@Data +@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class JMSMessageBinding extends MessageBinding { +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/kafka/KafkaMessageBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/kafka/KafkaMessageBinding.java new file mode 100644 index 00000000..6d5c68ce --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/kafka/KafkaMessageBinding.java @@ -0,0 +1,59 @@ +package com.asyncapi.v2._6_0.binding.message.kafka; + +import com.asyncapi.v2.binding.MessageBinding; +import lombok.*; + +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + +/** + * Describes Kafka message binding. + * + * Contains information about the message representation in Kafka. + * + * @version 0.1.0 + * @see Kafka message binding + * @author Pavel Bodiachevskii + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class KafkaMessageBinding extends MessageBinding { + + /** + * TODO: Avro Schema + * The message key. + * + * @see Schema object + */ + @CheckForNull + private Object key; + + /** + * If a Schema Registry is used when performing this operation, tells where the id of schema is stored (e.g. header or payload). + */ + @CheckForNull + private String schemaIdLocation; + + /** + * Number of bytes or vendor specific values when schema id is encoded in payload (e.g confluent/ apicurio-legacy / apicurio-new). + */ + @CheckForNull + private String schemaIdPayloadEncoding; + + /** + * Freeform string for any naming strategy class to use. Clients should default to the vendor default if not supplied. + */ + @CheckForNull + private String schemaLookupStrategy; + + /** + * The version of this binding. If omitted, "latest" MUST be assumed. + */ + @CheckForNull + @Builder.Default + private String bindingVersion = "0.4.0"; + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/mercure/MercureMessageBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/mercure/MercureMessageBinding.java new file mode 100644 index 00000000..479eced2 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/mercure/MercureMessageBinding.java @@ -0,0 +1,21 @@ +package com.asyncapi.v2._6_0.binding.message.mercure; + +import com.asyncapi.v2._6_0.binding.message.MessageBinding; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +/** + * This class MUST NOT contain any properties. Its name is reserved for future use. + *

+ * Describes Mercure message binding. + * + * @version 0.1.0 + * @see Mercure message binding + * @author Pavel Bodiachevskii + */ +@Data +@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class MercureMessageBinding extends MessageBinding { +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/mqtt/MQTTMessageBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/mqtt/MQTTMessageBinding.java new file mode 100644 index 00000000..b12665e1 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/mqtt/MQTTMessageBinding.java @@ -0,0 +1,32 @@ +package com.asyncapi.v2._6_0.binding.message.mqtt; + +import com.asyncapi.v2.binding.MessageBinding; +import lombok.*; + +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + +/** + * Describes MQTT message binding. + *

+ * Contains information about the message representation in MQTT. + * + * @version 0.1.0 + * @see MQTT message binding + * @author Pavel Bodiachevskii + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class MQTTMessageBinding extends MessageBinding { + + /** + * The version of this binding. If omitted, "latest" MUST be assumed. + */ + @CheckForNull + @Builder.Default + private String bindingVersion = "0.1.0"; + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/mqtt5/MQTT5MessageBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/mqtt5/MQTT5MessageBinding.java new file mode 100644 index 00000000..ef9ba3c2 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/mqtt5/MQTT5MessageBinding.java @@ -0,0 +1,21 @@ +package com.asyncapi.v2._6_0.binding.message.mqtt5; + +import com.asyncapi.v2.binding.MessageBinding; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +/** + * This class MUST NOT contain any properties. Its name is reserved for future use. + *

+ * Describes MQTT 5 message binding. + * + * @version 0.2.0 + * @see MQTT 5 message binding + * @author Pavel Bodiachevskii + */ +@Data +@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class MQTT5MessageBinding extends MessageBinding { +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/nats/NATSMessageBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/nats/NATSMessageBinding.java new file mode 100644 index 00000000..6c5c1555 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/nats/NATSMessageBinding.java @@ -0,0 +1,21 @@ +package com.asyncapi.v2._6_0.binding.message.nats; + +import com.asyncapi.v2.binding.MessageBinding; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +/** + * This class MUST NOT contain any properties. Its name is reserved for future use. + *

+ * Describes NATS message binding. + * + * @version 0.1.0 + * @see NATS message binding + * @author Pavel Bodiachevskii + */ +@Data +@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class NATSMessageBinding extends MessageBinding { +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/pulsar/PulsarMessageBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/pulsar/PulsarMessageBinding.java new file mode 100644 index 00000000..144b866e --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/pulsar/PulsarMessageBinding.java @@ -0,0 +1,20 @@ +package com.asyncapi.v2._6_0.binding.message.pulsar; + +import com.asyncapi.v2._6_0.binding.operation.OperationBinding; +import lombok.*; + +/** + * Describes Pulsar message binding. + *

+ * This object MUST NOT contain any properties. Its name is reserved for future use. + * + * @version 0.1.0 + * @see Pulsar message binding + * @author Pavel Bodiachevskii + */ +@Data +@Builder +@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class PulsarMessageBinding extends OperationBinding { +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/redis/RedisMessageBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/redis/RedisMessageBinding.java new file mode 100644 index 00000000..b11b3605 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/redis/RedisMessageBinding.java @@ -0,0 +1,21 @@ +package com.asyncapi.v2._6_0.binding.message.redis; + +import com.asyncapi.v2.binding.MessageBinding; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +/** + * This class MUST NOT contain any properties. Its name is reserved for future use. + *

+ * Describes Redis message binding. + * + * @version 0.1.0 + * @see Redis message binding + * @author Pavel Bodiachevskii + */ +@Data +@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class RedisMessageBinding extends MessageBinding { +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/sns/SNSMessageBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/sns/SNSMessageBinding.java new file mode 100644 index 00000000..ec51c9d0 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/sns/SNSMessageBinding.java @@ -0,0 +1,21 @@ +package com.asyncapi.v2._6_0.binding.message.sns; + +import com.asyncapi.v2.binding.MessageBinding; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +/** + * This class MUST NOT contain any properties. Its name is reserved for future use. + *

+ * Describes SNS message binding. + * + * @version 0.1.0 + * @see SNS message binding + * @author Pavel Bodiachevskii + */ +@Data +@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class SNSMessageBinding extends MessageBinding { +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/solace/SolaceMessageBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/solace/SolaceMessageBinding.java new file mode 100644 index 00000000..01c9fb87 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/solace/SolaceMessageBinding.java @@ -0,0 +1,20 @@ +package com.asyncapi.v2._6_0.binding.message.solace; + +import com.asyncapi.v2._6_0.binding.message.MessageBinding; +import lombok.*; + +/** + * This class MUST NOT contain any properties. Its name is reserved for future use. + *

+ * Describes Solace message binding. + * + * @version 0.3.0 + * @see Solace message binding + * @author Pavel Bodiachevskii + */ +@Data +@Builder +@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class SolaceMessageBinding extends MessageBinding { +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/sqs/SQSMessageBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/sqs/SQSMessageBinding.java new file mode 100644 index 00000000..3a08b503 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/sqs/SQSMessageBinding.java @@ -0,0 +1,21 @@ +package com.asyncapi.v2._6_0.binding.message.sqs; + +import com.asyncapi.v2.binding.MessageBinding; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +/** + * This class MUST NOT contain any properties. Its name is reserved for future use. + *

+ * Describes SQS message binding. + * + * @version 0.1.0 + * @see SQS message binding + * @author Pavel Bodiachevskii + */ +@Data +@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class SQSMessageBinding extends MessageBinding { +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/stomp/STOMPMessageBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/stomp/STOMPMessageBinding.java new file mode 100644 index 00000000..55925820 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/stomp/STOMPMessageBinding.java @@ -0,0 +1,21 @@ +package com.asyncapi.v2._6_0.binding.message.stomp; + +import com.asyncapi.v2.binding.MessageBinding; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +/** + * This class MUST NOT contain any properties. Its name is reserved for future use. + *

+ * Describes STOMP message binding. + * + * @version 0.1.0 + * @see STOMP message binding + * @author Pavel Bodiachevskii + */ +@Data +@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class STOMPMessageBinding extends MessageBinding { +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/ws/WebSocketsMessageBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/ws/WebSocketsMessageBinding.java new file mode 100644 index 00000000..1f5a1bda --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/message/ws/WebSocketsMessageBinding.java @@ -0,0 +1,21 @@ +package com.asyncapi.v2._6_0.binding.message.ws; + +import com.asyncapi.v2.binding.MessageBinding; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +/** + * This class MUST NOT contain any properties. Its name is reserved for future use. + * + * Describes WebSockets message binding. + * + * @version 0.1.0 + * @see WebSockets message binding + * @author Pavel Bodiachevskii + */ +@Data +@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class WebSocketsMessageBinding extends MessageBinding { +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/OperationBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/OperationBinding.java new file mode 100644 index 00000000..b8f0fdb8 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/OperationBinding.java @@ -0,0 +1,12 @@ +package com.asyncapi.v2._6_0.binding.operation; + +import lombok.EqualsAndHashCode; + +/** + * Describes AsyncAPI operation binding. + * + * @author Pavel Bodiachevskii + */ +@EqualsAndHashCode +public class OperationBinding { +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/amqp/AMQPOperationBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/amqp/AMQPOperationBinding.java new file mode 100644 index 00000000..6131eef6 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/amqp/AMQPOperationBinding.java @@ -0,0 +1,111 @@ +package com.asyncapi.v2._6_0.binding.operation.amqp; + +import com.asyncapi.v2.binding.OperationBinding; +import lombok.*; + +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; +import java.util.List; + +/** + * Describes AMQP 0-9-1 operation binding. + *

+ * Contains information about the operation representation in AMQP. + * + * @version 0.2.0 + * @see AMQP operation binding + * @author Pavel Bodiachevskii + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class AMQPOperationBinding extends OperationBinding { + + /** + * TTL (Time-To-Live) for the message. It MUST be greater than or equal to zero. + */ + @CheckForNull + private Integer expiration; + + /** + * Identifies the user who has sent the message. + *

+ * Applies to: publish, subscribe + */ + @CheckForNull + private String userId; + + /** + * The routing keys the message should be routed to at the time of publishing. + *

+ * Applies to: publish, subscribe + */ + @CheckForNull + private List cc; + + /** + * A priority for the message. + *

+ * Applies to: publish, subscribe + */ + @CheckForNull + private Integer priority; + + /** + * Delivery mode of the message. Its value MUST be either 1 (transient) or 2 (persistent). + *

+ * Applies to: publish, subscribe + */ + @CheckForNull + private Integer deliveryMode; + + /** + * Whether the message is mandatory or not. + *

+ * Applies to: publish + */ + @CheckForNull + private Boolean mandatory; + + /** + * Like {@link #cc} but consumers will not receive this information. + *

+ * Applies to: publish + */ + @CheckForNull + private List bcc; + + /** + * Name of the queue where the consumer should send the response. + *

+ * Applies to: publish, subscribe + */ + @CheckForNull + private String replyTo; + + /** + * Whether the message should include a timestamp or not. + *

+ * Applies to: publish, subscribe + */ + @CheckForNull + private Boolean timestamp; + + /** + * Whether the consumer should ack the message or not. + *

+ * Applies to: subscribe + */ + @CheckForNull + private Boolean ack; + + /** + * The version of this binding. If omitted, "latest" MUST be assumed. + */ + @CheckForNull + @Builder.Default + private String bindingVersion = "0.2.0"; + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/amqp1/AMQP1OperationBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/amqp1/AMQP1OperationBinding.java new file mode 100644 index 00000000..ced6ad5f --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/amqp1/AMQP1OperationBinding.java @@ -0,0 +1,21 @@ +package com.asyncapi.v2._6_0.binding.operation.amqp1; + +import com.asyncapi.v2.binding.OperationBinding; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +/** + * This class MUST NOT contain any properties. Its name is reserved for future use. + * + * Describes AMQP 1.0 operation binding. + * + * @version 0.1.0 + * @see AMQP operation binding + * @author Pavel Bodiachevskii + */ +@Data +@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class AMQP1OperationBinding extends OperationBinding { +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/anypointmq/AnypointMQOperationBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/anypointmq/AnypointMQOperationBinding.java new file mode 100644 index 00000000..96282a41 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/anypointmq/AnypointMQOperationBinding.java @@ -0,0 +1,21 @@ +package com.asyncapi.v2._6_0.binding.operation.anypointmq; + +import com.asyncapi.v2._6_0.binding.server.ServerBinding; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +/** + * This class MUST NOT contain any properties. Its name is reserved for future use. + *

+ * Describes Anypoint MQ operation binding. + * + * @version 0.0.1 + * @see HTTP server binding + * @author Pavel Bodiachevskii + */ +@Data +@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class AnypointMQOperationBinding extends ServerBinding { +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/googlepubsub/GooglePubSubOperationBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/googlepubsub/GooglePubSubOperationBinding.java new file mode 100644 index 00000000..93238e28 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/googlepubsub/GooglePubSubOperationBinding.java @@ -0,0 +1,21 @@ +package com.asyncapi.v2._6_0.binding.operation.googlepubsub; + +import com.asyncapi.v2._6_0.binding.operation.OperationBinding; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +/** + * This class MUST NOT contain any properties. Its name is reserved for future use. + *

+ * Describes Google Cloud Pub/Sub operation binding. + * + * @version 0.1.0 + * @see Google Cloud Pub/Sub operation binding + * @author Pavel Bodiachevskii + */ +@Data +@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class GooglePubSubOperationBinding extends OperationBinding { +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/http/HTTPOperationBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/http/HTTPOperationBinding.java new file mode 100644 index 00000000..a1df895f --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/http/HTTPOperationBinding.java @@ -0,0 +1,57 @@ +package com.asyncapi.v2._6_0.binding.operation.http; + +import com.asyncapi.v2.binding.OperationBinding; +import lombok.*; + +import javax.annotation.CheckForNull; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** + * Describes HTTP operation binding. + *

+ * Contains information about the operation representation in HTTP. + * + * @version 0.1.0 + * @see HTTP operation binding + * @author Pavel Bodiachevskii + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class HTTPOperationBinding extends OperationBinding { + + /** + * Required. + *

+ * Type of operation. Its value MUST be either request or response. + */ + @Nonnull + private String type; + + /** + * When type is request, this is the HTTP method, otherwise it MUST be ignored. Its value MUST be one of + * GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS, CONNECT, and TRACE. + */ + @CheckForNull + private String method; + + /** + * A Schema object containing the definitions for each query parameter. This schema MUST be of type object + * and have a properties key. + * + * @see Schema object + */ + @CheckForNull + private Object query; + + /** + * The version of this binding. If omitted, "latest" MUST be assumed. + */ + @CheckForNull + @Builder.Default + private String bindingVersion = "0.1.0"; + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/ibmmq/IBMMQOperationBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/ibmmq/IBMMQOperationBinding.java new file mode 100644 index 00000000..38cb0278 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/ibmmq/IBMMQOperationBinding.java @@ -0,0 +1,20 @@ +package com.asyncapi.v2._6_0.binding.operation.ibmmq; + +import com.asyncapi.v2._6_0.binding.operation.OperationBinding; +import lombok.*; + +/** + * Describes IBM MQ operation binding. + *

+ * This object MUST NOT contain any properties. Its name is reserved for future use. + * + * @version 0.1.0 + * @see Redis server binding + * @author Pavel Bodiachevskii + */ +@Data +@Builder +@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class IBMMQOperationBinding extends OperationBinding { +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/jms/JMSOperationBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/jms/JMSOperationBinding.java new file mode 100644 index 00000000..08b94e06 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/jms/JMSOperationBinding.java @@ -0,0 +1,21 @@ +package com.asyncapi.v2._6_0.binding.operation.jms; + +import com.asyncapi.v2.binding.OperationBinding; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +/** + * This class MUST NOT contain any properties. Its name is reserved for future use. + *

+ * Describes JMS operation binding. + * + * @version 0.1.0 + * @see JMS operation binding + * @author Pavel Bodiachevskii + */ +@Data +@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class JMSOperationBinding extends OperationBinding { +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/kafka/KafkaOperationBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/kafka/KafkaOperationBinding.java new file mode 100644 index 00000000..57ce0b69 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/kafka/KafkaOperationBinding.java @@ -0,0 +1,50 @@ +package com.asyncapi.v2._6_0.binding.operation.kafka; + +import com.asyncapi.v2.binding.OperationBinding; +import lombok.*; + +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + +/** + * Describes Kafka operation binding. + * + * Contains information about the operation representation in Kafka. + * + * @version 0.1.0 + * @see Kafka operation binding + * @author Pavel Bodiachevskii + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class KafkaOperationBinding extends OperationBinding { + + /** + * TODO: Schema + * Id of the consumer group. + * + * @see Schema object + */ + @CheckForNull + private Object groupId; + + /** + * TODO: Schema + * Id of the consumer inside a consumer group. + * + * @see Schema object + */ + @CheckForNull + private Object clientId; + + /** + * The version of this binding. If omitted, "latest" MUST be assumed. + */ + @CheckForNull + @Builder.Default + private String bindingVersion = "0.4.0"; + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/mercure/MercureOperationBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/mercure/MercureOperationBinding.java new file mode 100644 index 00000000..208a2b9b --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/mercure/MercureOperationBinding.java @@ -0,0 +1,21 @@ +package com.asyncapi.v2._6_0.binding.operation.mercure; + +import com.asyncapi.v2._6_0.binding.operation.OperationBinding; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +/** + * This class MUST NOT contain any properties. Its name is reserved for future use. + *

+ * Describes Mercure operation binding. + * + * @version 0.1.0 + * @see Mercure operation binding + * @author Pavel Bodiachevskii + */ +@Data +@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class MercureOperationBinding extends OperationBinding { +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/mqtt/MQTTOperationBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/mqtt/MQTTOperationBinding.java new file mode 100644 index 00000000..9fe16c8d --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/mqtt/MQTTOperationBinding.java @@ -0,0 +1,51 @@ +package com.asyncapi.v2._6_0.binding.operation.mqtt; + +import com.asyncapi.v2.binding.OperationBinding; +import lombok.*; + +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + +/** + * Describes MQTT operation binding. + * + * Contains information about the operation representation in MQTT. + * + * @version 0.1.0 + * @see MQTT operation binding + * @author Pavel Bodiachevskii + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class MQTTOperationBinding extends OperationBinding { + + /** + * Defines how hard the broker/client will try to ensure that a message is received. + * Its value MUST be either 0, 1 or 2. + *

+ * Applies to: publish, subscribe + */ + @CheckForNull + private Integer qos; + + /** + * Whether the broker should retain the message or not. + *

+ * Applies to: publish, subscribe + */ + @CheckForNull + private Boolean retain; + + /** + * The version of this binding. If omitted, "latest" MUST be assumed. + *

+ * Applies to: publish, subscribe + */ + @CheckForNull + @Builder.Default + private String bindingVersion = "0.1.0"; + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/mqtt5/MQTT5OperationBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/mqtt5/MQTT5OperationBinding.java new file mode 100644 index 00000000..622dd69b --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/mqtt5/MQTT5OperationBinding.java @@ -0,0 +1,21 @@ +package com.asyncapi.v2._6_0.binding.operation.mqtt5; + +import com.asyncapi.v2.binding.OperationBinding; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +/** + * This class MUST NOT contain any properties. Its name is reserved for future use. + *

+ * Describes MQTT 5 operation binding. + * + * @version 0.2.0 + * @see MQTT 5 operation binding + * @author Pavel Bodiachevskii + */ +@Data +@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class MQTT5OperationBinding extends OperationBinding { +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/nats/NATSOperationBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/nats/NATSOperationBinding.java new file mode 100644 index 00000000..f81d2646 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/nats/NATSOperationBinding.java @@ -0,0 +1,37 @@ +package com.asyncapi.v2._6_0.binding.operation.nats; + +import com.asyncapi.v2.binding.OperationBinding; +import lombok.*; + +import javax.annotation.CheckForNull; + +/** + * This class MUST NOT contain any properties. Its name is reserved for future use. + *

+ * Describes NATS operation binding. + * + * @version 0.1.0 + * @see NATS operation binding + * @author Pavel Bodiachevskii + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class NATSOperationBinding extends OperationBinding { + + /** + * Defines the name of the queue to use. It MUST NOT exceed 255 characters. + */ + @CheckForNull + private String queue; + + /** + * The version of this binding. If omitted, "latest" MUST be assumed. + */ + @CheckForNull + @Builder.Default + private String bindingVersion = "0.1.0"; + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/pulsar/PulsarOperationBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/pulsar/PulsarOperationBinding.java new file mode 100644 index 00000000..26c36917 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/pulsar/PulsarOperationBinding.java @@ -0,0 +1,23 @@ +package com.asyncapi.v2._6_0.binding.operation.pulsar; + +import com.asyncapi.v2._6_0.binding.operation.OperationBinding; +import com.asyncapi.v2._6_0.binding.server.ServerBinding; +import lombok.*; + +import javax.annotation.CheckForNull; + +/** + * Describes Pulsar server binding. + *

+ * This object MUST NOT contain any properties. Its name is reserved for future use. + * + * @version 0.1.0 + * @see Redis server binding + * @author Pavel Bodiachevskii + */ +@Data +@Builder +@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class PulsarOperationBinding extends OperationBinding { +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/redis/RedisOperationBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/redis/RedisOperationBinding.java new file mode 100644 index 00000000..3f701170 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/redis/RedisOperationBinding.java @@ -0,0 +1,21 @@ +package com.asyncapi.v2._6_0.binding.operation.redis; + +import com.asyncapi.v2.binding.OperationBinding; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +/** + * This class MUST NOT contain any properties. Its name is reserved for future use. + *

+ * Describes Redis operation binding. + * + * @version 0.1.0 + * @see Redis operation binding + * @author Pavel Bodiachevskii + */ +@Data +@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class RedisOperationBinding extends OperationBinding { +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/sns/SNSOperationBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/sns/SNSOperationBinding.java new file mode 100644 index 00000000..60544261 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/sns/SNSOperationBinding.java @@ -0,0 +1,21 @@ +package com.asyncapi.v2._6_0.binding.operation.sns; + +import com.asyncapi.v2.binding.OperationBinding; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +/** + * This class MUST NOT contain any properties. Its name is reserved for future use. + *

+ * Describes SNS operation binding. + * + * @version 0.1.0 + * @see SNS operation binding + * @author Pavel Bodiachevskii + */ +@Data +@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class SNSOperationBinding extends OperationBinding { +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/solace/SolaceOperationBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/solace/SolaceOperationBinding.java new file mode 100644 index 00000000..5bcdb448 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/solace/SolaceOperationBinding.java @@ -0,0 +1,122 @@ +package com.asyncapi.v2._6_0.binding.operation.solace; + +import com.asyncapi.v2._6_0.binding.operation.OperationBinding; +import lombok.*; + +import javax.annotation.CheckForNull; +import java.util.List; + +/** + * This class MUST NOT contain any properties. Its name is reserved for future use. + *

+ * Describes Solace operation binding. + * + * @version 0.3.0 + * @see Solace operation binding + * @author Pavel Bodiachevskii + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class SolaceOperationBinding extends OperationBinding { + + @CheckForNull + private List destinations; + + /** + * The version of this binding. + */ + @CheckForNull + @Builder.Default + private String bindingVersion = "0.3.0"; + + @Data + @Builder + @NoArgsConstructor + @AllArgsConstructor + @EqualsAndHashCode + public static class Destination { + + /** + * 'queue' or 'topic'. If the type is queue, then the subscriber can bind to the queue, which in turn will + * subscribe to the topic as represented by the channel name or to the provided topicSubscriptions. + */ + @CheckForNull + private String destinationType; + + @CheckForNull + private Queue queue; + + @CheckForNull + private Topic topic; + + /** + * 'direct' or 'persistent'. This determines the quality of service for publishing messages as documented here. + * Default is 'persistent'. + */ + @CheckForNull + private String deliveryMode; + + @Data + @Builder + @NoArgsConstructor + @AllArgsConstructor + @EqualsAndHashCode + public static class Queue { + + /** + * The name of the queue, only applicable when destinationType is 'queue'. + */ + @CheckForNull + private String name; + + /** + * A list of topics that the queue subscribes to, only applicable when destinationType is 'queue'. + * If none is given, the queue subscribes to the topic as represented by the channel name. + */ + @CheckForNull + private List topicSubscriptions; + + /** + * 'exclusive' or 'nonexclusive'. This is documented here. Only applicable when destinationType is 'queue'. + */ + @CheckForNull + private String accessType; + + /** + * The maximum amount of message spool that the given queue may use. This is documented here. + * Only applicable when destinationType is 'queue'. + */ + @CheckForNull + private String maxMsgSpoolSize; + + /** + * The maximum TTL to apply to messages to be spooled. This is documented here. + * Only applicable when destinationType is 'queue'. + */ + @CheckForNull + private String maxTtl; + + } + + @Data + @Builder + @NoArgsConstructor + @AllArgsConstructor + @EqualsAndHashCode + public static class Topic { + + /** + * A list of topics that the client subscribes to, only applicable when destinationType is 'topic'. + * If none is given, the client subscribes to the topic as represented by the channel name. + */ + @CheckForNull + private List topicSubscriptions; + + } + + } + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/sqs/SQSOperationBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/sqs/SQSOperationBinding.java new file mode 100644 index 00000000..569b98e2 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/sqs/SQSOperationBinding.java @@ -0,0 +1,21 @@ +package com.asyncapi.v2._6_0.binding.operation.sqs; + +import com.asyncapi.v2.binding.OperationBinding; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +/** + * This class MUST NOT contain any properties. Its name is reserved for future use. + *

+ * Describes SQS operation binding. + * + * @version 0.1.0 + * @see SQS operation binding + * @author Pavel Bodiachevskii + */ +@Data +@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class SQSOperationBinding extends OperationBinding { +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/stomp/STOMPOperationBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/stomp/STOMPOperationBinding.java new file mode 100644 index 00000000..af52d880 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/stomp/STOMPOperationBinding.java @@ -0,0 +1,21 @@ +package com.asyncapi.v2._6_0.binding.operation.stomp; + +import com.asyncapi.v2.binding.OperationBinding; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +/** + * This class MUST NOT contain any properties. Its name is reserved for future use. + *

+ * Describes STOMP operation binding. + * + * @version 0.1.0 + * @see STOMP operation binding + * @author Pavel Bodiachevskii + */ +@Data +@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class STOMPOperationBinding extends OperationBinding { +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/ws/WebSocketsOperationBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/ws/WebSocketsOperationBinding.java new file mode 100644 index 00000000..09c53b5a --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/binding/operation/ws/WebSocketsOperationBinding.java @@ -0,0 +1,21 @@ +package com.asyncapi.v2._6_0.binding.operation.ws; + +import com.asyncapi.v2.binding.OperationBinding; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +/** + * This class MUST NOT contain any properties. Its name is reserved for future use. + * + * Describes WebSockets operation binding. + * + * @version 0.1.0 + * @see WebSockets operation binding + * @author Pavel Bodiachevskii + */ +@Data +@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class WebSocketsOperationBinding extends OperationBinding { +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/model/channel/ChannelItem.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/model/channel/ChannelItem.java new file mode 100644 index 00000000..cdecdb0a --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/model/channel/ChannelItem.java @@ -0,0 +1,91 @@ +package com.asyncapi.v2._6_0.model.channel; + +import com.asyncapi.v2.binding.ChannelBinding; +import com.asyncapi.v2.binding.ChannelBindingsDeserializer; +import com.asyncapi.v2.jackson.ChannelParametersDeserializer; +import com.asyncapi.v2.model.channel.Parameter; +import com.asyncapi.v2.model.channel.operation.Operation; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.annotation.CheckForNull; +import java.util.List; +import java.util.Map; + +/** + * Describes the operations available on a single channel. + * + * @version 2.6.0 + * @see ChannelItem + * @author Pavel Bodiachevskii + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ChannelItem { + + /** + * Allows for a referenced definition of this channel item. The referenced structure MUST be in the form of a {@link com.asyncapi.v2._6_0.model.channel.ChannelItem} Object. + * In case a Channel Item Object field appears both in the defined object and the referenced object, the behavior is undefined. + * Resolution is done as defined by the JSON Reference. + *

+ * Deprecated: Usage of the $ref property has been deprecated. + */ + @CheckForNull + @JsonProperty("$ref") + private String ref; + + /** + * An optional description of this channel item. CommonMark syntax can be used for rich text representation. + */ + @CheckForNull + private String description; + + /** + * The servers on which this channel is available, specified as an optional unordered list of names (string keys) of {@link com.asyncapi.v2._6_0.model.server.Server} Objects defined in the {@link com.asyncapi.v2._6_0.model.server.Server} Object (a map). + * If servers is absent or empty then this channel must be available on all servers defined in the Servers Object. + */ + @CheckForNull + private List servers; + + /** + * A definition of the SUBSCRIBE operation, which defines the messages produced by the application and sent to the channel. + */ + @CheckForNull + private Operation subscribe; + + /** + * A definition of the PUBLISH operation. + */ + @CheckForNull + private Operation publish; + + /** + * A map of the parameters included in the channel name. + * It SHOULD be present only when using channels with expressions (as defined by RFC 6570 section 2.2). + * + * This map MUST contain all the parameters used in the parent channel name. + * + * MUST BE: + *

+ */ + @CheckForNull + @JsonDeserialize(using = ChannelParametersDeserializer.class) + private Map parameters; + + /** + * A map where the keys describe the name of the protocol and the values describe protocol-specific definitions for the channel. + */ + @CheckForNull + @JsonDeserialize(using = ChannelBindingsDeserializer.class) + private Map bindings; + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/model/channel/operation/Operation.java b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/model/channel/operation/Operation.java new file mode 100644 index 00000000..ac3b2873 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/_6_0/model/channel/operation/Operation.java @@ -0,0 +1,122 @@ +package com.asyncapi.v2._6_0.model.channel.operation; + +import com.asyncapi.v2._6_0.model.ExternalDocumentation; +import com.asyncapi.v2._6_0.model.Tag; +import com.asyncapi.v2.binding.OperationBindingsDeserializer; +import com.asyncapi.v2.jackson.OperationMessageDeserializer; +import com.asyncapi.v2.jackson.OperationTraitsDeserializer; +import com.asyncapi.v2.model.channel.message.Message; +import com.asyncapi.v2.model.channel.operation.OperationTrait; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import lombok.*; + +import javax.annotation.CheckForNull; +import java.util.List; +import java.util.Map; + +/** + * Describes a publish or a subscribe operation. This provides a place to document how and why messages are sent and received. + *

+ * For example, an operation might describe a chat application use case where a user sends a text message to a group. + * A publish operation describes messages that are received by the chat application, whereas a subscribe operation describes messages that are sent by the chat application. + * + * @version 2.6.0 + * @see Operation + * @author Pavel Bodiachevskii + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode +public class Operation { + + /** + * Unique string used to identify the operation. + *

+ * The id MUST be unique among all operations described in the API. The operationId value is case-sensitive. + * Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is RECOMMENDED to + * follow common programming naming conventions. + */ + @CheckForNull + private String operationId; + + /** + * A short summary of what the operation is about. + */ + @CheckForNull + private String summary; + + /** + * A verbose explanation of the operation. CommonMark syntax can be used for rich text representation. + */ + @CheckForNull + private String description; + + /** + * A declaration of which security mechanisms are associated with this operation. Only one of the security + * requirement objects MUST be satisfied to authorize an operation. In cases where Server Security also applies, + * it MUST also be satisfied. + *

+ * Each name MUST correspond to a security scheme which is declared in the {@link com.asyncapi.v2._6_0.model.component.Components#getSecuritySchemes()} Security Schemes under the {@link com.asyncapi.v2._6_0.model.component.Components} Object. + * If the security scheme is of type "oauth2" or "openIdConnect", then the value is a list of scope names. + * Provide scopes that are required to establish successful connection with the server. + * If scopes are not needed, the list can be empty. For other security scheme types, the array MUST be empty. + */ + @CheckForNull + private List>> security; + + /** + * A list of tags for logical grouping and categorization of operations. + */ + @CheckForNull + private List tags; + + /** + * Additional external documentation for this operation. + */ + @CheckForNull + private ExternalDocumentation externalDocs; + + /** + * A map where the keys describe the name of the protocol and the values describe protocol-specific definitions for the operation. + *

+ * MUST BE: + *

    + *
  • {@link com.asyncapi.v2._6_0.model.Reference}
  • + *
  • {@link com.asyncapi.v2._6_0.binding.operation.OperationBinding}
  • + *
+ */ + @CheckForNull + @JsonDeserialize(using = OperationBindingsDeserializer.class) + private Map bindings; + + /** + * A list of traits to apply to the operation object. Traits MUST be merged into the operation object using the + * JSON Merge Patch algorithm in the same order they are defined here. + * + * MUST BE: + *
    + *
  • {@link com.asyncapi.v2.model.Reference}
  • + *
  • {@link OperationTrait}
  • + *
+ */ + @CheckForNull + @JsonDeserialize(using = OperationTraitsDeserializer.class) + private List traits; + + /** + * A definition of the message that will be published or received on this channel. oneOf is allowed here to + * specify multiple messages, however, a message MUST be valid only against one of the referenced message objects. + * + * MUST BE: + *
    + *
  • {@link com.asyncapi.v2.model.Reference}
  • + *
  • {@link Message}
  • + *
+ */ + @CheckForNull + @JsonDeserialize(using = OperationMessageDeserializer.class) + private Object message; + +} diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/channel/amqp/AMQPChannelBindingTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/channel/amqp/AMQPChannelBindingTest.kt new file mode 100644 index 00000000..0dcc276c --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/channel/amqp/AMQPChannelBindingTest.kt @@ -0,0 +1,48 @@ +package com.asyncapi.v2._6_0.binding.channel.amqp + +import com.asyncapi.v2.ClasspathUtils +import com.fasterxml.jackson.databind.ObjectMapper +import org.junit.jupiter.api.Assertions +import org.junit.jupiter.api.DisplayName +import org.junit.jupiter.api.Test + +/** + * @version 2.6.0 + * @author Pavel Bodiachevskii + */ +class AMQPChannelBindingTest { + + private val objectMapper = ObjectMapper() + + private fun build(): AMQPChannelBinding { + return AMQPChannelBinding.builder() + .`is`("routingKey") + .queue(AMQPChannelBinding.QueueProperties.builder() + .name("my-queue-name") + .durable(true) + .exclusive(true) + .autoDelete(false) + .build() + ) + .exchange(AMQPChannelBinding.ExchangeProperties.builder() + .name("myExchange") + .type("topic") + .durable(true) + .autoDelete(false) + .build() + ) + .build() + } + + @Test + @DisplayName("Compare hand crafted model with parsed json") + fun compareModelWithParsedJson() { + val model = ClasspathUtils.readAsString("/json/2.6.0/binding/channel/amqp/amqpChannelBinding.json") + + Assertions.assertEquals( + objectMapper.readValue(model, AMQPChannelBinding::class.java), + build() + ) + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/channel/anypointmq/AnypointMQChannelBindingTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/channel/anypointmq/AnypointMQChannelBindingTest.kt new file mode 100644 index 00000000..8e92557a --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/channel/anypointmq/AnypointMQChannelBindingTest.kt @@ -0,0 +1,35 @@ +package com.asyncapi.v2._6_0.binding.channel.anypointmq + +import com.asyncapi.v2.ClasspathUtils +import com.fasterxml.jackson.databind.ObjectMapper +import org.junit.jupiter.api.Assertions +import org.junit.jupiter.api.DisplayName +import org.junit.jupiter.api.Test + +/** + * @version 2.6.0 + * @author Pavel Bodiachevskii + */ +class AnypointMQChannelBindingTest { + + private val objectMapper = ObjectMapper() + + private fun build(): AnypointMQChannelBinding { + return AnypointMQChannelBinding.builder() + .destination("user-signup-exchg") + .destinationType("exchange") + .build() + } + + @Test + @DisplayName("Compare hand crafted model with parsed json") + fun compareModelWithParsedJson() { + val model = ClasspathUtils.readAsString("/json/2.6.0/binding/channel/anypoint/anypointMQChannelBinding.json") + + Assertions.assertEquals( + objectMapper.readValue(model, AnypointMQChannelBinding::class.java), + build() + ) + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/channel/googlepubsub/GooglePubSubChannelBindingTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/channel/googlepubsub/GooglePubSubChannelBindingTest.kt new file mode 100644 index 00000000..3c37d22d --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/channel/googlepubsub/GooglePubSubChannelBindingTest.kt @@ -0,0 +1,51 @@ +package com.asyncapi.v2._6_0.binding.channel.googlepubsub + +import com.asyncapi.v2.ClasspathUtils +import com.fasterxml.jackson.databind.ObjectMapper +import org.junit.jupiter.api.Assertions +import org.junit.jupiter.api.DisplayName +import org.junit.jupiter.api.Test + +class GooglePubSubChannelBindingTest { + + private val objectMapper = ObjectMapper() + + private fun build(): GooglePubSubChannelBinding { + return GooglePubSubChannelBinding.builder() + .topic("projects/your-project/topics/topic-proto-schema") + .messageRetentionDuration("86400s") + .messageStoragePolicy(GooglePubSubChannelBinding.MessageStoragePolicy( + listOf( + "us-central1", + "us-central2", + "us-east1", + "us-east4", + "us-east5", + "us-east7", + "us-south1", + "us-west1", + "us-west2", + "us-west3", + "us-west4" + ) + )) + .schemaSettings(GooglePubSubChannelBinding.SchemaSettings.builder() + .encoding("binary") + .name("projects/your-project/schemas/message-proto") + .build() + ) + .build() + } + + @Test + @DisplayName("Compare hand crafted model with parsed json") + fun compareModelWithParsedJson() { + val model = ClasspathUtils.readAsString("/json/2.6.0/binding/channel/googlepubsub/googlePubSubChannelBinding.json") + + Assertions.assertEquals( + objectMapper.readValue(model, GooglePubSubChannelBinding::class.java), + build() + ) + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/channel/ibmmq/IBMMQChannelBindingTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/channel/ibmmq/IBMMQChannelBindingTest.kt new file mode 100644 index 00000000..bb07a774 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/channel/ibmmq/IBMMQChannelBindingTest.kt @@ -0,0 +1,45 @@ +package com.asyncapi.v2._6_0.binding.channel.ibmmq + +import com.asyncapi.v2.ClasspathUtils +import com.asyncapi.v2._6_0.binding.channel.ibmmq.IBMMQChannelBinding.Topic +import com.fasterxml.jackson.databind.ObjectMapper +import org.junit.jupiter.api.Assertions +import org.junit.jupiter.api.DisplayName +import org.junit.jupiter.api.Test + +class IBMMQChannelBindingTest { + + private val objectMapper = ObjectMapper() + + private fun build(): IBMMQChannelBinding { + return IBMMQChannelBinding.builder() + .destinationType("topic") + .queue(IBMMQChannelBinding.Queue.builder() + .objectName("message") + .isPartitioned(false) + .exclusive(true) + .build() + ) + .topic(Topic.builder() + .string("messages") + .objectName("message") + .durablePermitted(true) + .lastMsgRetained(true) + .build() + ) + .maxMsgLength(1024) + .build() + } + + @Test + @DisplayName("Compare hand crafted model with parsed json") + fun compareModelWithParsedJson() { + val model = ClasspathUtils.readAsString("/json/2.6.0/binding/channel/ibmmq/ibmMQChannelBinding.json") + + Assertions.assertEquals( + objectMapper.readValue(model, IBMMQChannelBinding::class.java), + build() + ) + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/channel/kafka/KafkaChannelBindingTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/channel/kafka/KafkaChannelBindingTest.kt new file mode 100644 index 00000000..470d44ea --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/channel/kafka/KafkaChannelBindingTest.kt @@ -0,0 +1,44 @@ +package com.asyncapi.v2._6_0.binding.channel.kafka + +import com.asyncapi.v2.ClasspathUtils +import com.fasterxml.jackson.databind.ObjectMapper +import org.junit.jupiter.api.Assertions +import org.junit.jupiter.api.DisplayName +import org.junit.jupiter.api.Test + +/** + * @version 2.6.0 + * @author Pavel Bodiachevskii + */ +class KafkaChannelBindingTest { + + private val objectMapper = ObjectMapper() + + private fun build(): KafkaChannelBinding { + return KafkaChannelBinding.builder() + .topic("my-specific-topic-name") + .partitions(20) + .replicas(3) + .topicConfiguration(KafkaChannelBinding.TopicConfiguration.builder() + .cleanupPolicy(listOf("delete", "compact")) + .retentionMs(604_800_000) + .retentionBytes(1_000_000_000) + .deleteRetentionMs(86_400_000) + .maxMessageBytes(1_048_588) + .build() + ) + .build() + } + + @Test + @DisplayName("Compare hand crafted model with parsed json") + fun compareModelWithParsedJson() { + val model = ClasspathUtils.readAsString("/json/2.6.0/binding/channel/kafka/kafkaChannelBinding.json") + + Assertions.assertEquals( + objectMapper.readValue(model, KafkaChannelBinding::class.java), + build() + ) + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/channel/pulsar/PulsarChannelBindingTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/channel/pulsar/PulsarChannelBindingTest.kt new file mode 100644 index 00000000..a3f20fd8 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/channel/pulsar/PulsarChannelBindingTest.kt @@ -0,0 +1,40 @@ +package com.asyncapi.v2._6_0.binding.channel.pulsar + +import com.asyncapi.v2.ClasspathUtils +import com.fasterxml.jackson.databind.ObjectMapper +import org.junit.jupiter.api.Assertions +import org.junit.jupiter.api.DisplayName +import org.junit.jupiter.api.Test + +class PulsarChannelBindingTest { + + private val objectMapper = ObjectMapper() + + private fun build(): PulsarChannelBinding { + return PulsarChannelBinding.builder() + .namespace("staging") + .persistence("persistent") + .compaction(1000) + .geoReplication(listOf("us-east1", "us-west1")) + .retention(PulsarChannelBinding.RetentionDefinition.builder() + .time(7) + .size(1000) + .build() + ) + .ttl(360) + .deduplication(false) + .build() + } + + @Test + @DisplayName("Compare hand crafted model with parsed json") + fun compareModelWithParsedJson() { + val model = ClasspathUtils.readAsString("/json/2.6.0/binding/channel/pulsar/pulsarChannelBinding.json") + + Assertions.assertEquals( + objectMapper.readValue(model, PulsarChannelBinding::class.java), + build() + ) + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/channel/ws/WebSocketsChannelBindingTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/channel/ws/WebSocketsChannelBindingTest.kt new file mode 100644 index 00000000..46c2985e --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/channel/ws/WebSocketsChannelBindingTest.kt @@ -0,0 +1,52 @@ +package com.asyncapi.v2._6_0.binding.channel.ws + +import com.asyncapi.v2.ClasspathUtils +import com.fasterxml.jackson.databind.ObjectMapper +import org.junit.jupiter.api.Assertions +import org.junit.jupiter.api.DisplayName +import org.junit.jupiter.api.Test + +/** + * @version 2.6.0 + * @author Pavel Bodiachevskii + */ +class WebSocketsChannelBindingTest { + + private val objectMapper = ObjectMapper() + + private fun build(): WebSocketsChannelBinding { + return WebSocketsChannelBinding.builder() + .method("GET") + .query(mapOf( + Pair("type", "object"), + Pair("properties", mapOf( + Pair("ref", mapOf( + Pair("type", "string"), + Pair("description", "Referral.") + )) + )), + )) + .headers(mapOf( + Pair("type", "object"), + Pair("properties", mapOf( + Pair("Authentication", mapOf( + Pair("type", "string"), + Pair("description", "Authentication token") + )) + )), + )) + .build() + } + + @Test + @DisplayName("Compare hand crafted model with parsed json") + fun compareModelWithParsedJson() { + val model = ClasspathUtils.readAsString("/json/2.6.0/binding/channel/ws/webSocketsChannelBinding.json") + + Assertions.assertEquals( + objectMapper.readValue(model, WebSocketsChannelBinding::class.java), + build() + ) + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/message/amqp/AMQPMessageBindingTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/message/amqp/AMQPMessageBindingTest.kt new file mode 100644 index 00000000..58cd1a37 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/message/amqp/AMQPMessageBindingTest.kt @@ -0,0 +1,31 @@ +package com.asyncapi.v2._6_0.binding.message.amqp + +import com.asyncapi.v2.ClasspathUtils +import com.fasterxml.jackson.databind.ObjectMapper +import org.junit.jupiter.api.Assertions +import org.junit.jupiter.api.DisplayName +import org.junit.jupiter.api.Test + +class AMQPMessageBindingTest { + + private val objectMapper = ObjectMapper() + + private fun build(): AMQPMessageBinding { + return AMQPMessageBinding.builder() + .contentEncoding("gzip") + .messageType("user.signup") + .build() + } + + @Test + @DisplayName("Compare hand crafted model with parsed json") + fun compareModelWithParsedJson() { + val model = ClasspathUtils.readAsString("/json/2.6.0/binding/message/amqp/amqpMessageBinding.json") + + Assertions.assertEquals( + objectMapper.readValue(model, AMQPMessageBinding::class.java), + build() + ) + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/message/anypointmq/AnypointMQMessageBindingTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/message/anypointmq/AnypointMQMessageBindingTest.kt new file mode 100644 index 00000000..ca09d9f0 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/message/anypointmq/AnypointMQMessageBindingTest.kt @@ -0,0 +1,39 @@ +package com.asyncapi.v2._6_0.binding.message.anypointmq + +import com.asyncapi.v2.ClasspathUtils +import com.fasterxml.jackson.databind.ObjectMapper +import org.junit.jupiter.api.Assertions +import org.junit.jupiter.api.DisplayName +import org.junit.jupiter.api.Test + +class AnypointMQMessageBindingTest { + + private val objectMapper = ObjectMapper() + + private fun build(): AnypointMQMessageBinding { + return AnypointMQMessageBinding.builder() + .headers(mapOf( + Pair("type", "object"), + Pair("properties", mapOf( + + Pair("correlationId", mapOf( + Pair("description", "Correlation ID set by application"), + Pair("type", "string") + )) + )) + )) + .build() + } + + @Test + @DisplayName("Compare hand crafted model with parsed json") + fun compareModelWithParsedJson() { + val model = ClasspathUtils.readAsString("/json/2.6.0/binding/message/anypointmq/anypointMQMessageBinding.json") + + Assertions.assertEquals( + objectMapper.readValue(model, AnypointMQMessageBinding::class.java), + build() + ) + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/message/googlepubsub/GooglePubSubMessageBindingTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/message/googlepubsub/GooglePubSubMessageBindingTest.kt new file mode 100644 index 00000000..205a5059 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/message/googlepubsub/GooglePubSubMessageBindingTest.kt @@ -0,0 +1,33 @@ +package com.asyncapi.v2._6_0.binding.message.googlepubsub + +import com.asyncapi.v2.ClasspathUtils +import com.fasterxml.jackson.databind.ObjectMapper +import org.junit.jupiter.api.Assertions +import org.junit.jupiter.api.DisplayName +import org.junit.jupiter.api.Test + +class GooglePubSubMessageBindingTest { + + private val objectMapper = ObjectMapper() + + private fun build(): GooglePubSubMessageBinding { + return GooglePubSubMessageBinding.builder() + .schema(GooglePubSubMessageBinding.SchemaDefinition( + "projects/your-project/schemas/message-avro", + "avro" + )) + .build() + } + + @Test + @DisplayName("Compare hand crafted model with parsed json") + fun compareModelWithParsedJson() { + val model = ClasspathUtils.readAsString("/json/2.6.0/binding/message/googlepubsub/googlePubSubMessageBinding.json") + + Assertions.assertEquals( + objectMapper.readValue(model, GooglePubSubMessageBinding::class.java), + build() + ) + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/message/http/HTTPMessageBindingTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/message/http/HTTPMessageBindingTest.kt new file mode 100644 index 00000000..3d6c6136 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/message/http/HTTPMessageBindingTest.kt @@ -0,0 +1,38 @@ +package com.asyncapi.v2._6_0.binding.message.http + +import com.asyncapi.v2.ClasspathUtils +import com.fasterxml.jackson.databind.ObjectMapper +import org.junit.jupiter.api.Assertions +import org.junit.jupiter.api.DisplayName +import org.junit.jupiter.api.Test + +class HTTPMessageBindingTest { + + private val objectMapper = ObjectMapper() + + private fun build(): HTTPMessageBinding { + return HTTPMessageBinding.builder() + .headers(mapOf( + Pair("type", "object"), + Pair("properties", mapOf( + Pair("Content-Type", mapOf( + Pair("type", "string"), + Pair("enum", listOf("application/json")) + )) + )), + )) + .build() + } + + @Test + @DisplayName("Compare hand crafted model with parsed json") + fun compareModelWithParsedJson() { + val model = ClasspathUtils.readAsString("/json/2.6.0/binding/message/http/httpMessageBinding.json") + + Assertions.assertEquals( + objectMapper.readValue(model, HTTPMessageBinding::class.java), + build() + ) + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/message/ibmmq/IBMMQMessageBindingTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/message/ibmmq/IBMMQMessageBindingTest.kt new file mode 100644 index 00000000..f3e4fbed --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/message/ibmmq/IBMMQMessageBindingTest.kt @@ -0,0 +1,33 @@ +package com.asyncapi.v2._6_0.binding.message.ibmmq + +import com.asyncapi.v2.ClasspathUtils +import com.fasterxml.jackson.databind.ObjectMapper +import org.junit.jupiter.api.Assertions +import org.junit.jupiter.api.DisplayName +import org.junit.jupiter.api.Test + +class IBMMQMessageBindingTest { + + private val objectMapper = ObjectMapper() + + private fun build(): IBMMQMessageBinding { + return IBMMQMessageBinding.builder() + .type("jms") + .description("JMS stream message") + .headers("Content-Type: application/json") + .expiry(0) + .build() + } + + @Test + @DisplayName("Compare hand crafted model with parsed json") + fun compareModelWithParsedJson() { + val model = ClasspathUtils.readAsString("/json/2.6.0/binding/message/ibmmq/ibmMQMessageBinding.json") + + Assertions.assertEquals( + objectMapper.readValue(model, IBMMQMessageBinding::class.java), + build() + ) + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/message/kafka/KafkaMessageBindingTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/message/kafka/KafkaMessageBindingTest.kt new file mode 100644 index 00000000..fea1f170 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/message/kafka/KafkaMessageBindingTest.kt @@ -0,0 +1,36 @@ +package com.asyncapi.v2._6_0.binding.message.kafka + +import com.asyncapi.v2.ClasspathUtils +import com.fasterxml.jackson.databind.ObjectMapper +import org.junit.jupiter.api.Assertions +import org.junit.jupiter.api.DisplayName +import org.junit.jupiter.api.Test + +class KafkaMessageBindingTest { + + private val objectMapper = ObjectMapper() + + private fun build(): KafkaMessageBinding { + return KafkaMessageBinding.builder() + .key(mapOf( + Pair("type", "string"), + Pair("enum", listOf("myKey")) + )) + .schemaIdLocation("payload") + .schemaIdPayloadEncoding("apicurio-new") + .schemaLookupStrategy("TopicIdStrategy") + .build() + } + + @Test + @DisplayName("Compare hand crafted model with parsed json") + fun compareModelWithParsedJson() { + val model = ClasspathUtils.readAsString("/json/2.6.0/binding/message/kafka/kafkaMessageBinding.json") + + Assertions.assertEquals( + objectMapper.readValue(model, KafkaMessageBinding::class.java), + build() + ) + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/message/mqtt/MQTTMessageBindingTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/message/mqtt/MQTTMessageBindingTest.kt new file mode 100644 index 00000000..820f2bef --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/message/mqtt/MQTTMessageBindingTest.kt @@ -0,0 +1,29 @@ +package com.asyncapi.v2._6_0.binding.message.mqtt + +import com.asyncapi.v2.ClasspathUtils +import com.fasterxml.jackson.databind.ObjectMapper +import org.junit.jupiter.api.Assertions +import org.junit.jupiter.api.DisplayName +import org.junit.jupiter.api.Test + +class MQTTMessageBindingTest { + + private val objectMapper = ObjectMapper() + + private fun build(): MQTTMessageBinding { + return MQTTMessageBinding.builder() + .build() + } + + @Test + @DisplayName("Compare hand crafted model with parsed json") + fun compareModelWithParsedJson() { + val model = ClasspathUtils.readAsString("/json/2.6.0/binding/message/mqtt/mqttMessageBinding.json") + + Assertions.assertEquals( + objectMapper.readValue(model, MQTTMessageBinding::class.java), + build() + ) + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/operation/amqp/AMQPOperationBindingTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/operation/amqp/AMQPOperationBindingTest.kt new file mode 100644 index 00000000..a2b2169c --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/operation/amqp/AMQPOperationBindingTest.kt @@ -0,0 +1,39 @@ +package com.asyncapi.v2._6_0.binding.operation.amqp + +import com.asyncapi.v2.ClasspathUtils +import com.fasterxml.jackson.databind.ObjectMapper +import org.junit.jupiter.api.Assertions +import org.junit.jupiter.api.DisplayName +import org.junit.jupiter.api.Test + +class AMQPOperationBindingTest { + + private val objectMapper = ObjectMapper() + + private fun build(): AMQPOperationBinding { + return AMQPOperationBinding.builder() + .expiration(100_000) + .userId("guest") + .cc(listOf("user.logs")) + .priority(10) + .deliveryMode(2) + .mandatory(false) + .bcc(listOf("external.audit")) + .replyTo("user.signedup") + .timestamp(true) + .ack(false) + .build() + } + + @Test + @DisplayName("Compare hand crafted model with parsed json") + fun compareModelWithParsedJson() { + val model = ClasspathUtils.readAsString("/json/2.6.0/binding/operation/amqp/amqpOperationBinding.json") + + Assertions.assertEquals( + objectMapper.readValue(model, AMQPOperationBinding::class.java), + build() + ) + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/operation/http/HTTPOperationBindingTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/operation/http/HTTPOperationBindingTest.kt new file mode 100644 index 00000000..cf7dd2b7 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/operation/http/HTTPOperationBindingTest.kt @@ -0,0 +1,43 @@ +package com.asyncapi.v2._6_0.binding.operation.http + +import com.asyncapi.v2.ClasspathUtils +import com.fasterxml.jackson.databind.ObjectMapper +import org.junit.jupiter.api.Assertions +import org.junit.jupiter.api.DisplayName +import org.junit.jupiter.api.Test + +class HTTPOperationBindingTest { + + private val objectMapper = ObjectMapper() + + private fun build(): HTTPOperationBinding { + return HTTPOperationBinding.builder() + .type("request") + .method("GET") + .query(mapOf( + Pair("type", "object"), + Pair("required", listOf("companyId")), + Pair("properties", mapOf( + Pair("companyId", mapOf( + Pair("type", "number"), + Pair("minimum", 1), + Pair("description", "The Id of the company.") + )), + Pair("additionalProperties", false) + )), + )) + .build() + } + + @Test + @DisplayName("Compare hand crafted model with parsed json") + fun compareModelWithParsedJson() { + val model = ClasspathUtils.readAsString("/json/2.6.0/binding/operation/http/httpOperationBinding.json") + + Assertions.assertEquals( + objectMapper.readValue(model, HTTPOperationBinding::class.java), + build() + ) + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/operation/kafka/KafkaOperationBindingTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/operation/kafka/KafkaOperationBindingTest.kt new file mode 100644 index 00000000..c81ca2ec --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/operation/kafka/KafkaOperationBindingTest.kt @@ -0,0 +1,37 @@ +package com.asyncapi.v2._6_0.binding.operation.kafka + +import com.asyncapi.v2.ClasspathUtils +import com.fasterxml.jackson.databind.ObjectMapper +import org.junit.jupiter.api.Assertions +import org.junit.jupiter.api.DisplayName +import org.junit.jupiter.api.Test + +class KafkaOperationBindingTest { + + private val objectMapper = ObjectMapper() + + private fun build(): KafkaOperationBinding { + return KafkaOperationBinding.builder() + .groupId(mapOf( + Pair("type", "string"), + Pair("enum", listOf("myGroupId")) + )) + .clientId(mapOf( + Pair("type", "string"), + Pair("enum", listOf("myClientId")) + )) + .build() + } + + @Test + @DisplayName("Compare hand crafted model with parsed json") + fun compareModelWithParsedJson() { + val model = ClasspathUtils.readAsString("/json/2.6.0/binding/operation/kafka/kafkaOperationBinding.json") + + Assertions.assertEquals( + objectMapper.readValue(model, KafkaOperationBinding::class.java), + build() + ) + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/operation/mqtt/MQTTOperationBindingTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/operation/mqtt/MQTTOperationBindingTest.kt new file mode 100644 index 00000000..1b8cf5f6 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/operation/mqtt/MQTTOperationBindingTest.kt @@ -0,0 +1,31 @@ +package com.asyncapi.v2._6_0.binding.operation.mqtt + +import com.asyncapi.v2.ClasspathUtils +import com.fasterxml.jackson.databind.ObjectMapper +import org.junit.jupiter.api.Assertions +import org.junit.jupiter.api.DisplayName +import org.junit.jupiter.api.Test + +class MQTTOperationBindingTest { + + private val objectMapper = ObjectMapper() + + private fun build(): MQTTOperationBinding { + return MQTTOperationBinding.builder() + .qos(2) + .retain(true) + .build() + } + + @Test + @DisplayName("Compare hand crafted model with parsed json") + fun compareModelWithParsedJson() { + val model = ClasspathUtils.readAsString("/json/2.6.0/binding/operation/mqtt/mqttOperationBinding.json") + + Assertions.assertEquals( + objectMapper.readValue(model, MQTTOperationBinding::class.java), + build() + ) + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/operation/nats/NATSOperationBindingTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/operation/nats/NATSOperationBindingTest.kt new file mode 100644 index 00000000..8f6997a4 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/operation/nats/NATSOperationBindingTest.kt @@ -0,0 +1,31 @@ +package com.asyncapi.v2._6_0.binding.operation.nats + +import com.asyncapi.v2.ClasspathUtils +import com.asyncapi.v2._6_0.binding.operation.mqtt.MQTTOperationBinding +import com.fasterxml.jackson.databind.ObjectMapper +import org.junit.jupiter.api.Assertions +import org.junit.jupiter.api.DisplayName +import org.junit.jupiter.api.Test + +class NATSOperationBindingTest { + + private val objectMapper = ObjectMapper() + + private fun build(): NATSOperationBinding { + return NATSOperationBinding.builder() + .queue("messages") + .build() + } + + @Test + @DisplayName("Compare hand crafted model with parsed json") + fun compareModelWithParsedJson() { + val model = ClasspathUtils.readAsString("/json/2.6.0/binding/operation/nats/natsOperationBinding.json") + + Assertions.assertEquals( + objectMapper.readValue(model, NATSOperationBinding::class.java), + build() + ) + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/operation/solace/SolaceOperationBindingTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/operation/solace/SolaceOperationBindingTest.kt new file mode 100644 index 00000000..c37257b0 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v2/_6_0/binding/operation/solace/SolaceOperationBindingTest.kt @@ -0,0 +1,54 @@ +package com.asyncapi.v2._6_0.binding.operation.solace + +import com.asyncapi.v2.ClasspathUtils +import com.fasterxml.jackson.databind.ObjectMapper +import org.junit.jupiter.api.Assertions +import org.junit.jupiter.api.DisplayName +import org.junit.jupiter.api.Test + +class SolaceOperationBindingTest { + + private val objectMapper = ObjectMapper() + + private fun build(): SolaceOperationBinding { + return SolaceOperationBinding.builder() + .destinations(listOf( + SolaceOperationBinding.Destination.builder() + .destinationType("queue") + .queue(SolaceOperationBinding.Destination.Queue.builder() + .name("CreatedHREvents") + .topicSubscriptions(listOf("person/*/created")) + .accessType("exclusive") + .maxMsgSpoolSize("1,500") + .maxTtl("60") + .build() + ) + .build(), + SolaceOperationBinding.Destination.builder() + .destinationType("queue") + .queue(SolaceOperationBinding.Destination.Queue.builder() + .name("UpdatedHREvents") + .topicSubscriptions(listOf("person/*/updated")) + .build() + ) + .topic(SolaceOperationBinding.Destination.Topic.builder() + .topicSubscriptions(listOf("person/*/updated")) + .build() + ) + .build() + )) + .build() + } + + @Test + @DisplayName("Compare hand crafted model with parsed json") + fun compareModelWithParsedJson() { + val model = ClasspathUtils.readAsString("/json/2.6.0/binding/operation/solace/solaceOperationBinding.json") + + Assertions.assertEquals( + objectMapper.readValue(model, SolaceOperationBinding::class.java), + build() + ) + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/2.6.0/binding/channel/amqp/amqpChannelBinding.json b/asyncapi-core/src/test/resources/json/2.6.0/binding/channel/amqp/amqpChannelBinding.json new file mode 100644 index 00000000..e91cacb2 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/2.6.0/binding/channel/amqp/amqpChannelBinding.json @@ -0,0 +1,18 @@ +{ + "is": "routingKey", + "queue": { + "name": "my-queue-name", + "durable": true, + "exclusive": true, + "autoDelete": false, + "vhost": "/" + }, + "exchange": { + "name": "myExchange", + "type": "topic", + "durable": true, + "autoDelete": false, + "vhost": "/" + }, + "bindingVersion": "0.2.0" +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/2.6.0/binding/channel/anypoint/anypointMQChannelBinding.json b/asyncapi-core/src/test/resources/json/2.6.0/binding/channel/anypoint/anypointMQChannelBinding.json new file mode 100644 index 00000000..c5d7598b --- /dev/null +++ b/asyncapi-core/src/test/resources/json/2.6.0/binding/channel/anypoint/anypointMQChannelBinding.json @@ -0,0 +1,5 @@ +{ + "destination": "user-signup-exchg", + "destinationType": "exchange", + "bindingVersion": "0.0.1" +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/2.6.0/binding/channel/googlepubsub/googlePubSubChannelBinding.json b/asyncapi-core/src/test/resources/json/2.6.0/binding/channel/googlepubsub/googlePubSubChannelBinding.json new file mode 100644 index 00000000..fb9b3d3e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/2.6.0/binding/channel/googlepubsub/googlePubSubChannelBinding.json @@ -0,0 +1,24 @@ +{ + "topic": "projects/your-project/topics/topic-proto-schema", + "messageRetentionDuration": "86400s", + "messageStoragePolicy": { + "allowedPersistenceRegions": [ + "us-central1", + "us-central2", + "us-east1", + "us-east4", + "us-east5", + "us-east7", + "us-south1", + "us-west1", + "us-west2", + "us-west3", + "us-west4" + ] + }, + "schemaSettings": { + "encoding": "binary", + "name": "projects/your-project/schemas/message-proto" + }, + "bindingVersion": "0.1.0" +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/2.6.0/binding/channel/ibmmq/ibmMQChannelBinding.json b/asyncapi-core/src/test/resources/json/2.6.0/binding/channel/ibmmq/ibmMQChannelBinding.json new file mode 100644 index 00000000..7ebdae40 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/2.6.0/binding/channel/ibmmq/ibmMQChannelBinding.json @@ -0,0 +1,16 @@ +{ + "destinationType": "topic", + "queue": { + "objectName": "message", + "isPartitioned": false, + "exclusive": true + }, + "topic": { + "string": "messages", + "objectName": "message", + "durablePermitted": true, + "lastMsgRetained": true + }, + "maxMsgLength": 1024, + "bindingVersion": "0.1.0" +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/2.6.0/binding/channel/kafka/kafkaChannelBinding.json b/asyncapi-core/src/test/resources/json/2.6.0/binding/channel/kafka/kafkaChannelBinding.json new file mode 100644 index 00000000..c937ae56 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/2.6.0/binding/channel/kafka/kafkaChannelBinding.json @@ -0,0 +1,16 @@ +{ + "topic": "my-specific-topic-name", + "partitions": 20, + "replicas": 3, + "topicConfiguration": { + "cleanup.policy": [ + "delete", + "compact" + ], + "retention.ms": 604800000, + "retention.bytes": 1000000000, + "delete.retention.ms": 86400000, + "max.message.bytes": 1048588 + }, + "bindingVersion": "0.4.0" +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/2.6.0/binding/channel/pulsar/pulsarChannelBinding.json b/asyncapi-core/src/test/resources/json/2.6.0/binding/channel/pulsar/pulsarChannelBinding.json new file mode 100644 index 00000000..21af1c35 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/2.6.0/binding/channel/pulsar/pulsarChannelBinding.json @@ -0,0 +1,16 @@ +{ + "namespace": "staging", + "persistence": "persistent", + "compaction": 1000, + "geo-replication": [ + "us-east1", + "us-west1" + ], + "retention": { + "time": 7, + "size": 1000 + }, + "ttl": 360, + "deduplication": false, + "bindingVersion": "0.1.0" +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/2.6.0/binding/channel/ws/webSocketsChannelBinding.json b/asyncapi-core/src/test/resources/json/2.6.0/binding/channel/ws/webSocketsChannelBinding.json new file mode 100644 index 00000000..f30d9581 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/2.6.0/binding/channel/ws/webSocketsChannelBinding.json @@ -0,0 +1,21 @@ +{ + "method": "GET", + "query": { + "type": "object", + "properties": { + "ref": { + "type": "string", + "description": "Referral." + } + } + }, + "headers": { + "type": "object", + "properties": { + "Authentication": { + "type": "string", + "description": "Authentication token" + } + } + } +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/2.6.0/binding/message/amqp/amqpMessageBinding.json b/asyncapi-core/src/test/resources/json/2.6.0/binding/message/amqp/amqpMessageBinding.json new file mode 100644 index 00000000..3a56f03e --- /dev/null +++ b/asyncapi-core/src/test/resources/json/2.6.0/binding/message/amqp/amqpMessageBinding.json @@ -0,0 +1,5 @@ +{ + "contentEncoding": "gzip", + "messageType": "user.signup", + "bindingVersion": "0.2.0" +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/2.6.0/binding/message/anypointmq/anypointMQMessageBinding.json b/asyncapi-core/src/test/resources/json/2.6.0/binding/message/anypointmq/anypointMQMessageBinding.json new file mode 100644 index 00000000..04509bbf --- /dev/null +++ b/asyncapi-core/src/test/resources/json/2.6.0/binding/message/anypointmq/anypointMQMessageBinding.json @@ -0,0 +1,12 @@ +{ + "headers": { + "type": "object", + "properties": { + "correlationId": { + "description": "Correlation ID set by application", + "type": "string" + } + } + }, + "bindingVersion": "0.0.1" +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/2.6.0/binding/message/googlepubsub/googlePubSubMessageBinding.json b/asyncapi-core/src/test/resources/json/2.6.0/binding/message/googlepubsub/googlePubSubMessageBinding.json new file mode 100644 index 00000000..511854ad --- /dev/null +++ b/asyncapi-core/src/test/resources/json/2.6.0/binding/message/googlepubsub/googlePubSubMessageBinding.json @@ -0,0 +1,7 @@ +{ + "schema": { + "name": "projects/your-project/schemas/message-avro", + "type": "avro" + }, + "bindingVersion": "0.1.0" +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/2.6.0/binding/message/http/httpMessageBinding.json b/asyncapi-core/src/test/resources/json/2.6.0/binding/message/http/httpMessageBinding.json new file mode 100644 index 00000000..5f7f5672 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/2.6.0/binding/message/http/httpMessageBinding.json @@ -0,0 +1,14 @@ +{ + "headers": { + "type": "object", + "properties": { + "Content-Type": { + "type": "string", + "enum": [ + "application/json" + ] + } + } + }, + "bindingVersion": "0.1.0" +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/2.6.0/binding/message/ibmmq/ibmMQMessageBinding.json b/asyncapi-core/src/test/resources/json/2.6.0/binding/message/ibmmq/ibmMQMessageBinding.json new file mode 100644 index 00000000..49697805 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/2.6.0/binding/message/ibmmq/ibmMQMessageBinding.json @@ -0,0 +1,7 @@ +{ + "type": "jms", + "description": "JMS stream message", + "headers": "Content-Type: application/json", + "expiry": 0, + "bindingVersion": "0.1.0" +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/2.6.0/binding/message/kafka/kafkaMessageBinding.json b/asyncapi-core/src/test/resources/json/2.6.0/binding/message/kafka/kafkaMessageBinding.json new file mode 100644 index 00000000..42340266 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/2.6.0/binding/message/kafka/kafkaMessageBinding.json @@ -0,0 +1,12 @@ +{ + "key": { + "type": "string", + "enum": [ + "myKey" + ] + }, + "schemaIdLocation": "payload", + "schemaIdPayloadEncoding": "apicurio-new", + "schemaLookupStrategy": "TopicIdStrategy", + "bindingVersion": "0.4.0" +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/2.6.0/binding/message/mqtt/mqttMessageBinding.json b/asyncapi-core/src/test/resources/json/2.6.0/binding/message/mqtt/mqttMessageBinding.json new file mode 100644 index 00000000..04dbf945 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/2.6.0/binding/message/mqtt/mqttMessageBinding.json @@ -0,0 +1,3 @@ +{ + "bindingVersion": "0.1.0" +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/2.6.0/binding/operation/amqp/amqpOperationBinding.json b/asyncapi-core/src/test/resources/json/2.6.0/binding/operation/amqp/amqpOperationBinding.json new file mode 100644 index 00000000..3bfeef70 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/2.6.0/binding/operation/amqp/amqpOperationBinding.json @@ -0,0 +1,17 @@ +{ + "expiration": 100000, + "userId": "guest", + "cc": [ + "user.logs" + ], + "priority": 10, + "deliveryMode": 2, + "mandatory": false, + "bcc": [ + "external.audit" + ], + "replyTo": "user.signedup", + "timestamp": true, + "ack": false, + "bindingVersion": "0.2.0" +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/2.6.0/binding/operation/http/httpOperationBinding.json b/asyncapi-core/src/test/resources/json/2.6.0/binding/operation/http/httpOperationBinding.json new file mode 100644 index 00000000..468105a1 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/2.6.0/binding/operation/http/httpOperationBinding.json @@ -0,0 +1,19 @@ +{ + "type": "request", + "method": "GET", + "query": { + "type": "object", + "required": [ + "companyId" + ], + "properties": { + "companyId": { + "type": "number", + "minimum": 1, + "description": "The Id of the company." + }, + "additionalProperties": false + } + }, + "bindingVersion": "0.1.0" +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/2.6.0/binding/operation/kafka/kafkaOperationBinding.json b/asyncapi-core/src/test/resources/json/2.6.0/binding/operation/kafka/kafkaOperationBinding.json new file mode 100644 index 00000000..542d1fe2 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/2.6.0/binding/operation/kafka/kafkaOperationBinding.json @@ -0,0 +1,15 @@ +{ + "groupId": { + "type": "string", + "enum": [ + "myGroupId" + ] + }, + "clientId": { + "type": "string", + "enum": [ + "myClientId" + ] + }, + "bindingVersion": "0.4.0" +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/2.6.0/binding/operation/mqtt/mqttOperationBinding.json b/asyncapi-core/src/test/resources/json/2.6.0/binding/operation/mqtt/mqttOperationBinding.json new file mode 100644 index 00000000..7500db5c --- /dev/null +++ b/asyncapi-core/src/test/resources/json/2.6.0/binding/operation/mqtt/mqttOperationBinding.json @@ -0,0 +1,5 @@ +{ + "qos": 2, + "retain": true, + "bindingVersion": "0.1.0" +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/2.6.0/binding/operation/nats/natsOperationBinding.json b/asyncapi-core/src/test/resources/json/2.6.0/binding/operation/nats/natsOperationBinding.json new file mode 100644 index 00000000..53d874bb --- /dev/null +++ b/asyncapi-core/src/test/resources/json/2.6.0/binding/operation/nats/natsOperationBinding.json @@ -0,0 +1,4 @@ +{ + "queue": "messages", + "bindingVersion": "0.1.0" +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/json/2.6.0/binding/operation/solace/solaceOperationBinding.json b/asyncapi-core/src/test/resources/json/2.6.0/binding/operation/solace/solaceOperationBinding.json new file mode 100644 index 00000000..e5b10158 --- /dev/null +++ b/asyncapi-core/src/test/resources/json/2.6.0/binding/operation/solace/solaceOperationBinding.json @@ -0,0 +1,31 @@ +{ + "destinations": [ + { + "destinationType": "queue", + "queue": { + "name": "CreatedHREvents", + "topicSubscriptions": [ + "person/*/created" + ], + "accessType": "exclusive", + "maxMsgSpoolSize": "1,500", + "maxTtl": "60" + } + }, + { + "destinationType": "queue", + "queue": { + "name": "UpdatedHREvents", + "topicSubscriptions": [ + "person/*/updated" + ] + }, + "topic": { + "topicSubscriptions": [ + "person/*/updated" + ] + } + } + ], + "bindingVersion": "0.3.0" +} \ No newline at end of file