diff --git a/.gitignore b/.gitignore index e75c88cf..a7721135 100644 --- a/.gitignore +++ b/.gitignore @@ -54,3 +54,12 @@ buildNumber.properties # Mac .DS_Store + +# Eclipse +asyncapi-plugin/asyncapi-plugin-maven/.settings/org.eclipse.jdt.core.prefs +asyncapi-plugin/asyncapi-plugin-maven/.project +asyncapi-plugin/.project +asyncapi-core/.project +.vscode/settings.json +asyncapi-core/.settings/org.eclipse.jdt.core.prefs +.project diff --git a/asyncapi-core/pom.xml b/asyncapi-core/pom.xml index 5d66c42d..c1efe550 100644 --- a/asyncapi-core/pom.xml +++ b/asyncapi-core/pom.xml @@ -6,7 +6,7 @@ asyncapi com.asyncapi - 1.0.0-EAP-1 + 1.0.1-EAP-1 4.0.0 @@ -28,7 +28,7 @@ org.jetbrains.kotlin - kotlin-stdlib-jdk8 + kotlin-stdlib test diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/binding/ChannelBindingsDeserializer.java b/asyncapi-core/src/main/java/com/asyncapi/v2/binding/ChannelBindingsDeserializer.java index b8fafccf..de14ee16 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v2/binding/ChannelBindingsDeserializer.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/binding/ChannelBindingsDeserializer.java @@ -9,6 +9,7 @@ import com.asyncapi.v2.binding.nats.NATSChannelBinding; import com.asyncapi.v2.binding.redis.RedisChannelBinding; import com.asyncapi.v2.binding.sns.SNSChannelBinding; +import com.asyncapi.v2.binding.solace.SolaceChannelBinding; import com.asyncapi.v2.binding.sqs.SQSChannelBinding; import com.asyncapi.v2.binding.stomp.STOMPChannelBinding; import com.asyncapi.v2.binding.ws.WebSocketsChannelBinding; @@ -68,6 +69,7 @@ private T chooseKnownPojo(String bindingKey, JsonNode case "nats": return (T) objectMapper.readValue(binding.toString(), NATSChannelBinding.class); case "redis": return (T) objectMapper.readValue(binding.toString(), RedisChannelBinding.class); case "sns": return (T) objectMapper.readValue(binding.toString(), SNSChannelBinding.class); + case "solace": return (T) objectMapper.readValue(binding.toString(), SolaceChannelBinding.class); case "sqs": return (T) objectMapper.readValue(binding.toString(), SQSChannelBinding.class); case "stomp": return (T) objectMapper.readValue(binding.toString(), STOMPChannelBinding.class); case "ws": return (T) objectMapper.readValue(binding.toString(), WebSocketsChannelBinding.class); diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/binding/MessageBindingsDeserializer.java b/asyncapi-core/src/main/java/com/asyncapi/v2/binding/MessageBindingsDeserializer.java index 9c873372..48aee79b 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v2/binding/MessageBindingsDeserializer.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/binding/MessageBindingsDeserializer.java @@ -9,6 +9,7 @@ import com.asyncapi.v2.binding.nats.NATSMessageBinding; import com.asyncapi.v2.binding.redis.RedisMessageBinding; import com.asyncapi.v2.binding.sns.SNSMessageBinding; +import com.asyncapi.v2.binding.solace.SolaceMessageBinding; import com.asyncapi.v2.binding.sqs.SQSMessageBinding; import com.asyncapi.v2.binding.stomp.STOMPMessageBinding; import com.asyncapi.v2.binding.ws.WebSocketsMessageBinding; @@ -68,6 +69,7 @@ private T chooseKnownPojo(String bindingKey, JsonNode case "nats": return (T) objectMapper.readValue(binding.toString(), NATSMessageBinding.class); case "redis": return (T) objectMapper.readValue(binding.toString(), RedisMessageBinding.class); case "sns": return (T) objectMapper.readValue(binding.toString(), SNSMessageBinding.class); + case "solace": return (T) objectMapper.readValue(binding.toString(), SolaceMessageBinding.class); case "sqs": return (T) objectMapper.readValue(binding.toString(), SQSMessageBinding.class); case "stomp": return (T) objectMapper.readValue(binding.toString(), STOMPMessageBinding.class); case "ws": return (T) objectMapper.readValue(binding.toString(), WebSocketsMessageBinding.class); diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/binding/OperationBindingsDeserializer.java b/asyncapi-core/src/main/java/com/asyncapi/v2/binding/OperationBindingsDeserializer.java index ce67be04..2bc6ac0f 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v2/binding/OperationBindingsDeserializer.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/binding/OperationBindingsDeserializer.java @@ -9,6 +9,7 @@ import com.asyncapi.v2.binding.nats.NATSOperationBinding; import com.asyncapi.v2.binding.redis.RedisOperationBinding; import com.asyncapi.v2.binding.sns.SNSOperationBinding; +import com.asyncapi.v2.binding.solace.SolaceOperationBinding; import com.asyncapi.v2.binding.sqs.SQSOperationBinding; import com.asyncapi.v2.binding.stomp.STOMPOperationBinding; import com.asyncapi.v2.binding.ws.WebSocketsOperationBinding; @@ -68,6 +69,7 @@ private T chooseKnownPojo(String bindingKey, JsonNo case "nats": return (T) objectMapper.readValue(binding.toString(), NATSOperationBinding.class); case "redis": return (T) objectMapper.readValue(binding.toString(), RedisOperationBinding.class); case "sns": return (T) objectMapper.readValue(binding.toString(), SNSOperationBinding.class); + case "solace": return (T) objectMapper.readValue(binding.toString(), SolaceOperationBinding.class); case "sqs": return (T) objectMapper.readValue(binding.toString(), SQSOperationBinding.class); case "stomp": return (T) objectMapper.readValue(binding.toString(), STOMPOperationBinding.class); case "ws": return (T) objectMapper.readValue(binding.toString(), WebSocketsOperationBinding.class); diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/binding/ServerBindingsDeserializer.java b/asyncapi-core/src/main/java/com/asyncapi/v2/binding/ServerBindingsDeserializer.java index 65580ba9..f0f83216 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v2/binding/ServerBindingsDeserializer.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/binding/ServerBindingsDeserializer.java @@ -9,6 +9,7 @@ import com.asyncapi.v2.binding.nats.NATSServerBinding; import com.asyncapi.v2.binding.redis.RedisServerBinding; import com.asyncapi.v2.binding.sns.SNSServerBinding; +import com.asyncapi.v2.binding.solace.SolaceServerBinding; import com.asyncapi.v2.binding.sqs.SQSServerBinding; import com.asyncapi.v2.binding.stomp.STOMPServerBinding; import com.asyncapi.v2.binding.ws.WebSocketsServerBinding; @@ -68,6 +69,7 @@ private T chooseKnownPojo(String bindingKey, JsonNode case "nats": return (T) objectMapper.readValue(binding.toString(), NATSServerBinding.class); case "redis": return (T) objectMapper.readValue(binding.toString(), RedisServerBinding.class); case "sns": return (T) objectMapper.readValue(binding.toString(), SNSServerBinding.class); + case "solace": return (T) objectMapper.readValue(binding.toString(), SolaceServerBinding.class); case "sqs": return (T) objectMapper.readValue(binding.toString(), SQSServerBinding.class); case "stomp": return (T) objectMapper.readValue(binding.toString(), STOMPServerBinding.class); case "ws": return (T) objectMapper.readValue(binding.toString(), WebSocketsServerBinding.class); diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/binding/solace/SolaceChannelBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/binding/solace/SolaceChannelBinding.java new file mode 100644 index 00000000..02ff7a62 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/binding/solace/SolaceChannelBinding.java @@ -0,0 +1,21 @@ +package com.asyncapi.v2.binding.solace; + +import com.asyncapi.v2.binding.ChannelBinding; +import lombok.*; + +/** + * Describes Solace channel binding. + * + * Contains information about the channel representation in Solace PubSub+ Broker. + * This object MUST NOT contain any properties. Its name is reserved for future use. + * + * @version 0.2.0 + * @see Solace channel binding + * @author Dennis Brinley + */ +@Data +@Builder +@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class SolaceChannelBinding extends ChannelBinding { +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/binding/solace/SolaceMessageBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/binding/solace/SolaceMessageBinding.java new file mode 100644 index 00000000..3fcd0abd --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/binding/solace/SolaceMessageBinding.java @@ -0,0 +1,21 @@ +package com.asyncapi.v2.binding.solace; + +import com.asyncapi.v2.binding.MessageBinding; +import lombok.*; + +/** + * Describes Solace message binding. + * + * Contains information about the message representation in Solace PubSub+ Broker. + * This object MUST NOT contain any properties. Its name is reserved for future use. + * + * @version 0.2.0 + * @see Solace message binding + * @author Dennis Brinley + */ +@Data +@Builder +@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class SolaceMessageBinding extends MessageBinding { +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/binding/solace/SolaceOperationBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/binding/solace/SolaceOperationBinding.java new file mode 100644 index 00000000..b069e7f1 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/binding/solace/SolaceOperationBinding.java @@ -0,0 +1,221 @@ +package com.asyncapi.v2.binding.solace; + +import com.asyncapi.v2.binding.OperationBinding; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; + +import lombok.*; + +import javax.annotation.CheckForNull; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import java.util.ArrayList; +import java.util.List; + +/** + * Describes Solace operation binding. + * + * Contains information about the operation representation in Solace PubSub+ Broker. + * + * @version 0.2.0 + * @see Solace operation binding + * @author Dennis Brinley + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class SolaceOperationBinding extends OperationBinding { + + /** + * Version of the binding object (e.g. bindingVersion: 0.2.0) + */ + @Nullable + @CheckForNull + @JsonProperty + protected String bindingVersion; + + /** + * List of destinations + */ + @Nullable + @CheckForNull + @Builder.Default + protected List destinations = new ArrayList(); + + public enum SolaceDestinationType { + QUEUE("queue"), + TOPIC("topic"); + + private String value; + + private SolaceDestinationType(String value) { + this.value = value; + } + + @Override + public String toString() { + return this.value; + } + + @JsonValue + public String getValue() { + return value; + } + + public static SolaceDestinationType fromValue(String value) { + if (value == null || "".equals(value)) { + throw new IllegalArgumentException( "Value cannot be empty or NULL" ); + } + + for (SolaceDestinationType enumEntry : SolaceDestinationType.values()) { + if (enumEntry.toString().equals(value)) { + return enumEntry; + } + } + + throw new IllegalArgumentException( "Value must be member of [ queue, topic ]" ); + } + } + + public enum SolaceDeliveryModeType { + DIRECT("direct"), + PERISTENT("persistent"); + + private String value; + + private SolaceDeliveryModeType(String value) { + this.value = value; + } + + @Override + public String toString() { + return this.value; + } + + @JsonValue + public String getValue() { + return this.value; + } + + public static SolaceDeliveryModeType fromValue(String value) { + if (value == null || "".equals(value)) { + throw new IllegalArgumentException( "Value cannot be empty or NULL" ); + } + + for (SolaceDeliveryModeType enumEntry : SolaceDeliveryModeType.values()) { + if (enumEntry.toString().equals(value)) { + return enumEntry; + } + } + + throw new IllegalArgumentException( "Value must be member of [ direct, persistent ]" ); + } + } + + public enum SolaceQueueAccessType { + EXCLUSIVE("exclusive"), + NON_EXCLUSIVE("non-exclusive"); + + private String value; + + private SolaceQueueAccessType(String value) { + this.value = value; + } + + @Override + public String toString() { + return this.value; + } + + @JsonValue + public String getValue() { + return this.value; + } + + public static SolaceQueueAccessType fromValue(String value) { + if (value == null || "".equals(value)) { + throw new IllegalArgumentException( "Value cannot be empty or NULL" ); + } + + for (SolaceQueueAccessType enumEntry : SolaceQueueAccessType.values()) { + if (enumEntry.toString().equals(value)) { + return enumEntry; + } + } + + throw new IllegalArgumentException( "Value must be member of [ exclusive, non-exclusive ]" ); + } + } + + @Data + @NoArgsConstructor + @AllArgsConstructor + public static class SolaceQueueType { + + @NonNull + @Nonnull + @CheckForNull + String name; + + @CheckForNull + List topicSubscriptions; + + @CheckForNull + SolaceQueueAccessType accessType; + } + + @Data + @NoArgsConstructor + @AllArgsConstructor + public static class SolaceTopicType { + + @CheckForNull + @JsonProperty + protected List topicSubscriptions; + } + + @Data + @NoArgsConstructor + @AllArgsConstructor + public static class SolaceDestination { + + /** + * The destination type. enum SolaceDestinationType enum can be 'topic' or 'queue' + */ + @NonNull + @Nonnull + @CheckForNull + @JsonProperty + protected SolaceDestinationType destinationType; + + /** + * The delivery mode for messages associated with this destination. enum SolaceDeliveryModeType + * can be 'direct' or 'persistent' + */ + @NonNull + @Nonnull + @CheckForNull + @JsonProperty + protected SolaceDeliveryModeType deliveryMode; + + /** + * Solace queue destination details. + */ + @Nullable + @CheckForNull + @JsonProperty + protected SolaceQueueType queue; + + /** + * Solace topic destination details + */ + @Nullable + @CheckForNull + @JsonProperty + protected SolaceTopicType topic; + } + +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/binding/solace/SolaceServerBinding.java b/asyncapi-core/src/main/java/com/asyncapi/v2/binding/solace/SolaceServerBinding.java new file mode 100644 index 00000000..ac556a73 --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/binding/solace/SolaceServerBinding.java @@ -0,0 +1,43 @@ +package com.asyncapi.v2.binding.solace; + +import javax.annotation.CheckForNull; + +import com.asyncapi.v2.binding.ServerBinding; +import com.fasterxml.jackson.annotation.JsonProperty; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +/** + * Describes Solace server binding. + * + * @version 0.2.0 + * @see Solace server binding + * @author Dennis Brinley + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class SolaceServerBinding extends ServerBinding { + + /** + * Binding version of the object + * + * e.g. bindingVersion: 0.2.0 + */ + @CheckForNull + @JsonProperty + protected String bindingVersion; + + /** + * Message VPN of the Solace Broker + * + * e.g. msgVpn: solace-broker-msg-vpn + */ + @CheckForNull + @JsonProperty + protected String msgVpn; +} diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/binding/solace/package-info.java b/asyncapi-core/src/main/java/com/asyncapi/v2/binding/solace/package-info.java new file mode 100644 index 00000000..ed7cf09c --- /dev/null +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/binding/solace/package-info.java @@ -0,0 +1,7 @@ +/** + * This classes defines how to describe Solace-specific information on AsyncAPI. + * + * @version 0.2.0 + * @see Solace bindings + */ +package com.asyncapi.v2.binding.solace; diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/model/channel/ChannelItem.java b/asyncapi-core/src/main/java/com/asyncapi/v2/model/channel/ChannelItem.java index 843081fe..9dfa7790 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v2/model/channel/ChannelItem.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/model/channel/ChannelItem.java @@ -4,6 +4,9 @@ import com.asyncapi.v2.binding.ChannelBindingsDeserializer; import com.asyncapi.v2.jackson.ChannelParametersDeserializer; import com.asyncapi.v2.model.channel.operation.Operation; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import lombok.AllArgsConstructor; import lombok.Builder; @@ -11,6 +14,7 @@ import lombok.NoArgsConstructor; import javax.annotation.CheckForNull; +import java.util.HashMap; import java.util.Map; /** @@ -31,24 +35,28 @@ public class ChannelItem { * The referenced structure MUST be in the format of a Channel Item Object. * If there are conflicts between the referenced definition and this Channel Item's definition, the behavior is undefined. */ + @JsonProperty @CheckForNull private String $ref; /** * An optional description of this channel item. CommonMark syntax can be used for rich text representation. */ + @JsonProperty @CheckForNull private String description; /** * A definition of the SUBSCRIBE operation. */ + @JsonProperty @CheckForNull private Operation subscribe; /** * A definition of the PUBLISH operation. */ + @JsonProperty @CheckForNull private Operation publish; @@ -75,4 +83,12 @@ public class ChannelItem { @JsonDeserialize(using = ChannelBindingsDeserializer.class) private Map bindings; + /** + * Extension fields in the form x-extension-field-name for the exposed API. + */ + @JsonAnySetter + @JsonAnyGetter + @CheckForNull + @Builder.Default + protected Map extensionFields = new HashMap(); } diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/model/channel/Parameter.java b/asyncapi-core/src/main/java/com/asyncapi/v2/model/channel/Parameter.java index fd13f32c..c7163941 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v2/model/channel/Parameter.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/model/channel/Parameter.java @@ -1,11 +1,18 @@ package com.asyncapi.v2.model.channel; import com.asyncapi.v2.model.schema.Schema; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonProperty; + import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; +import java.util.HashMap; +import java.util.Map; + import javax.annotation.CheckForNull; /** @@ -24,12 +31,14 @@ public class Parameter { /** * A verbose explanation of the parameter. CommonMark syntax can be used for rich text representation. */ + @JsonProperty @CheckForNull private String description; /** * Definition of the parameter. */ + @JsonProperty @CheckForNull private Schema schema; @@ -39,7 +48,16 @@ public class Parameter { * Even when a definition for the target field exists, it MUST NOT be used to validate this parameter but, * instead, the schema property MUST be used. */ + @JsonProperty @CheckForNull private String location; + /** + * Extension fields in the form x-extension-field-name for the exposed API. + */ + @JsonAnySetter + @JsonAnyGetter + @CheckForNull + @Builder.Default + protected Map extensionFields = new HashMap(); } diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/model/channel/message/Message.java b/asyncapi-core/src/main/java/com/asyncapi/v2/model/channel/message/Message.java index 92a32167..fd1eb933 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v2/model/channel/message/Message.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/model/channel/message/Message.java @@ -8,6 +8,9 @@ import com.asyncapi.v2.jackson.MessageTraitsDeserializer; import com.asyncapi.v2.model.ExternalDocumentation; import com.asyncapi.v2.model.Tag; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import lombok.AllArgsConstructor; import lombok.Builder; @@ -17,6 +20,7 @@ import javax.annotation.CheckForNull; import java.util.List; import java.util.Map; +import java.util.HashMap; /** * Describes a message received on a given channel and operation. @@ -80,6 +84,7 @@ public class Message { * A custom value MUST NOT refer to one of the schema formats listed in the table. */ @CheckForNull + @JsonProperty private String schemaFormat; /** @@ -88,42 +93,49 @@ public class Message { * defaultContentType field. */ @CheckForNull + @JsonProperty private String contentType; /** * A machine-friendly name for the message. */ @CheckForNull + @JsonProperty private String name; /** * A human-friendly title for the message. */ @CheckForNull + @JsonProperty private String title; /** * A short summary of what the message is about. */ @CheckForNull + @JsonProperty private String summary; /** * A verbose explanation of the message. CommonMark syntax can be used for rich text representation. */ @CheckForNull + @JsonProperty private String description; /** * A list of tags for API documentation control. Tags can be used for logical grouping of messages. */ @CheckForNull + @JsonProperty private List tags; /** * Additional external documentation for this message. */ @CheckForNull + @JsonProperty private ExternalDocumentation externalDocs; /** @@ -141,6 +153,7 @@ public class Message { * that validate against the {@link #headers} or {@link #payload} fields, respectively. */ @CheckForNull + @JsonProperty private List> examples; /** @@ -157,4 +170,9 @@ public class Message { @JsonDeserialize(using = MessageTraitsDeserializer.class) private List traits; + @JsonAnyGetter + @JsonAnySetter + @Builder.Default + protected Map extensionFields = new HashMap(); + } diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/model/info/Info.java b/asyncapi-core/src/main/java/com/asyncapi/v2/model/info/Info.java index c5b71f18..8a894e9f 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v2/model/info/Info.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/model/info/Info.java @@ -2,9 +2,16 @@ import lombok.*; +import java.util.HashMap; +import java.util.Map; + import javax.annotation.CheckForNull; import javax.annotation.Nonnull; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonProperty; + /** * The object provides metadata about the API. The metadata can be used by the clients if needed. * @@ -25,6 +32,7 @@ public class Info { */ @Nonnull @NonNull + @JsonProperty private String title; /** @@ -34,30 +42,43 @@ public class Info { */ @Nonnull @NonNull + @JsonProperty private String version; /** * A short description of the application. CommonMark syntax can be used for rich text representation. */ @CheckForNull + @JsonProperty private String description; /** * A URL to the Terms of Service for the API. MUST be in the format of a URL. */ @CheckForNull + @JsonProperty private String termsOfService; /** * The contact information for the exposed API. */ @CheckForNull + @JsonProperty private Contact contact; /** * The license information for the exposed API. */ @CheckForNull + @JsonProperty private License license; + /** + * Extension fields in the form x-extension-field-name for the exposed API. + */ + @JsonAnyGetter + @JsonAnySetter + @Builder.Default + protected Map extensionFields = new HashMap(); + } diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/model/schema/Schema.java b/asyncapi-core/src/main/java/com/asyncapi/v2/model/schema/Schema.java index 218f9d53..84fec770 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v2/model/schema/Schema.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/model/schema/Schema.java @@ -1,15 +1,17 @@ package com.asyncapi.v2.model.schema; import com.asyncapi.v2.model.ExternalDocumentation; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; - import javax.annotation.CheckForNull; import java.util.List; import java.util.Map; +import java.util.HashMap; // TODO: Finish. Not all properties are present. // TODO: Write tests @@ -60,6 +62,7 @@ information for documentation and user interface display purposes. * A title will preferably be short */ @CheckForNull + @JsonProperty public String title; /** @@ -74,6 +77,7 @@ information for documentation and user interface display purposes. * A description will provide explanation about the purpose of the instance described by this schema. */ @CheckForNull + @JsonProperty public String description; /** @@ -111,6 +115,7 @@ information for documentation and user interface display purposes. * Omitting this keyword has the same behavior as values of false. */ @CheckForNull + @JsonProperty public Boolean readOnly; /** @@ -130,6 +135,7 @@ information for documentation and user interface display purposes. * Omitting this keyword has the same behavior as values of false. */ @CheckForNull + @JsonProperty public Boolean writeOnly; /** @@ -144,6 +150,7 @@ information for documentation and user interface display purposes. * "default" MAY still be used in this manner. */ @CheckForNull + @JsonProperty public List examples; @CheckForNull @@ -185,6 +192,7 @@ as assertions (Section 3.2). While no special effort is required to * The value of this property SHOULD be ignored if the instance described is not a string. */ @CheckForNull + @JsonProperty private String contentEncoding; /** @@ -200,6 +208,7 @@ as assertions (Section 3.2). While no special effort is required to * is Unicode). */ @CheckForNull + @JsonProperty private String contentMediaType; /* @@ -221,6 +230,7 @@ as assertions (Section 3.2). While no special effort is required to * */ @CheckForNull + @JsonProperty public Object type; /** @@ -253,6 +263,7 @@ Validation Keywords for Numeric Instances (number and integer) * A numeric instance is valid only if division by this keyword's value results in an integer. */ @CheckForNull + @JsonProperty public Integer multipleOf; /** @@ -261,6 +272,7 @@ Validation Keywords for Numeric Instances (number and integer) * If the instance is a number, then this keyword validates only if the instance is less than or exactly equal to "maximum". */ @CheckForNull + @JsonProperty public Integer maximum; /** @@ -269,6 +281,7 @@ Validation Keywords for Numeric Instances (number and integer) * If the instance is a number, then the instance is valid only if it has a value strictly less than (not equal to) "exclusiveMaximum". */ @CheckForNull + @JsonProperty public Integer exclusiveMaximum; /** @@ -277,6 +290,7 @@ Validation Keywords for Numeric Instances (number and integer) * If the instance is a number, then this keyword validates only if the instance is greater than or exactly equal to "minimum". */ @CheckForNull + @JsonProperty public Integer minimum; /** @@ -285,6 +299,7 @@ Validation Keywords for Numeric Instances (number and integer) * If the instance is a number, then the instance is valid only if it has a value strictly greater than (not equal to) "exclusiveMinimum". */ @CheckForNull + @JsonProperty public Integer exclusiveMinimum; /* @@ -299,6 +314,7 @@ Validation Keywords for Numeric Instances (number and integer) * The length of a string instance is defined as the number of its characters as defined by RFC 7159 [RFC7159]. */ @CheckForNull + @JsonProperty public Integer maxLength; /** @@ -311,6 +327,7 @@ Validation Keywords for Numeric Instances (number and integer) * Omitting this keyword has the same behavior as a value of 0. */ @CheckForNull + @JsonProperty public Integer minLength; /** @@ -321,6 +338,7 @@ Validation Keywords for Numeric Instances (number and integer) * Recall: regular expressions are not implicitly anchored. */ @CheckForNull + @JsonProperty public String pattern; /* @@ -340,6 +358,7 @@ Validation Keywords for Numeric Instances (number and integer) * Omitting this keyword has the same behavior as an empty schema. */ @CheckForNull + @JsonProperty public Object items; /** @@ -364,6 +383,7 @@ Validation Keywords for Numeric Instances (number and integer) * An array instance is valid against "maxItems" if its size is less than, or equal to, the value of this keyword. */ @CheckForNull + @JsonProperty public Integer maxItems; /** @@ -374,6 +394,7 @@ Validation Keywords for Numeric Instances (number and integer) * Omitting this keyword has the same behavior as a value of 0. */ @CheckForNull + @JsonProperty public Integer minItems; /** @@ -385,6 +406,7 @@ Validation Keywords for Numeric Instances (number and integer) * Omitting this keyword has the same behavior as a value of false. */ @CheckForNull + @JsonProperty public Boolean uniqueItems; /** @@ -393,6 +415,7 @@ Validation Keywords for Numeric Instances (number and integer) * An array instance is valid against "contains" if at least one of its elements is valid against the given schema. */ @CheckForNull + @JsonProperty public Schema contains; /* @@ -406,6 +429,7 @@ Validation Keywords for Numeric Instances (number and integer) * the value of this keyword. */ @CheckForNull + @JsonProperty public Integer maxProperties; /** @@ -417,6 +441,7 @@ Validation Keywords for Numeric Instances (number and integer) * Omitting this keyword has the same behavior as a value of 0. */ @CheckForNull + @JsonProperty public Integer minProperties; /** @@ -427,6 +452,7 @@ Validation Keywords for Numeric Instances (number and integer) * Omitting this keyword has the same behavior as an empty array. */ @CheckForNull + @JsonProperty public List required; /** @@ -441,6 +467,7 @@ Validation Keywords for Numeric Instances (number and integer) * Omitting this keyword has the same behavior as an empty object. */ @CheckForNull + @JsonProperty public Map properties; /** @@ -458,6 +485,7 @@ Validation Keywords for Numeric Instances (number and integer) * Omitting this keyword has the same behavior as an empty object. */ @CheckForNull + @JsonProperty public Map patternProperties; /** @@ -474,6 +502,7 @@ Validation Keywords for Numeric Instances (number and integer) * Omitting this keyword has the same behavior as an empty schema. */ @CheckForNull + @JsonProperty public Schema additionalProperties; /** @@ -497,6 +526,7 @@ Validation Keywords for Numeric Instances (number and integer) * Omitting this keyword has the same behavior as an empty object. */ @CheckForNull + @JsonProperty public Object dependencies; /** @@ -508,6 +538,7 @@ Validation Keywords for Numeric Instances (number and integer) * Omitting this keyword has the same behavior as an empty schema. */ @CheckForNull + @JsonProperty public Schema propertyNames; /* @@ -584,6 +615,7 @@ Validation Keywords for Numeric Instances (number and integer) * by this keyword's value. */ @CheckForNull + @JsonProperty public List allOf; /** @@ -593,6 +625,7 @@ Validation Keywords for Numeric Instances (number and integer) * defined by this keyword's value. */ @CheckForNull + @JsonProperty public List anyOf; /** @@ -602,6 +635,7 @@ Validation Keywords for Numeric Instances (number and integer) * defined by this keyword's value. */ @CheckForNull + @JsonProperty public List oneOf; /** @@ -610,6 +644,7 @@ Validation Keywords for Numeric Instances (number and integer) * An instance is valid against this keyword if it fails to validate successfully against the schema defined by this keyword. */ @CheckForNull + @JsonProperty public Schema not; // Fields defined in AsyncAPI below @@ -622,6 +657,7 @@ Validation Keywords for Numeric Instances (number and integer) * While relying on JSON Schema's defined formats, the AsyncAPI Specification offers a few additional predefined formats. */ @CheckForNull + @JsonProperty public Object format; /* @@ -635,17 +671,25 @@ Validation Keywords for Numeric Instances (number and integer) * When used, the value MUST be the name of this schema or any schema that inherits it. See Composition and Inheritance for more details. */ @CheckForNull + @JsonProperty public String discriminator; /** * Additional external documentation for this schema. */ @CheckForNull + @JsonProperty public ExternalDocumentation externalDocs; /** * Specifies that a schema is deprecated and SHOULD be transitioned out of usage. Default value is false. */ @CheckForNull + @JsonProperty public Boolean deprecated; + @JsonAnyGetter + @JsonAnySetter + @Builder.Default + protected Map extensionFields = new HashMap(); + } diff --git a/asyncapi-core/src/main/java/com/asyncapi/v2/model/server/Server.java b/asyncapi-core/src/main/java/com/asyncapi/v2/model/server/Server.java index 18b48463..993f9bb1 100644 --- a/asyncapi-core/src/main/java/com/asyncapi/v2/model/server/Server.java +++ b/asyncapi-core/src/main/java/com/asyncapi/v2/model/server/Server.java @@ -2,6 +2,9 @@ import com.asyncapi.v2.binding.ServerBinding; import com.asyncapi.v2.binding.ServerBindingsDeserializer; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import lombok.*; @@ -9,6 +12,7 @@ import javax.annotation.Nonnull; import java.util.List; import java.util.Map; +import java.util.HashMap; /** * An object representing a message broker, a server or any other kind of computer program capable of sending and/or @@ -35,6 +39,7 @@ public class Server { */ @Nonnull @NonNull + @JsonProperty private String url; /** @@ -45,12 +50,14 @@ public class Server { */ @Nonnull @NonNull + @JsonProperty private String protocol; /** * The version of the protocol used for connection. For instance: AMQP 0.9.1, HTTP 2.0, Kafka 1.0.0, etc. */ @CheckForNull + @JsonProperty private String protocolVersion; /** @@ -58,12 +65,14 @@ public class Server { * representation. */ @CheckForNull + @JsonProperty private String description; /** * A map between a variable name and its value. The value is used for substitution in the server's URL template. */ @CheckForNull + @JsonProperty private Map variables; /** @@ -78,6 +87,7 @@ public class Server { * Objects in the list needs to be satisfied to authorize the connection. */ @CheckForNull + @JsonProperty private List>> security; /** @@ -88,4 +98,8 @@ public class Server { @JsonDeserialize(using = ServerBindingsDeserializer.class) private Map bindings; + @JsonAnyGetter + @JsonAnySetter + @Builder.Default + protected Map extensionFields = new HashMap(); } diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v2/model/channel/ParameterTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v2/model/channel/ParameterTest.kt index 3b33e47c..03cdfd65 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v2/model/channel/ParameterTest.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v2/model/channel/ParameterTest.kt @@ -19,7 +19,8 @@ class ParameterTest { return Parameter( "Id of the user.", Schema.builder().type(Type.STRING).build(), - "\$message.payload#/user/id" + "\$message.payload#/user/id", + null ) } diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/v2/model/info/InfoTest.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/v2/model/info/InfoTest.kt index dbc06aeb..0491a53f 100644 --- a/asyncapi-core/src/test/kotlin/com/asyncapi/v2/model/info/InfoTest.kt +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/v2/model/info/InfoTest.kt @@ -34,7 +34,8 @@ class InfoTest { "short description", "https://www.asyncapi.com/about/", buildContact(), - buildLicense() + buildLicense(), + null ) } diff --git a/asyncapi-plugin/asyncapi-plugin-maven/pom.xml b/asyncapi-plugin/asyncapi-plugin-maven/pom.xml index 45d43a2f..4385600c 100644 --- a/asyncapi-plugin/asyncapi-plugin-maven/pom.xml +++ b/asyncapi-plugin/asyncapi-plugin-maven/pom.xml @@ -5,7 +5,7 @@ asyncapi-plugin com.asyncapi - 1.0.0-EAP-1 + 1.0.1-EAP-1 4.0.0 @@ -76,7 +76,7 @@ org.jetbrains.kotlin - kotlin-stdlib-jdk8 + kotlin-stdlib org.jetbrains.kotlin @@ -112,7 +112,7 @@ - + maven-plugin-plugin 3.6.0 diff --git a/asyncapi-plugin/pom.xml b/asyncapi-plugin/pom.xml index 2e96600b..e0229226 100644 --- a/asyncapi-plugin/pom.xml +++ b/asyncapi-plugin/pom.xml @@ -6,7 +6,7 @@ asyncapi com.asyncapi - 1.0.0-EAP-1 + 1.0.1-EAP-1 4.0.0 diff --git a/pom.xml b/pom.xml index e2e3191d..4a230af3 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.asyncapi asyncapi - 1.0.0-EAP-1 + 1.0.1-EAP-1 AsyncAPI @@ -50,12 +50,12 @@ - 1.6.20 - 2.13.2 - 1.8 + 1.7.10 + 2.13.3 + 11 1.18.10 5.6.1 - 0.10.1 + 1.7.0 @@ -85,7 +85,7 @@ org.jetbrains.kotlin - kotlin-stdlib-jdk8 + kotlin-stdlib ${kotlin.version} @@ -147,7 +147,7 @@ org.apache.maven.plugins maven-source-plugin - 2.2.1 + 3.2.1 attach-sources @@ -160,7 +160,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 2.9.1 + 3.3.2 attach-javadocs