diff --git a/.gitignore b/.gitignore
index 46ccc22..7b598df 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,7 @@ target/
.mvn/timing.properties
.mvn/wrapper/maven-wrapper.jar
node_modules/
+j2asyncapi-schema/node
+j2asyncapi-schema/node_modules
+j2asyncapi-schema/src/main/resources/schemas
+
diff --git a/docs/asyncapi-annotations.md b/docs/asyncapi-annotations.md
index 214cf68..b84c84e 100644
--- a/docs/asyncapi-annotations.md
+++ b/docs/asyncapi-annotations.md
@@ -9,11 +9,11 @@
* [Servers](#servers)
* [test](#test-server)
* [Operations](#operations)
+ * [SUB exchange/routing.key.multiple1](#sub-exchangeroutingkeymultiple1-operation)
+ * [SUB exchange/routing.key.multiple2](#sub-exchangeroutingkeymultiple2-operation)
* [SUB exchange/queries](#sub-exchangequeries-operation)
* [PUB exchange/routing.key](#pub-exchangeroutingkey-operation)
* [SUB exchange/routing.key](#sub-exchangeroutingkey-operation)
- * [SUB exchange/routing.key.multiple1](#sub-exchangeroutingkeymultiple1-operation)
- * [SUB exchange/routing.key.multiple2](#sub-exchangeroutingkeymultiple2-operation)
* [SUB routing.key.default.exchange](#sub-routingkeydefaultexchange-operation)
## Servers
@@ -28,7 +28,7 @@ RabbitMQ Server
## Operations
-### SUB `exchange/queries` Operation
+### SUB `exchange/routing.key.multiple1` Operation
#### Message Void `j.l.Void`
@@ -46,92 +46,92 @@ RabbitMQ Server
-### PUB `exchange/routing.key` Operation
-
-Description explaining exactly what happens here
+### SUB `exchange/routing.key.multiple2` Operation
-#### Message ExampleListenerMessage `l.g.j.a.e.l.ExampleListener$ExampleListenerMessage`
+#### Message Void `j.l.Void`
##### Payload
| Name | Type | Description | Value | Constraints | Notes |
|---|---|---|---|---|---|
| (root) | - | - | - | - | **additional properties are allowed** |
-| amount | number | - | examples (`42.42`, `352.01`) | format (`float`) | - |
-| currency | string | - | examples (`"EUR"`, `"USD"`, `"CHF"`) | - | - |
-| id | string | there can only be 2 valid values | examples (`"value1"`, `"value42"`) | - | - |
> Examples of payload _(generated)_
```json
-{
- "amount": 42.42,
- "currency": "EUR",
- "id": "value1"
-}
+{}
```
-### SUB `exchange/routing.key` Operation
-
-Description explaining exactly what happens here
-
-#### Message ExamplePublisherMessage `l.g.j.a.e.p.ExamplePublisher$ExamplePublisherMessage`
+### SUB `exchange/queries` Operation
-this is a message which gets published
+#### Message Void `j.l.Void`
##### Payload
| Name | Type | Description | Value | Constraints | Notes |
|---|---|---|---|---|---|
| (root) | - | - | - | - | **additional properties are allowed** |
-| amount | number | - | examples (`42.42`, `352.01`) | format (`float`) | - |
-| currency | integer | - | examples (`42`, `352`) | format (`int32`) | - |
> Examples of payload _(generated)_
```json
-{
- "amount": 42.42,
- "currency": 42
-}
+{}
```
-### SUB `exchange/routing.key.multiple1` Operation
+### PUB `exchange/routing.key` Operation
-#### Message Void `j.l.Void`
+Description explaining exactly what happens here
+
+#### Message ExampleListenerMessage `l.g.j.a.e.l.ExampleListener$ExampleListenerMessage`
##### Payload
| Name | Type | Description | Value | Constraints | Notes |
|---|---|---|---|---|---|
| (root) | - | - | - | - | **additional properties are allowed** |
+| amount | number | - | examples (`42.42`, `352.01`) | format (`float`) | - |
+| currency | string | - | examples (`"EUR"`, `"USD"`, `"CHF"`) | - | - |
+| id | string | there can only be 2 valid values | examples (`"value1"`, `"value42"`) | - | - |
> Examples of payload _(generated)_
```json
-{}
+{
+ "amount": 42.42,
+ "currency": "EUR",
+ "id": "value1"
+}
```
-### SUB `exchange/routing.key.multiple2` Operation
+### SUB `exchange/routing.key` Operation
-#### Message Void `j.l.Void`
+Description explaining exactly what happens here
+
+#### Message ExamplePublisherMessage `l.g.j.a.e.p.ExamplePublisher$ExamplePublisherMessage`
+
+this is a message which gets published
##### Payload
| Name | Type | Description | Value | Constraints | Notes |
|---|---|---|---|---|---|
| (root) | - | - | - | - | **additional properties are allowed** |
+| amount | number | - | examples (`42.42`, `352.01`) | format (`float`) | - |
+| currency | integer | - | examples (`42`, `352`) | format (`int32`) | - |
> Examples of payload _(generated)_
```json
-{}
+{
+ "amount": 42.42,
+ "currency": 42
+}
```
diff --git a/docs/asyncapi-annotations.yaml b/docs/asyncapi-annotations.yaml
index 5214c4b..74911a6 100644
--- a/docs/asyncapi-annotations.yaml
+++ b/docs/asyncapi-annotations.yaml
@@ -1,4 +1,4 @@
-asyncapi: "2.0.0"
+asyncapi: "2.3.0"
info:
title: "Application API"
version: "0.1.0"
@@ -9,89 +9,94 @@ info:
servers:
test:
url: "http://rabbitmq"
- protocol: "amqp"
description: "RabbitMQ Server"
+ protocol: "amqp"
channels:
+ exchange/routing.key.multiple1:
+ subscribe:
+ message:
+ $ref: "#/components/messages/j.l.Void"
+ deprecated: false
+ exchange/routing.key.multiple2:
+ subscribe:
+ message:
+ $ref: "#/components/messages/j.l.Void"
+ deprecated: false
exchange/queries:
subscribe:
message:
$ref: "#/components/messages/j.l.Void"
+ deprecated: false
exchange/routing.key:
description: "Description explaining exactly what happens here"
- subscribe:
- message:
- $ref: "#/components/messages/l.g.j.a.e.p.ExamplePublisher$ExamplePublisherMessage"
publish:
message:
$ref: "#/components/messages/l.g.j.a.e.l.ExampleListener$ExampleListenerMessage"
- exchange/routing.key.multiple1:
subscribe:
message:
- $ref: "#/components/messages/j.l.Void"
- exchange/routing.key.multiple2:
- subscribe:
- message:
- $ref: "#/components/messages/j.l.Void"
+ $ref: "#/components/messages/l.g.j.a.e.p.ExamplePublisher$ExamplePublisherMessage"
+ deprecated: false
routing.key.default.exchange:
subscribe:
message:
$ref: "#/components/messages/j.l.Void"
+ deprecated: false
components:
schemas:
- j.l.Integer-decfea64:
- examples:
- - 42
- - 352
- type: "integer"
- format: "int32"
- j.l.String-931073f3:
- examples:
- - "EUR"
- - "USD"
- - "CHF"
- type: "string"
- j.l.Void:
- title: "Void"
- properties: {}
- j.m.BigDecimal-dbc8e12d:
+ j.m.BigDecimal-13a8d7b1:
+ type: "number"
+ format: "float"
examples:
- 42.42
- 352.01
- type: "number"
- format: "float"
l.g.j.a.e.l.ExampleListener$ExampleListenerMessage:
title: "ExampleListenerMessage"
properties:
amount:
- $ref: "#/components/schemas/j.m.BigDecimal-dbc8e12d"
+ $ref: "#/components/schemas/j.m.BigDecimal-13a8d7b1"
currency:
- $ref: "#/components/schemas/j.l.String-931073f3"
+ $ref: "#/components/schemas/j.l.String-7e061cd2"
id:
- $ref: "#/components/schemas/l.g.j.a.e.l.ExampleListener$ObjectRepresentingAnId-3841a929"
- l.g.j.a.e.l.ExampleListener$ObjectRepresentingAnId-3841a929:
- description: "there can only be 2 valid values"
+ $ref: "#/components/schemas/l.g.j.a.e.l.ExampleListener$ObjectRepresentingAnId-de5ddb67"
+ j.l.Integer-7d3b2498:
+ type: "integer"
+ format: "int32"
examples:
- - "value1"
- - "value42"
+ - 42
+ - 352
+ j.l.String-7e061cd2:
type: "string"
+ examples:
+ - "EUR"
+ - "USD"
+ - "CHF"
l.g.j.a.e.p.ExamplePublisher$ExamplePublisherMessage:
title: "ExamplePublisherMessage"
properties:
amount:
- $ref: "#/components/schemas/j.m.BigDecimal-dbc8e12d"
+ $ref: "#/components/schemas/j.m.BigDecimal-13a8d7b1"
currency:
- $ref: "#/components/schemas/j.l.Integer-decfea64"
- messages:
+ $ref: "#/components/schemas/j.l.Integer-7d3b2498"
+ l.g.j.a.e.l.ExampleListener$ObjectRepresentingAnId-de5ddb67:
+ type: "string"
+ examples:
+ - "value1"
+ - "value42"
+ description: "there can only be 2 valid values"
j.l.Void:
- payload:
- $ref: "#/components/schemas/j.l.Void"
title: "Void"
+ properties: {}
+ messages:
l.g.j.a.e.l.ExampleListener$ExampleListenerMessage:
+ title: "ExampleListenerMessage"
payload:
$ref: "#/components/schemas/l.g.j.a.e.l.ExampleListener$ExampleListenerMessage"
- title: "ExampleListenerMessage"
l.g.j.a.e.p.ExamplePublisher$ExamplePublisherMessage:
+ title: "ExamplePublisherMessage"
payload:
$ref: "#/components/schemas/l.g.j.a.e.p.ExamplePublisher$ExamplePublisherMessage"
- title: "ExamplePublisherMessage"
description: "this is a message which gets published"
+ j.l.Void:
+ title: "Void"
+ payload:
+ $ref: "#/components/schemas/j.l.Void"
diff --git a/docs/asyncapi-example.yaml b/docs/asyncapi-example.yaml
index 2ae8f47..4457aee 100644
--- a/docs/asyncapi-example.yaml
+++ b/docs/asyncapi-example.yaml
@@ -1,4 +1,4 @@
-asyncapi: "2.0.0"
+asyncapi: "2.3.0"
info:
title: "Application API"
version: "0.1.0"
@@ -9,70 +9,71 @@ info:
servers:
test:
url: "http://rabbitmq"
- protocol: "amqp"
description: "RabbitMQ Server"
+ protocol: "amqp"
channels:
exchange/routing.key:
description: "Description explaining exactly what happens here"
- subscribe:
- message:
- $ref: "#/components/messages/l.g.j.e.ExampleApplication$ExamplePublisherMessage"
publish:
message:
$ref: "#/components/messages/l.g.j.e.ExampleApplication$ExampleListenerMessage"
+ subscribe:
+ message:
+ $ref: "#/components/messages/l.g.j.e.ExampleApplication$ExamplePublisherMessage"
+ deprecated: false
components:
schemas:
- j.l.Integer-decfea64:
+ j.m.BigDecimal-13a8d7b1:
+ type: "number"
+ format: "float"
examples:
- - 42
- - 352
- type: "integer"
- format: "int32"
- j.l.String-38af4fe9:
+ - 42.42
+ - 352.01
+ j.l.String-714f7ea0:
+ type: "string"
examples:
- "Lorem"
- "ipsum"
+ j.l.Integer-7d3b2498:
+ type: "integer"
+ format: "int32"
+ examples:
+ - 42
+ - 352
+ j.l.String-7e061cd2:
type: "string"
- j.l.String-931073f3:
examples:
- "EUR"
- "USD"
- "CHF"
- type: "string"
- j.m.BigDecimal-dbc8e12d:
- examples:
- - 42.42
- - 352.01
- type: "number"
- format: "float"
- l.g.j.e.ExampleApplication$ExampleListenerMessage:
- title: "ExampleListenerMessage"
- properties:
- amount:
- $ref: "#/components/schemas/j.m.BigDecimal-dbc8e12d"
- currency:
- $ref: "#/components/schemas/j.l.String-931073f3"
- id:
- $ref: "#/components/schemas/l.g.j.e.ExampleApplication$ObjectRepresentingAnId"
l.g.j.e.ExampleApplication$ExamplePublisherMessage:
title: "ExamplePublisherMessage"
properties:
amount:
- $ref: "#/components/schemas/j.m.BigDecimal-dbc8e12d"
+ $ref: "#/components/schemas/j.m.BigDecimal-13a8d7b1"
currency:
- $ref: "#/components/schemas/j.l.Integer-decfea64"
+ $ref: "#/components/schemas/j.l.Integer-7d3b2498"
l.g.j.e.ExampleApplication$ObjectRepresentingAnId:
title: "ObjectRepresentingAnId"
properties:
value:
- $ref: "#/components/schemas/j.l.String-38af4fe9"
- messages:
+ $ref: "#/components/schemas/j.l.String-714f7ea0"
l.g.j.e.ExampleApplication$ExampleListenerMessage:
- payload:
- $ref: "#/components/schemas/l.g.j.e.ExampleApplication$ExampleListenerMessage"
title: "ExampleListenerMessage"
+ properties:
+ amount:
+ $ref: "#/components/schemas/j.m.BigDecimal-13a8d7b1"
+ currency:
+ $ref: "#/components/schemas/j.l.String-7e061cd2"
+ id:
+ $ref: "#/components/schemas/l.g.j.e.ExampleApplication$ObjectRepresentingAnId"
+ messages:
l.g.j.e.ExampleApplication$ExamplePublisherMessage:
+ title: "ExamplePublisherMessage"
payload:
$ref: "#/components/schemas/l.g.j.e.ExampleApplication$ExamplePublisherMessage"
- title: "ExamplePublisherMessage"
description: "this is a message which gets published"
+ l.g.j.e.ExampleApplication$ExampleListenerMessage:
+ title: "ExampleListenerMessage"
+ payload:
+ $ref: "#/components/schemas/l.g.j.e.ExampleApplication$ExampleListenerMessage"
diff --git a/docs/asyncapi.md b/docs/asyncapi.md
index a35d410..71d8d8e 100644
--- a/docs/asyncapi.md
+++ b/docs/asyncapi.md
@@ -34,7 +34,7 @@ Publish information
| Name | Type | Description | Value | Constraints | Notes |
|---|---|---|---|---|---|
| (root) | - | - | - | - | **additional properties are allowed** |
-| exampleEnum | string | - | allowed (`"VALUE_2"`, `"VALUE_3"`), examples (`"VALUE_2"`, `"VALUE_3"`) | - | - |
+| exampleEnum | string | - | examples (`"VALUE_2"`, `"VALUE_3"`) | - | - |
| intAmount | integer | - | examples (`42`, `352`) | format (`int32`) | - |
| exampleLocalDateTime | string | - | examples (`"2022-01-31T23:20:50.52Z"`, `"1985-04-12T15:59:55-08:00"`) | format (`date-time`) | - |
| innerExample | - | - | - | - | **additional properties are allowed** |
diff --git a/docs/asyncapi.yaml b/docs/asyncapi.yaml
index 57c0a6a..3f887c0 100644
--- a/docs/asyncapi.yaml
+++ b/docs/asyncapi.yaml
@@ -1,4 +1,4 @@
-asyncapi: "2.0.0"
+asyncapi: "2.3.0"
info:
title: "Application API"
version: "0.1.0"
@@ -9,141 +9,142 @@ info:
servers:
test:
url: "http://rabbitmq"
- protocol: "amqp"
description: "RabbitMQ Server"
+ protocol: "amqp"
channels:
channelName:
description: "Publish information"
subscribe:
message:
$ref: "#/components/messages/l.g.j.c.WriteToFileTest$Example"
+ deprecated: false
components:
schemas:
- j.l.Boolean-96239209:
+ l.g.j.c.WriteToFileTest$NestedInnerExample:
+ title: "NestedInnerExample"
+ properties:
+ nestedInnerCurrency:
+ $ref: "#/components/schemas/j.l.String-714f7ea0"
+ l.g.j.c.WriteToFileTest$InnerExample:
+ title: "InnerExample"
+ properties:
+ innerCurrency:
+ $ref: "#/components/schemas/j.l.String-714f7ea0"
+ nestedInnerExample:
+ $ref: "#/components/schemas/l.g.j.c.WriteToFileTest$NestedInnerExample"
+ j.l.String-714f7ea0:
+ type: "string"
+ examples:
+ - "Lorem"
+ - "ipsum"
+ j.u.List-b1afaed2:
+ type: "array"
+ items:
+ $ref: "#/components/schemas/j.l.String-714f7ea0"
+ j.t.Instant-c4b227a8:
+ type: "string"
+ format: "date-time"
+ examples:
+ - "2022-01-31T23:20:50.52Z"
+ - "1985-04-12T15:59:55-08:00"
+ j.l.Long-8275dd77:
+ type: "integer"
+ format: "int64"
+ examples:
+ - 42
+ - 352
+ j.l.Integer-95f48e25:
+ type: "integer"
+ format: "flapping"
+ examples:
+ - "456565"
+ - "4654"
+ j.l.Boolean-f89d8af0:
+ type: "boolean"
examples:
- true
- false
- type: "boolean"
- j.l.Double-ed55d4cc:
+ j.m.BigDecimal-13a8d7b1:
+ type: "number"
+ format: "float"
examples:
- 42.42
- 352.01
+ l.g.j.c.WriteToFileTest$ExampleEnum-b69af46e:
+ type: "string"
+ examples:
+ - "VALUE_2"
+ - "VALUE_3"
+ enumValue:
+ - "VALUE_2"
+ - "VALUE_3"
+ j.t.LocalDateTime-c4b227a8:
+ type: "string"
+ format: "date-time"
+ examples:
+ - "2022-01-31T23:20:50.52Z"
+ - "1985-04-12T15:59:55-08:00"
+ j.l.Double-bfec6ea6:
type: "number"
format: "double"
- j.l.Float-dbc8e12d:
examples:
- 42.42
- 352.01
- type: "number"
- format: "float"
- j.l.Integer-c5a8ddd3:
- examples:
- - "456565"
- - "4654"
- type: "integer"
- format: "flapping"
- j.l.Integer-decfea64:
- examples:
- - 42
- - 352
+ j.l.Integer-7d3b2498:
type: "integer"
format: "int32"
- j.l.Long-dff9a141:
examples:
- 42
- 352
- type: "integer"
- format: "int64"
- j.l.String-38af4fe9:
- examples:
- - "Lorem"
- - "ipsum"
- type: "string"
- j.m.BigDecimal-dbc8e12d:
- examples:
- - 42.42
- - 352.01
- type: "number"
- format: "float"
- j.t.Instant-b3f0e98:
- examples:
- - "2022-01-31T23:20:50.52Z"
- - "1985-04-12T15:59:55-08:00"
+ j.t.LocalDate-cdf8ba74:
type: "string"
- format: "date-time"
- j.t.LocalDate-b6e08ca0:
+ format: "date"
examples:
- "2022-01-31"
- "1985-04-12"
- type: "string"
- format: "date"
- j.t.LocalDateTime-b3f0e98:
+ j.l.Float-13a8d7b1:
+ type: "number"
+ format: "float"
examples:
- - "2022-01-31T23:20:50.52Z"
- - "1985-04-12T15:59:55-08:00"
- type: "string"
- format: "date-time"
- j.u.List-f544c514:
- type: "array"
- items:
- $ref: "#/components/schemas/j.l.String-38af4fe9"
+ - 42.42
+ - 352.01
l.g.j.c.WriteToFileTest$Example:
title: "Example"
properties:
exampleEnum:
- $ref: "#/components/schemas/l.g.j.c.WriteToFileTest$ExampleEnum-f54df644"
+ $ref: "#/components/schemas/l.g.j.c.WriteToFileTest$ExampleEnum-b69af46e"
intAmount:
- $ref: "#/components/schemas/j.l.Integer-decfea64"
+ $ref: "#/components/schemas/j.l.Integer-7d3b2498"
exampleLocalDateTime:
- $ref: "#/components/schemas/j.t.LocalDateTime-b3f0e98"
+ $ref: "#/components/schemas/j.t.LocalDateTime-c4b227a8"
innerExample:
$ref: "#/components/schemas/l.g.j.c.WriteToFileTest$InnerExample"
finalCurrency:
- $ref: "#/components/schemas/j.l.String-38af4fe9"
+ $ref: "#/components/schemas/j.l.String-714f7ea0"
listCurrency:
- $ref: "#/components/schemas/j.u.List-f544c514"
+ $ref: "#/components/schemas/j.u.List-b1afaed2"
privateFinalCurrency:
- $ref: "#/components/schemas/j.l.String-38af4fe9"
+ $ref: "#/components/schemas/j.l.String-714f7ea0"
isFancy:
- $ref: "#/components/schemas/j.l.Boolean-96239209"
+ $ref: "#/components/schemas/j.l.Boolean-f89d8af0"
doubleAmount:
- $ref: "#/components/schemas/j.l.Double-ed55d4cc"
+ $ref: "#/components/schemas/j.l.Double-bfec6ea6"
exampleInstant:
- $ref: "#/components/schemas/j.t.Instant-b3f0e98"
+ $ref: "#/components/schemas/j.t.Instant-c4b227a8"
floatingAmount:
- $ref: "#/components/schemas/j.l.Float-dbc8e12d"
+ $ref: "#/components/schemas/j.l.Float-13a8d7b1"
bigDecimalAmount:
- $ref: "#/components/schemas/j.m.BigDecimal-dbc8e12d"
+ $ref: "#/components/schemas/j.m.BigDecimal-13a8d7b1"
exampleLocalDate:
- $ref: "#/components/schemas/j.t.LocalDate-b6e08ca0"
+ $ref: "#/components/schemas/j.t.LocalDate-cdf8ba74"
fieldAnnotation:
- $ref: "#/components/schemas/j.l.Integer-c5a8ddd3"
+ $ref: "#/components/schemas/j.l.Integer-95f48e25"
currency:
- $ref: "#/components/schemas/j.l.String-38af4fe9"
+ $ref: "#/components/schemas/j.l.String-714f7ea0"
longAmount:
- $ref: "#/components/schemas/j.l.Long-dff9a141"
- l.g.j.c.WriteToFileTest$ExampleEnum-f54df644:
- examples:
- - "VALUE_2"
- - "VALUE_3"
- type: "string"
- enum:
- - "VALUE_2"
- - "VALUE_3"
- l.g.j.c.WriteToFileTest$InnerExample:
- title: "InnerExample"
- properties:
- innerCurrency:
- $ref: "#/components/schemas/j.l.String-38af4fe9"
- nestedInnerExample:
- $ref: "#/components/schemas/l.g.j.c.WriteToFileTest$NestedInnerExample"
- l.g.j.c.WriteToFileTest$NestedInnerExample:
- title: "NestedInnerExample"
- properties:
- nestedInnerCurrency:
- $ref: "#/components/schemas/j.l.String-38af4fe9"
+ $ref: "#/components/schemas/j.l.Long-8275dd77"
messages:
l.g.j.c.WriteToFileTest$Example:
+ title: "Example"
payload:
$ref: "#/components/schemas/l.g.j.c.WriteToFileTest$Example"
- title: "Example"
diff --git a/j2asyncapi-example/pom.xml b/j2asyncapi-example/pom.xml
index 965383a..3221723 100644
--- a/j2asyncapi-example/pom.xml
+++ b/j2asyncapi-example/pom.xml
@@ -20,13 +20,11 @@
lu.greenhalos
j2asyncapi-annotation
- 1.0-SNAPSHOT
lu.greenhalos
j2asyncapi-processor
- 1.0-SNAPSHOT
test
diff --git a/j2asyncapi-example/src/test/java/lu/greenhalos/j2asyncapi/example/AsyncApiGeneratorTest.java b/j2asyncapi-example/src/test/java/lu/greenhalos/j2asyncapi/example/AsyncApiGeneratorTest.java
index 1c9ba93..da96a50 100644
--- a/j2asyncapi-example/src/test/java/lu/greenhalos/j2asyncapi/example/AsyncApiGeneratorTest.java
+++ b/j2asyncapi-example/src/test/java/lu/greenhalos/j2asyncapi/example/AsyncApiGeneratorTest.java
@@ -1,10 +1,5 @@
package lu.greenhalos.j2asyncapi.example;
-import com.asyncapi.v2.model.AsyncAPI;
-import com.asyncapi.v2.model.info.Contact;
-import com.asyncapi.v2.model.info.Info;
-import com.asyncapi.v2.model.server.Server;
-
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
@@ -12,6 +7,11 @@
import lu.greenhalos.j2asyncapi.annoations.AsyncApiProcessor;
import lu.greenhalos.j2asyncapi.core.Config;
+import lu.greenhalos.j2asyncapi.schemas.AsyncApiDocumentRoot;
+import lu.greenhalos.j2asyncapi.schemas.Contact;
+import lu.greenhalos.j2asyncapi.schemas.Info;
+import lu.greenhalos.j2asyncapi.schemas.Server;
+import lu.greenhalos.j2asyncapi.schemas.Servers;
import org.apache.commons.io.FileUtils;
@@ -20,7 +20,8 @@
import java.io.File;
import java.io.IOException;
-import java.util.Map;
+import java.net.URI;
+import java.net.URISyntaxException;
/**
@@ -33,7 +34,7 @@ public class AsyncApiGeneratorTest {
@Test
void generate() throws IOException {
- var asyncAPI = new AsyncAPI();
+ var asyncAPI = new AsyncApiDocumentRoot();
asyncAPI.setInfo(info());
asyncAPI.setServers(servers());
@@ -46,9 +47,12 @@ void generate() throws IOException {
}
- private Map servers() {
+ private Servers servers() {
+
+ var servers = new Servers();
+ servers.setAdditionalProperty("test", server());
- return Map.of("test", server());
+ return servers;
}
@@ -65,12 +69,25 @@ private Server server() {
private static Info info() {
- return new Info("Application API", "0.1.0", null, null,
- new Contact("Fancy Team", "https://greenhalos.lu", "asyncapi@greenhalos.lu"), null);
+ try {
+ var contact = new Contact();
+ contact.setName("Fancy Team");
+ contact.setUrl(new URI("https://greenhalos.lu"));
+ contact.setEmail("asyncapi@greenhalos.lu");
+
+ var info = new Info();
+ info.setTitle("Application API");
+ info.setVersion("0.1.0");
+ info.setContact(contact);
+
+ return info;
+ } catch (URISyntaxException e) {
+ throw new RuntimeException(e);
+ }
}
- private static void writeToFile(AsyncAPI asyncAPI) throws IOException {
+ private static void writeToFile(AsyncApiDocumentRoot asyncAPI) throws IOException {
var objectMapper = new ObjectMapper(new YAMLFactory().disable(YAMLGenerator.Feature.WRITE_DOC_START_MARKER));
objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
diff --git a/j2asyncapi-processor/pom.xml b/j2asyncapi-processor/pom.xml
index 283e17e..8ddcf07 100644
--- a/j2asyncapi-processor/pom.xml
+++ b/j2asyncapi-processor/pom.xml
@@ -21,7 +21,11 @@
lu.greenhalos
j2asyncapi-annotation
- 1.0-SNAPSHOT
+
+
+
+ lu.greenhalos
+ j2asyncapi-schema
@@ -35,11 +39,6 @@
reflections
-
- com.asyncapi
- asyncapi-core
-
-
org.assertj
assertj-core
diff --git a/j2asyncapi-processor/src/main/java/lu/greenhalos/j2asyncapi/annoations/AsyncApiProcessor.java b/j2asyncapi-processor/src/main/java/lu/greenhalos/j2asyncapi/annoations/AsyncApiProcessor.java
index 1f24878..3392774 100644
--- a/j2asyncapi-processor/src/main/java/lu/greenhalos/j2asyncapi/annoations/AsyncApiProcessor.java
+++ b/j2asyncapi-processor/src/main/java/lu/greenhalos/j2asyncapi/annoations/AsyncApiProcessor.java
@@ -1,12 +1,11 @@
package lu.greenhalos.j2asyncapi.annoations;
-import com.asyncapi.v2.model.channel.ChannelItem;
-import com.asyncapi.v2.model.channel.operation.Operation;
-
import lu.greenhalos.j2asyncapi.annotations.AsyncApi;
import lu.greenhalos.j2asyncapi.annotations.AsyncApis;
import lu.greenhalos.j2asyncapi.core.Config;
import lu.greenhalos.j2asyncapi.core.MessageUtil;
+import lu.greenhalos.j2asyncapi.schemas.ChannelItem;
+import lu.greenhalos.j2asyncapi.schemas.Operation;
import org.reflections.Reflections;
@@ -125,7 +124,7 @@ private static void toChannel(AsyncApi annotation, Config config) {
throw new IllegalStateException("Unexpected value: " + annotation.type());
}
- var channels = config.asyncAPI.getChannels();
+ var channels = config.asyncAPI.getChannels().getAdditionalProperties();
if (channels.containsKey(channelName)) {
result = merge(channels.get(channelName), result);
diff --git a/j2asyncapi-processor/src/main/java/lu/greenhalos/j2asyncapi/core/ClassUtil.java b/j2asyncapi-processor/src/main/java/lu/greenhalos/j2asyncapi/core/ClassUtil.java
index cf38f9f..6e6d0d3 100644
--- a/j2asyncapi-processor/src/main/java/lu/greenhalos/j2asyncapi/core/ClassUtil.java
+++ b/j2asyncapi-processor/src/main/java/lu/greenhalos/j2asyncapi/core/ClassUtil.java
@@ -1,7 +1,7 @@
package lu.greenhalos.j2asyncapi.core;
-import com.asyncapi.v2.model.Reference;
-import com.asyncapi.v2.model.schema.Schema;
+import lu.greenhalos.j2asyncapi.schemas.Reference;
+import lu.greenhalos.j2asyncapi.schemas.Schema;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -62,7 +62,7 @@ private static Reference process(@Nullable Field field, Class> targetClass, Co
var fieldSchema = ClassUtil.process(declaredField, config);
var schema = new Schema();
- schema.setRef(fieldSchema.getRef());
+ schema.set$ref(fieldSchema.get$ref());
properties.put(declaredField.getName(), schema);
}
@@ -70,7 +70,7 @@ private static Reference process(@Nullable Field field, Class> targetClass, Co
schema.setTitle(targetClass.getSimpleName());
schema.setProperties(properties);
- config.asyncAPI.getComponents().getSchemas().put(name(targetClass), schema);
+ config.asyncAPI.getComponents().getSchemas().getAdditionalProperties().put(name(targetClass), schema);
return new Reference(String.format("#/components/schemas/%s", name(targetClass)));
}
diff --git a/j2asyncapi-processor/src/main/java/lu/greenhalos/j2asyncapi/core/Config.java b/j2asyncapi-processor/src/main/java/lu/greenhalos/j2asyncapi/core/Config.java
index 12d9374..df6e191 100644
--- a/j2asyncapi-processor/src/main/java/lu/greenhalos/j2asyncapi/core/Config.java
+++ b/j2asyncapi-processor/src/main/java/lu/greenhalos/j2asyncapi/core/Config.java
@@ -1,8 +1,5 @@
package lu.greenhalos.j2asyncapi.core;
-import com.asyncapi.v2.model.AsyncAPI;
-import com.asyncapi.v2.model.component.Components;
-
import lu.greenhalos.j2asyncapi.core.fields.BooleanFieldType;
import lu.greenhalos.j2asyncapi.core.fields.DateFieldType;
import lu.greenhalos.j2asyncapi.core.fields.DateTimeFieldType;
@@ -12,10 +9,14 @@
import lu.greenhalos.j2asyncapi.core.fields.ListFieldType;
import lu.greenhalos.j2asyncapi.core.fields.NumberFieldType;
import lu.greenhalos.j2asyncapi.core.fields.StringFieldType;
+import lu.greenhalos.j2asyncapi.schemas.AsyncApiDocumentRoot;
+import lu.greenhalos.j2asyncapi.schemas.Channels;
+import lu.greenhalos.j2asyncapi.schemas.Components;
+import lu.greenhalos.j2asyncapi.schemas.Messages;
+import lu.greenhalos.j2asyncapi.schemas.Schemas;
import java.util.ArrayList;
import java.util.List;
-import java.util.TreeMap;
/**
@@ -24,7 +25,7 @@
public class Config {
final List fieldTypes;
- public final AsyncAPI asyncAPI;
+ public final AsyncApiDocumentRoot asyncAPI;
private Config(Builder builder) {
@@ -32,11 +33,12 @@ private Config(Builder builder) {
this.asyncAPI = builder.asyncAPI;
var components = new Components();
- components.setMessages(new TreeMap<>(String::compareTo));
- components.setSchemas(new TreeMap<>(String::compareTo));
+
+ components.setMessages(new Messages());
+ components.setSchemas(new Schemas());
// TODO check if there are no components yet
- this.asyncAPI.setChannels(new TreeMap<>(String::compareTo));
+ this.asyncAPI.setChannels(new Channels());
this.asyncAPI.setComponents(components);
}
@@ -58,7 +60,7 @@ public static class Builder {
new EnumFieldType(), new DateFieldType(), new DateTimeFieldType());
private final List fieldTypes = new ArrayList<>(DEFAULT_FIELD_TYPES);
- private AsyncAPI asyncAPI;
+ private AsyncApiDocumentRoot asyncAPI;
public Builder add(FieldType fieldType) {
@@ -68,7 +70,7 @@ public Builder add(FieldType fieldType) {
}
- public Builder withAsyncApi(AsyncAPI asyncAPI) {
+ public Builder withAsyncApi(AsyncApiDocumentRoot asyncAPI) {
this.asyncAPI = asyncAPI;
@@ -79,7 +81,7 @@ public Builder withAsyncApi(AsyncAPI asyncAPI) {
public Config build() {
if (this.asyncAPI == null) {
- this.asyncAPI = new AsyncAPI();
+ this.asyncAPI = new AsyncApiDocumentRoot();
}
return new Config(this);
diff --git a/j2asyncapi-processor/src/main/java/lu/greenhalos/j2asyncapi/core/FieldUtil.java b/j2asyncapi-processor/src/main/java/lu/greenhalos/j2asyncapi/core/FieldUtil.java
index 998bfd0..e3d0473 100644
--- a/j2asyncapi-processor/src/main/java/lu/greenhalos/j2asyncapi/core/FieldUtil.java
+++ b/j2asyncapi-processor/src/main/java/lu/greenhalos/j2asyncapi/core/FieldUtil.java
@@ -1,10 +1,9 @@
package lu.greenhalos.j2asyncapi.core;
-import com.asyncapi.v2.model.Reference;
-import com.asyncapi.v2.model.schema.Schema;
-
import lu.greenhalos.j2asyncapi.annotations.AsyncApi;
import lu.greenhalos.j2asyncapi.core.fields.FieldType;
+import lu.greenhalos.j2asyncapi.schemas.Reference;
+import lu.greenhalos.j2asyncapi.schemas.Schema;
import java.lang.reflect.Field;
@@ -44,7 +43,7 @@ public static Reference process(Class> originalTargetClass, @Nullable Field fi
.orElseThrow(() -> new IllegalArgumentException(""));
var schemaName = String.format("%s-%x", name(targetClass), schema.hashCode());
- config.asyncAPI.getComponents().getSchemas().put(schemaName, schema);
+ config.asyncAPI.getComponents().getSchemas().getAdditionalProperties().put(schemaName, schema);
return new Reference(String.format("#/components/schemas/%s", schemaName));
}
diff --git a/j2asyncapi-processor/src/main/java/lu/greenhalos/j2asyncapi/core/MessageUtil.java b/j2asyncapi-processor/src/main/java/lu/greenhalos/j2asyncapi/core/MessageUtil.java
index 6d60fcb..f20aa47 100644
--- a/j2asyncapi-processor/src/main/java/lu/greenhalos/j2asyncapi/core/MessageUtil.java
+++ b/j2asyncapi-processor/src/main/java/lu/greenhalos/j2asyncapi/core/MessageUtil.java
@@ -1,9 +1,8 @@
package lu.greenhalos.j2asyncapi.core;
-import com.asyncapi.v2.model.Reference;
-import com.asyncapi.v2.model.channel.message.Message;
-
import lu.greenhalos.j2asyncapi.annotations.AsyncApi;
+import lu.greenhalos.j2asyncapi.schemas.Message;
+import lu.greenhalos.j2asyncapi.schemas.Reference;
import static lu.greenhalos.j2asyncapi.core.ClassNameUtil.name;
@@ -26,7 +25,7 @@ public static Reference process(Class> targetClass, Config config) {
result.setDescription(annotation.description());
}
- config.asyncAPI.getComponents().getMessages().put(name(targetClass), result);
+ config.asyncAPI.getComponents().getMessages().getAdditionalProperties().put(name(targetClass), result);
return new Reference(String.format("#/components/messages/%s", name(targetClass)));
}
diff --git a/j2asyncapi-processor/src/main/java/lu/greenhalos/j2asyncapi/core/fields/EnumFieldType.java b/j2asyncapi-processor/src/main/java/lu/greenhalos/j2asyncapi/core/fields/EnumFieldType.java
index 177477c..dec1346 100644
--- a/j2asyncapi-processor/src/main/java/lu/greenhalos/j2asyncapi/core/fields/EnumFieldType.java
+++ b/j2asyncapi-processor/src/main/java/lu/greenhalos/j2asyncapi/core/fields/EnumFieldType.java
@@ -1,8 +1,7 @@
package lu.greenhalos.j2asyncapi.core.fields;
-import com.asyncapi.v2.model.schema.Schema;
-
import lu.greenhalos.j2asyncapi.core.Config;
+import lu.greenhalos.j2asyncapi.schemas.Schema;
import java.lang.reflect.Field;
diff --git a/j2asyncapi-processor/src/main/java/lu/greenhalos/j2asyncapi/core/fields/FieldType.java b/j2asyncapi-processor/src/main/java/lu/greenhalos/j2asyncapi/core/fields/FieldType.java
index 8536720..0c0feac 100644
--- a/j2asyncapi-processor/src/main/java/lu/greenhalos/j2asyncapi/core/fields/FieldType.java
+++ b/j2asyncapi-processor/src/main/java/lu/greenhalos/j2asyncapi/core/fields/FieldType.java
@@ -1,8 +1,7 @@
package lu.greenhalos.j2asyncapi.core.fields;
-import com.asyncapi.v2.model.schema.Schema;
-
import lu.greenhalos.j2asyncapi.core.Config;
+import lu.greenhalos.j2asyncapi.schemas.Schema;
import java.lang.reflect.Field;
diff --git a/j2asyncapi-processor/src/main/java/lu/greenhalos/j2asyncapi/core/fields/ListFieldType.java b/j2asyncapi-processor/src/main/java/lu/greenhalos/j2asyncapi/core/fields/ListFieldType.java
index 95403b3..225c104 100644
--- a/j2asyncapi-processor/src/main/java/lu/greenhalos/j2asyncapi/core/fields/ListFieldType.java
+++ b/j2asyncapi-processor/src/main/java/lu/greenhalos/j2asyncapi/core/fields/ListFieldType.java
@@ -1,9 +1,8 @@
package lu.greenhalos.j2asyncapi.core.fields;
-import com.asyncapi.v2.model.schema.Schema;
-
import lu.greenhalos.j2asyncapi.core.ClassUtil;
import lu.greenhalos.j2asyncapi.core.Config;
+import lu.greenhalos.j2asyncapi.schemas.Schema;
import java.lang.reflect.Field;
import java.lang.reflect.ParameterizedType;
diff --git a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/annoations/AsyncApiProcessorTest.java b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/annoations/AsyncApiProcessorTest.java
index bf94959..1860da5 100644
--- a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/annoations/AsyncApiProcessorTest.java
+++ b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/annoations/AsyncApiProcessorTest.java
@@ -1,15 +1,14 @@
package lu.greenhalos.j2asyncapi.annoations;
-import com.asyncapi.v2.model.AsyncAPI;
-import com.asyncapi.v2.model.Reference;
-import com.asyncapi.v2.model.channel.ChannelItem;
-import com.asyncapi.v2.model.channel.operation.Operation;
-
import lu.greenhalos.j2asyncapi.annoations.example.ExampleBaseApplication;
import lu.greenhalos.j2asyncapi.annoations.example.listener.ExampleListener;
import lu.greenhalos.j2asyncapi.annoations.example.publisher.ExamplePublisher;
import lu.greenhalos.j2asyncapi.core.Config;
import lu.greenhalos.j2asyncapi.core.MessageUtil;
+import lu.greenhalos.j2asyncapi.schemas.AsyncApiDocumentRoot;
+import lu.greenhalos.j2asyncapi.schemas.ChannelItem;
+import lu.greenhalos.j2asyncapi.schemas.Operation;
+import lu.greenhalos.j2asyncapi.schemas.Reference;
import org.junit.jupiter.api.Test;
@@ -23,7 +22,7 @@ class AsyncApiProcessorTest {
@Test
void process() {
- var asyncAPI = new AsyncAPI();
+ var asyncAPI = new AsyncApiDocumentRoot();
var config = Config.builder().withAsyncApi(asyncAPI).build();
AsyncApiProcessor.process(ExampleBaseApplication.class, config);
@@ -52,6 +51,6 @@ void process() {
"exchange/routing.key.multiple2", channelItemEmptyMessage, //
"routing.key.default.exchange", channelItemEmptyMessage //
);
- assertThat(asyncAPI.getChannels()).usingRecursiveComparison().isEqualTo(expected);
+ assertThat(asyncAPI.getChannels().getAdditionalProperties()).usingRecursiveComparison().isEqualTo(expected);
}
}
diff --git a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/annoations/WriteToFileTest.java b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/annoations/WriteToFileTest.java
index 27ffcda..e4ebbe1 100644
--- a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/annoations/WriteToFileTest.java
+++ b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/annoations/WriteToFileTest.java
@@ -1,10 +1,5 @@
package lu.greenhalos.j2asyncapi.annoations;
-import com.asyncapi.v2.model.AsyncAPI;
-import com.asyncapi.v2.model.info.Contact;
-import com.asyncapi.v2.model.info.Info;
-import com.asyncapi.v2.model.server.Server;
-
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
@@ -13,6 +8,11 @@
import lu.greenhalos.j2asyncapi.annoations.example.ExampleBaseApplication;
import lu.greenhalos.j2asyncapi.annoations.example.listener.ExampleListener.ObjectRepresentingAnId;
import lu.greenhalos.j2asyncapi.core.Config;
+import lu.greenhalos.j2asyncapi.schemas.AsyncApiDocumentRoot;
+import lu.greenhalos.j2asyncapi.schemas.Contact;
+import lu.greenhalos.j2asyncapi.schemas.Info;
+import lu.greenhalos.j2asyncapi.schemas.Server;
+import lu.greenhalos.j2asyncapi.schemas.Servers;
import org.apache.commons.io.FileUtils;
@@ -21,7 +21,8 @@
import java.io.File;
import java.io.IOException;
-import java.util.Map;
+import java.net.URI;
+import java.net.URISyntaxException;
import static lu.greenhalos.j2asyncapi.core.fields.SimpleFieldType.fieldType;
@@ -36,7 +37,7 @@ public class WriteToFileTest {
@Test
void generate() throws IOException {
- var asyncAPI = new AsyncAPI();
+ var asyncAPI = new AsyncApiDocumentRoot();
asyncAPI.setInfo(info());
asyncAPI.setServers(servers());
@@ -54,9 +55,12 @@ void generate() throws IOException {
}
- private Map servers() {
+ private Servers servers() {
+
+ var servers = new Servers();
+ servers.setAdditionalProperty("test", server());
- return Map.of("test", server());
+ return servers;
}
@@ -73,12 +77,25 @@ private Server server() {
private static Info info() {
- return new Info("Application API", "0.1.0", null, null,
- new Contact("Fancy Team", "https://greenhalos.lu", "asyncapi@greenhalos.lu"), null);
+ try {
+ var contact = new Contact();
+ contact.setName("Fancy Team");
+ contact.setUrl(new URI("https://greenhalos.lu"));
+ contact.setEmail("asyncapi@greenhalos.lu");
+
+ var info = new Info();
+ info.setTitle("Application API");
+ info.setVersion("0.1.0");
+ info.setContact(contact);
+
+ return info;
+ } catch (URISyntaxException e) {
+ throw new RuntimeException(e);
+ }
}
- private static void writeToFile(AsyncAPI asyncAPI) throws IOException {
+ private static void writeToFile(AsyncApiDocumentRoot asyncAPI) throws IOException {
var objectMapper = new ObjectMapper(new YAMLFactory().disable(YAMLGenerator.Feature.WRITE_DOC_START_MARKER));
objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
diff --git a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/BigDecimalTest.java b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/BigDecimalTest.java
index aad2215..9263346 100644
--- a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/BigDecimalTest.java
+++ b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/BigDecimalTest.java
@@ -1,6 +1,6 @@
package lu.greenhalos.j2asyncapi.core;
-import com.asyncapi.v2.model.schema.Schema;
+import lu.greenhalos.j2asyncapi.schemas.Schema;
import org.junit.jupiter.api.Test;
diff --git a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/BooleanPrimitiveTest.java b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/BooleanPrimitiveTest.java
index 22ed102..0ab0e4b 100644
--- a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/BooleanPrimitiveTest.java
+++ b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/BooleanPrimitiveTest.java
@@ -1,6 +1,6 @@
package lu.greenhalos.j2asyncapi.core;
-import com.asyncapi.v2.model.schema.Schema;
+import lu.greenhalos.j2asyncapi.schemas.Schema;
import org.junit.jupiter.api.Test;
diff --git a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/BooleanTest.java b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/BooleanTest.java
index ab7a122..c544e92 100644
--- a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/BooleanTest.java
+++ b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/BooleanTest.java
@@ -1,6 +1,6 @@
package lu.greenhalos.j2asyncapi.core;
-import com.asyncapi.v2.model.schema.Schema;
+import lu.greenhalos.j2asyncapi.schemas.Schema;
import org.junit.jupiter.api.Test;
diff --git a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/ClassExtendsTest.java b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/ClassExtendsTest.java
index 4151183..a512bd4 100644
--- a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/ClassExtendsTest.java
+++ b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/ClassExtendsTest.java
@@ -1,6 +1,6 @@
package lu.greenhalos.j2asyncapi.core;
-import com.asyncapi.v2.model.schema.Schema;
+import lu.greenhalos.j2asyncapi.schemas.Schema;
import org.junit.jupiter.api.Test;
diff --git a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/CollectionListTest.java b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/CollectionListTest.java
index 459f7a7..2d449f6 100644
--- a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/CollectionListTest.java
+++ b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/CollectionListTest.java
@@ -1,7 +1,7 @@
package lu.greenhalos.j2asyncapi.core;
-import com.asyncapi.v2.model.Reference;
-import com.asyncapi.v2.model.schema.Schema;
+import lu.greenhalos.j2asyncapi.schemas.Reference;
+import lu.greenhalos.j2asyncapi.schemas.Schema;
import org.junit.jupiter.api.Test;
@@ -22,7 +22,7 @@ void testField() {
stringSchema.setFormat(null);
stringSchema.setExamples(List.of("Lorem", "ipsum"));
- var itemSchema = new Reference("#/components/schemas/j.l.String-38af4fe9");
+ var itemSchema = new Reference("#/components/schemas/j.l.String-714f7ea0");
var fieldSchema = new Schema();
fieldSchema.setType("array");
fieldSchema.setFormat(null);
@@ -30,8 +30,8 @@ void testField() {
fieldSchema.setItems(itemSchema);
var expectedSchemasForField = Map.of( //
- "j.l.String-38af4fe9", stringSchema, //
- "j.u.List-f544c514", fieldSchema //
+ "j.l.String-714f7ea0", stringSchema, //
+ "j.u.List-b1afaed2", fieldSchema //
);
FieldTestUtil.assertSchemaOnClass(Example.class, expectedSchemasForField, fieldSchema.hashCode());
diff --git a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/CollectionSetTest.java b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/CollectionSetTest.java
index e98b973..2d6026b 100644
--- a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/CollectionSetTest.java
+++ b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/CollectionSetTest.java
@@ -1,7 +1,7 @@
package lu.greenhalos.j2asyncapi.core;
-import com.asyncapi.v2.model.Reference;
-import com.asyncapi.v2.model.schema.Schema;
+import lu.greenhalos.j2asyncapi.schemas.Reference;
+import lu.greenhalos.j2asyncapi.schemas.Schema;
import org.junit.jupiter.api.Test;
@@ -23,7 +23,7 @@ void testField() {
stringSchema.setFormat(null);
stringSchema.setExamples(List.of("Lorem", "ipsum"));
- var itemSchema = new Reference("#/components/schemas/j.l.String-38af4fe9");
+ var itemSchema = new Reference("#/components/schemas/j.l.String-714f7ea0");
var fieldSchema = new Schema();
fieldSchema.setType("array");
fieldSchema.setFormat(null);
@@ -31,8 +31,8 @@ void testField() {
fieldSchema.setItems(itemSchema);
var expectedSchemasForField = Map.of( //
- "j.l.String-38af4fe9", stringSchema, //
- "j.u.Set-f544c514", fieldSchema //
+ "j.l.String-714f7ea0", stringSchema, //
+ "j.u.Set-b1afaed2", fieldSchema //
);
FieldTestUtil.assertSchemaOnClass(Example.class, expectedSchemasForField, fieldSchema.hashCode());
diff --git a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/ConfigTest.java b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/ConfigTest.java
index e5e7cdc..5d32c40 100644
--- a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/ConfigTest.java
+++ b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/ConfigTest.java
@@ -1,8 +1,7 @@
package lu.greenhalos.j2asyncapi.core;
-import com.asyncapi.v2.model.AsyncAPI;
-
import lu.greenhalos.j2asyncapi.core.fields.FieldType;
+import lu.greenhalos.j2asyncapi.schemas.AsyncApiDocumentRoot;
import org.junit.jupiter.api.Test;
@@ -50,7 +49,7 @@ void builder_addFieldType() {
@Test
void builder_asyncAPI() {
- var asyncAPI = new AsyncAPI();
+ var asyncAPI = new AsyncApiDocumentRoot();
var result = Config.builder().withAsyncApi(asyncAPI).build();
assertThat(result.asyncAPI).isSameAs(asyncAPI);
diff --git a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/DoublePrimitiveTest.java b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/DoublePrimitiveTest.java
index e1fc0d4..164ede6 100644
--- a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/DoublePrimitiveTest.java
+++ b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/DoublePrimitiveTest.java
@@ -1,6 +1,6 @@
package lu.greenhalos.j2asyncapi.core;
-import com.asyncapi.v2.model.schema.Schema;
+import lu.greenhalos.j2asyncapi.schemas.Schema;
import org.junit.jupiter.api.Test;
diff --git a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/DoubleTest.java b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/DoubleTest.java
index 8efe679..964e19b 100644
--- a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/DoubleTest.java
+++ b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/DoubleTest.java
@@ -1,6 +1,6 @@
package lu.greenhalos.j2asyncapi.core;
-import com.asyncapi.v2.model.schema.Schema;
+import lu.greenhalos.j2asyncapi.schemas.Schema;
import org.junit.jupiter.api.Test;
diff --git a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/EnumTest.java b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/EnumTest.java
index ca6b5e4..645aa1d 100644
--- a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/EnumTest.java
+++ b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/EnumTest.java
@@ -1,6 +1,6 @@
package lu.greenhalos.j2asyncapi.core;
-import com.asyncapi.v2.model.schema.Schema;
+import lu.greenhalos.j2asyncapi.schemas.Schema;
import org.junit.jupiter.api.Test;
diff --git a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/FieldTestUtil.java b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/FieldTestUtil.java
index 4f34362..91eb03e 100644
--- a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/FieldTestUtil.java
+++ b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/FieldTestUtil.java
@@ -1,10 +1,8 @@
package lu.greenhalos.j2asyncapi.core;
-import com.asyncapi.v2.model.Reference;
-import com.asyncapi.v2.model.channel.message.Message;
-import com.asyncapi.v2.model.schema.Schema;
-
-import lombok.SneakyThrows;
+import lu.greenhalos.j2asyncapi.schemas.Message;
+import lu.greenhalos.j2asyncapi.schemas.Reference;
+import lu.greenhalos.j2asyncapi.schemas.Schema;
import java.lang.reflect.Field;
@@ -60,11 +58,12 @@ public static void assertSchemaOnClass(Class> exampleClass, Map expectedMessages = Map.of(name(exampleClass), message);
- assertThat(config.asyncAPI.getComponents().getMessages()).usingRecursiveComparison()
+ assertThat(config.asyncAPI.getComponents().getMessages().getAdditionalProperties()).usingRecursiveComparison()
.isEqualTo(expectedMessages);
var fieldReferenceSchema = new Schema();
- fieldReferenceSchema.setRef(String.format("#/components/schemas/%s-%x", name(fieldType), fieldSchemaHashCode));
+ fieldReferenceSchema.set$ref(String.format("#/components/schemas/%s-%x", name(fieldType),
+ fieldSchemaHashCode));
var exampleSchema = new Schema();
exampleSchema.setTitle("Example");
@@ -73,18 +72,23 @@ public static void assertSchemaOnClass(Class> exampleClass, Map expectedSchemas = new HashMap<>();
expectedSchemas.put(name(exampleClass), exampleSchema);
expectedSchemas.putAll(expectedSchemasForField);
- assertThat(config.asyncAPI.getComponents().getSchemas()).usingRecursiveComparison().isEqualTo(expectedSchemas);
+
+ assertThat(config.asyncAPI.getComponents().getSchemas().getAdditionalProperties()).usingRecursiveComparison()
+ .isEqualTo(expectedSchemas);
}
- @SneakyThrows
private static Class> getFieldType(Class> exampleClass) {
- return getAllFields(exampleClass).stream()
- .filter(f -> "field".equals(f.getName()))
- .findFirst()
- .map(Field::getType)
- .orElseThrow(() -> new NoSuchFieldException("field"));
+ try {
+ return getAllFields(exampleClass).stream()
+ .filter(f -> "field".equals(f.getName()))
+ .findFirst()
+ .map(Field::getType)
+ .orElseThrow(() -> new NoSuchFieldException("field"));
+ } catch (NoSuchFieldException e) {
+ throw new RuntimeException(e);
+ }
}
diff --git a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/FinalStringTest.java b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/FinalStringTest.java
index 0c448cf..1c4b942 100644
--- a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/FinalStringTest.java
+++ b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/FinalStringTest.java
@@ -1,6 +1,6 @@
package lu.greenhalos.j2asyncapi.core;
-import com.asyncapi.v2.model.schema.Schema;
+import lu.greenhalos.j2asyncapi.schemas.Schema;
import org.junit.jupiter.api.Test;
diff --git a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/FloatPrimitiveTest.java b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/FloatPrimitiveTest.java
index 4543de9..fa582e1 100644
--- a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/FloatPrimitiveTest.java
+++ b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/FloatPrimitiveTest.java
@@ -1,6 +1,6 @@
package lu.greenhalos.j2asyncapi.core;
-import com.asyncapi.v2.model.schema.Schema;
+import lu.greenhalos.j2asyncapi.schemas.Schema;
import org.junit.jupiter.api.Test;
diff --git a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/FloatTest.java b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/FloatTest.java
index 14b9fcc..df6623b 100644
--- a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/FloatTest.java
+++ b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/FloatTest.java
@@ -1,6 +1,6 @@
package lu.greenhalos.j2asyncapi.core;
-import com.asyncapi.v2.model.schema.Schema;
+import lu.greenhalos.j2asyncapi.schemas.Schema;
import org.junit.jupiter.api.Test;
diff --git a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/InstantTest.java b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/InstantTest.java
index a29ffe9..606a4f0 100644
--- a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/InstantTest.java
+++ b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/InstantTest.java
@@ -1,6 +1,6 @@
package lu.greenhalos.j2asyncapi.core;
-import com.asyncapi.v2.model.schema.Schema;
+import lu.greenhalos.j2asyncapi.schemas.Schema;
import org.junit.jupiter.api.Test;
diff --git a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/IntegerPrimitiveTest.java b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/IntegerPrimitiveTest.java
index 7564904..bfbf2ce 100644
--- a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/IntegerPrimitiveTest.java
+++ b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/IntegerPrimitiveTest.java
@@ -1,6 +1,6 @@
package lu.greenhalos.j2asyncapi.core;
-import com.asyncapi.v2.model.schema.Schema;
+import lu.greenhalos.j2asyncapi.schemas.Schema;
import org.junit.jupiter.api.Test;
diff --git a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/IntegerTest.java b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/IntegerTest.java
index e219976..0559c8f 100644
--- a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/IntegerTest.java
+++ b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/IntegerTest.java
@@ -1,6 +1,6 @@
package lu.greenhalos.j2asyncapi.core;
-import com.asyncapi.v2.model.schema.Schema;
+import lu.greenhalos.j2asyncapi.schemas.Schema;
import org.junit.jupiter.api.Test;
diff --git a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/LocalDateTest.java b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/LocalDateTest.java
index 8bc1f64..a2db4d3 100644
--- a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/LocalDateTest.java
+++ b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/LocalDateTest.java
@@ -1,6 +1,6 @@
package lu.greenhalos.j2asyncapi.core;
-import com.asyncapi.v2.model.schema.Schema;
+import lu.greenhalos.j2asyncapi.schemas.Schema;
import org.junit.jupiter.api.Test;
diff --git a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/LocalDateTimeTest.java b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/LocalDateTimeTest.java
index cbebd3a..8658d37 100644
--- a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/LocalDateTimeTest.java
+++ b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/LocalDateTimeTest.java
@@ -1,6 +1,6 @@
package lu.greenhalos.j2asyncapi.core;
-import com.asyncapi.v2.model.schema.Schema;
+import lu.greenhalos.j2asyncapi.schemas.Schema;
import org.junit.jupiter.api.Test;
diff --git a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/LongPrimitiveTest.java b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/LongPrimitiveTest.java
index 56e0cac..73911b4 100644
--- a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/LongPrimitiveTest.java
+++ b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/LongPrimitiveTest.java
@@ -1,6 +1,6 @@
package lu.greenhalos.j2asyncapi.core;
-import com.asyncapi.v2.model.schema.Schema;
+import lu.greenhalos.j2asyncapi.schemas.Schema;
import org.junit.jupiter.api.Test;
diff --git a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/LongTest.java b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/LongTest.java
index 56429ae..278cf43 100644
--- a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/LongTest.java
+++ b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/LongTest.java
@@ -1,6 +1,6 @@
package lu.greenhalos.j2asyncapi.core;
-import com.asyncapi.v2.model.schema.Schema;
+import lu.greenhalos.j2asyncapi.schemas.Schema;
import org.junit.jupiter.api.Test;
diff --git a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/NestedTest.java b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/NestedTest.java
index ba15854..6c3c916 100644
--- a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/NestedTest.java
+++ b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/NestedTest.java
@@ -1,6 +1,6 @@
package lu.greenhalos.j2asyncapi.core;
-import com.asyncapi.v2.model.schema.Schema;
+import lu.greenhalos.j2asyncapi.schemas.Schema;
import org.junit.jupiter.api.Test;
@@ -22,14 +22,14 @@ void testField() {
stringSchema.setExamples(List.of("Lorem", "ipsum"));
var nestedSchemaReference = new Schema();
- nestedSchemaReference.setRef("#/components/schemas/j.l.String-38af4fe9");
+ nestedSchemaReference.set$ref("#/components/schemas/j.l.String-714f7ea0");
var nestedSchema = new Schema();
nestedSchema.setTitle("Nested");
nestedSchema.setProperties(Map.of("field2", nestedSchemaReference));
var field2Reference = new Schema();
- field2Reference.setRef("#/components/schemas/l.g.j.c.NestedTest$Nested");
+ field2Reference.set$ref("#/components/schemas/l.g.j.c.NestedTest$Nested");
var fieldSchema = new Schema();
fieldSchema.setTitle("Example");
@@ -39,7 +39,7 @@ void testField() {
fieldSchema.setProperties(Map.of("field", field2Reference));
var expectedSchemasForField = Map.of( //
- "j.l.String-38af4fe9", stringSchema, //
+ "j.l.String-714f7ea0", stringSchema, //
"l.g.j.c.NestedTest$Example", fieldSchema, //
"l.g.j.c.NestedTest$Nested", nestedSchema //
);
diff --git a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/StaticFinalTest.java b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/StaticFinalTest.java
index 145ca3c..6ca2b95 100644
--- a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/StaticFinalTest.java
+++ b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/StaticFinalTest.java
@@ -1,6 +1,6 @@
package lu.greenhalos.j2asyncapi.core;
-import com.asyncapi.v2.model.schema.Schema;
+import lu.greenhalos.j2asyncapi.schemas.Schema;
import org.junit.jupiter.api.Test;
diff --git a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/StringTest.java b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/StringTest.java
index e6feca3..0d87b9a 100644
--- a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/StringTest.java
+++ b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/StringTest.java
@@ -1,6 +1,6 @@
package lu.greenhalos.j2asyncapi.core;
-import com.asyncapi.v2.model.schema.Schema;
+import lu.greenhalos.j2asyncapi.schemas.Schema;
import org.junit.jupiter.api.Test;
diff --git a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/WriteToFileTest.java b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/WriteToFileTest.java
index 95a210e..6b7d2ea 100644
--- a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/WriteToFileTest.java
+++ b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/WriteToFileTest.java
@@ -1,19 +1,18 @@
package lu.greenhalos.j2asyncapi.core;
-import com.asyncapi.v2.model.AsyncAPI;
-import com.asyncapi.v2.model.channel.ChannelItem;
-import com.asyncapi.v2.model.channel.operation.Operation;
-import com.asyncapi.v2.model.component.Components;
-import com.asyncapi.v2.model.info.Contact;
-import com.asyncapi.v2.model.info.Info;
-import com.asyncapi.v2.model.server.Server;
-
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
import com.fasterxml.jackson.dataformat.yaml.YAMLGenerator;
import lu.greenhalos.j2asyncapi.annotations.AsyncApi;
+import lu.greenhalos.j2asyncapi.schemas.AsyncApiDocumentRoot;
+import lu.greenhalos.j2asyncapi.schemas.ChannelItem;
+import lu.greenhalos.j2asyncapi.schemas.Contact;
+import lu.greenhalos.j2asyncapi.schemas.Info;
+import lu.greenhalos.j2asyncapi.schemas.Operation;
+import lu.greenhalos.j2asyncapi.schemas.Server;
+import lu.greenhalos.j2asyncapi.schemas.Servers;
import org.apache.commons.io.FileUtils;
@@ -24,13 +23,14 @@
import java.math.BigDecimal;
+import java.net.URI;
+import java.net.URISyntaxException;
+
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
/**
@@ -49,12 +49,7 @@ private enum ExampleEnum {
@Test
void generate() throws IOException {
- var components = new Components();
- components.setMessages(new HashMap<>());
- components.setSchemas(new HashMap<>());
-
- var asyncAPI = new AsyncAPI();
- asyncAPI.setComponents(components);
+ var asyncAPI = new AsyncApiDocumentRoot();
asyncAPI.setInfo(info());
asyncAPI.setServers(servers());
@@ -68,14 +63,17 @@ void generate() throws IOException {
channelItem.setDescription("Publish information");
channelItem.setSubscribe(subscribe);
- asyncAPI.setChannels(Map.of("channelName", channelItem));
+ asyncAPI.getChannels().setAdditionalProperty("channelName", channelItem);
writeToFile(asyncAPI);
}
- private Map servers() {
+ private Servers servers() {
+
+ var servers = new Servers();
+ servers.setAdditionalProperty("test", server());
- return Map.of("test", server());
+ return servers;
}
@@ -92,12 +90,25 @@ private Server server() {
private static Info info() {
- return new Info("Application API", "0.1.0", null, null,
- new Contact("Fancy Team", "https://greenhalos.lu", "asyncapi@greenhalos.lu"), null);
+ try {
+ var contact = new Contact();
+ contact.setName("Fancy Team");
+ contact.setUrl(new URI("https://greenhalos.lu"));
+ contact.setEmail("asyncapi@greenhalos.lu");
+
+ var info = new Info();
+ info.setTitle("Application API");
+ info.setVersion("0.1.0");
+ info.setContact(contact);
+
+ return info;
+ } catch (URISyntaxException e) {
+ throw new RuntimeException(e);
+ }
}
- private static void writeToFile(AsyncAPI asyncAPI) throws IOException {
+ private static void writeToFile(AsyncApiDocumentRoot asyncAPI) throws IOException {
var objectMapper = new ObjectMapper(new YAMLFactory().disable(YAMLGenerator.Feature.WRITE_DOC_START_MARKER));
objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
diff --git a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/annotations/FieldExamplesTest.java b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/annotations/FieldExamplesTest.java
index 5a7d3bc..05349d3 100644
--- a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/annotations/FieldExamplesTest.java
+++ b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/annotations/FieldExamplesTest.java
@@ -1,9 +1,8 @@
package lu.greenhalos.j2asyncapi.core.annotations;
-import com.asyncapi.v2.model.schema.Schema;
-
import lu.greenhalos.j2asyncapi.annotations.AsyncApi;
import lu.greenhalos.j2asyncapi.core.FieldTestUtil;
+import lu.greenhalos.j2asyncapi.schemas.Schema;
import org.junit.jupiter.api.Test;
diff --git a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/annotations/FieldFormatTest.java b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/annotations/FieldFormatTest.java
index e1138e7..8aa8af0 100644
--- a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/annotations/FieldFormatTest.java
+++ b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/annotations/FieldFormatTest.java
@@ -1,9 +1,8 @@
package lu.greenhalos.j2asyncapi.core.annotations;
-import com.asyncapi.v2.model.schema.Schema;
-
import lu.greenhalos.j2asyncapi.annotations.AsyncApi;
import lu.greenhalos.j2asyncapi.core.FieldTestUtil;
+import lu.greenhalos.j2asyncapi.schemas.Schema;
import org.junit.jupiter.api.Test;
diff --git a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/annotations/FieldNothingSetTest.java b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/annotations/FieldNothingSetTest.java
index dd362b1..e77be89 100644
--- a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/annotations/FieldNothingSetTest.java
+++ b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/annotations/FieldNothingSetTest.java
@@ -1,9 +1,8 @@
package lu.greenhalos.j2asyncapi.core.annotations;
-import com.asyncapi.v2.model.schema.Schema;
-
import lu.greenhalos.j2asyncapi.annotations.AsyncApi;
import lu.greenhalos.j2asyncapi.core.FieldTestUtil;
+import lu.greenhalos.j2asyncapi.schemas.Schema;
import org.junit.jupiter.api.Test;
diff --git a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/annotations/FieldTypeTest.java b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/annotations/FieldTypeTest.java
index 1134f57..3ad2092 100644
--- a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/annotations/FieldTypeTest.java
+++ b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/annotations/FieldTypeTest.java
@@ -1,9 +1,8 @@
package lu.greenhalos.j2asyncapi.core.annotations;
-import com.asyncapi.v2.model.schema.Schema;
-
import lu.greenhalos.j2asyncapi.annotations.AsyncApi;
import lu.greenhalos.j2asyncapi.core.FieldTestUtil;
+import lu.greenhalos.j2asyncapi.schemas.Schema;
import org.junit.jupiter.api.Test;
@@ -24,7 +23,7 @@ void testField() {
fieldSchema.setFormat("int32");
fieldSchema.setExamples(List.of(42, 352));
- var expectedSchemasForField = Map.of("j.l.Integer-decfea64", fieldSchema);
+ var expectedSchemasForField = Map.of("j.l.Integer-7d3b2498", fieldSchema);
FieldTestUtil.assertSchemaOnClass(Example.class, expectedSchemasForField, Integer.class,
fieldSchema.hashCode());
diff --git a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/annotations/MessageDescriptionTest.java b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/annotations/MessageDescriptionTest.java
index ac8e695..21deffe 100644
--- a/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/annotations/MessageDescriptionTest.java
+++ b/j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/core/annotations/MessageDescriptionTest.java
@@ -1,10 +1,9 @@
package lu.greenhalos.j2asyncapi.core.annotations;
-import com.asyncapi.v2.model.channel.message.Message;
-
import lu.greenhalos.j2asyncapi.annotations.AsyncApi;
import lu.greenhalos.j2asyncapi.core.Config;
import lu.greenhalos.j2asyncapi.core.MessageUtil;
+import lu.greenhalos.j2asyncapi.schemas.Message;
import org.junit.jupiter.api.Test;
@@ -24,7 +23,7 @@ void testDescription() {
var config = Config.defaultConfig();
MessageUtil.process(ExampleMessage.class, config);
- var messages = config.asyncAPI.getComponents().getMessages();
+ var messages = config.asyncAPI.getComponents().getMessages().getAdditionalProperties();
assertThat(messages).hasSize(1);
var message = (Message) messages.get(name(ExampleMessage.class));
diff --git a/j2asyncapi-schema/package-lock.json b/j2asyncapi-schema/package-lock.json
new file mode 100644
index 0000000..a1890e0
--- /dev/null
+++ b/j2asyncapi-schema/package-lock.json
@@ -0,0 +1,29 @@
+{
+ "name": "j2asyncapi",
+ "version": "1.0.0",
+ "lockfileVersion": 2,
+ "requires": true,
+ "packages": {
+ "": {
+ "name": "j2asyncapi",
+ "version": "1.0.0",
+ "hasInstallScript": true,
+ "license": "ISC",
+ "dependencies": {
+ "@asyncapi/specs": "^2.13.0"
+ }
+ },
+ "node_modules/@asyncapi/specs": {
+ "version": "2.13.0",
+ "resolved": "https://registry.npmjs.org/@asyncapi/specs/-/specs-2.13.0.tgz",
+ "integrity": "sha512-X0OrxJtzwRH8iLILO/gUTDqjGVPmagmdlgdyuBggYAoGXzF6ZuAws3XCLxtPNve5eA/0V/1puwpUYEGekI22og=="
+ }
+ },
+ "dependencies": {
+ "@asyncapi/specs": {
+ "version": "2.13.0",
+ "resolved": "https://registry.npmjs.org/@asyncapi/specs/-/specs-2.13.0.tgz",
+ "integrity": "sha512-X0OrxJtzwRH8iLILO/gUTDqjGVPmagmdlgdyuBggYAoGXzF6ZuAws3XCLxtPNve5eA/0V/1puwpUYEGekI22og=="
+ }
+ }
+}
diff --git a/j2asyncapi-schema/package.json b/j2asyncapi-schema/package.json
new file mode 100644
index 0000000..19a0500
--- /dev/null
+++ b/j2asyncapi-schema/package.json
@@ -0,0 +1,15 @@
+{
+ "name": "j2asyncapi",
+ "version": "1.0.0",
+ "description": "",
+ "scripts": {
+ "postinstall": "npm run mkdir && npm run copy-asyncapi-schema",
+ "mkdir": "rm -rf src/main/resources/schemas/ && mkdir -p src/main/resources/schemas/asyncapi",
+ "copy-asyncapi-schema": "cp node_modules/@asyncapi/specs/schemas/2.3.0.json src/main/resources/schemas/asyncapi/"
+ },
+ "author": "",
+ "license": "ISC",
+ "dependencies": {
+ "@asyncapi/specs": "^2.13.0"
+ }
+}
diff --git a/j2asyncapi-schema/pom.xml b/j2asyncapi-schema/pom.xml
new file mode 100644
index 0000000..c4ddcaa
--- /dev/null
+++ b/j2asyncapi-schema/pom.xml
@@ -0,0 +1,81 @@
+
+
+
+ j2asyncapi
+ lu.greenhalos
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ j2asyncapi-schema
+
+
+ 11
+ 11
+
+
+
+
+ commons-lang
+ commons-lang
+
+
+ com.fasterxml.jackson.core
+ jackson-databind
+
+
+
+
+
+
+ com.github.eirslett
+ frontend-maven-plugin
+
+ v16.14.0
+ 8.3.1
+
+
+
+ install-node-and-npm
+
+ install-node-and-npm
+
+
+
+ npm-install
+
+ npm
+
+
+ install
+
+
+
+
+
+ org.jsonschema2pojo
+ jsonschema2pojo-maven-plugin
+
+ false
+ true
+
+
+
+ asyncapi
+
+ generate
+
+ process-resources
+
+ ${basedir}/src/main/resources/schemas/asyncapi
+ lu.greenhalos.j2asyncapi.schemas
+
+
+
+
+
+
+
+
diff --git a/j2asyncapi-schema/src/main/java/lu/greenhalos/j2asyncapi/schemas/AsyncApiDocumentRoot.java b/j2asyncapi-schema/src/main/java/lu/greenhalos/j2asyncapi/schemas/AsyncApiDocumentRoot.java
new file mode 100644
index 0000000..355efd2
--- /dev/null
+++ b/j2asyncapi-schema/src/main/java/lu/greenhalos/j2asyncapi/schemas/AsyncApiDocumentRoot.java
@@ -0,0 +1,13 @@
+package lu.greenhalos.j2asyncapi.schemas;
+
+/**
+ * @author Ben Antony - antony@greenhalos.lu
+ */
+public class AsyncApiDocumentRoot extends _230 {
+
+ public AsyncApiDocumentRoot() {
+
+ super();
+ this.setAsyncapi(Asyncapi._2_3_0);
+ }
+}
diff --git a/j2asyncapi-schema/src/main/java/lu/greenhalos/j2asyncapi/schemas/Message.java b/j2asyncapi-schema/src/main/java/lu/greenhalos/j2asyncapi/schemas/Message.java
new file mode 100644
index 0000000..8e24368
--- /dev/null
+++ b/j2asyncapi-schema/src/main/java/lu/greenhalos/j2asyncapi/schemas/Message.java
@@ -0,0 +1,84 @@
+package lu.greenhalos.j2asyncapi.schemas;
+
+import java.util.Objects;
+
+
+/**
+ * @author Ben Antony - antony@greenhalos.lu
+ */
+public class Message {
+
+ private String title;
+ private Reference payload;
+ private String description;
+
+ public void setTitle(String title) {
+
+ this.title = title;
+ }
+
+
+ public String getTitle() {
+
+ return title;
+ }
+
+
+ public void setPayload(Reference payload) {
+
+ this.payload = payload;
+ }
+
+
+ public Reference getPayload() {
+
+ return payload;
+ }
+
+
+ public void setDescription(String description) {
+
+ this.description = description;
+ }
+
+
+ public String getDescription() {
+
+ return description;
+ }
+
+
+ @Override
+ public boolean equals(Object o) {
+
+ if (this == o) {
+ return true;
+ }
+
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ Message message = (Message) o;
+
+ return Objects.equals(title, message.title) && Objects.equals(payload, message.payload)
+ && Objects.equals(description, message.description);
+ }
+
+
+ @Override
+ public int hashCode() {
+
+ return Objects.hash(title, payload, description);
+ }
+
+
+ @Override
+ public String toString() {
+
+ return "Message{"
+ + "title='" + title + '\''
+ + ", payload=" + payload
+ + ", description='" + description + '\'' + '}';
+ }
+}
diff --git a/j2asyncapi-schema/src/main/java/lu/greenhalos/j2asyncapi/schemas/Reference.java b/j2asyncapi-schema/src/main/java/lu/greenhalos/j2asyncapi/schemas/Reference.java
new file mode 100644
index 0000000..f1a1557
--- /dev/null
+++ b/j2asyncapi-schema/src/main/java/lu/greenhalos/j2asyncapi/schemas/Reference.java
@@ -0,0 +1,64 @@
+package lu.greenhalos.j2asyncapi.schemas;
+
+import java.util.Objects;
+
+
+/**
+ * @author Ben Antony - antony@greenhalos.lu
+ */
+public class Reference {
+
+ private String $ref;
+
+ public Reference() {
+ }
+
+
+ public Reference(String $ref) {
+
+ this.$ref = $ref;
+ }
+
+ public String get$ref() {
+
+ return $ref;
+ }
+
+
+ public void set$ref(String $ref) {
+
+ this.$ref = $ref;
+ }
+
+
+ @Override
+ public boolean equals(Object o) {
+
+ if (this == o) {
+ return true;
+ }
+
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ Reference reference = (Reference) o;
+
+ return Objects.equals($ref, reference.$ref);
+ }
+
+
+ @Override
+ public int hashCode() {
+
+ return Objects.hash($ref);
+ }
+
+
+ @Override
+ public String toString() {
+
+ return "Reference{"
+ + "$ref='" + $ref + '\'' + '}';
+ }
+}
diff --git a/j2asyncapi-schema/src/main/java/lu/greenhalos/j2asyncapi/schemas/Schema.java b/j2asyncapi-schema/src/main/java/lu/greenhalos/j2asyncapi/schemas/Schema.java
new file mode 100644
index 0000000..b3f1d88
--- /dev/null
+++ b/j2asyncapi-schema/src/main/java/lu/greenhalos/j2asyncapi/schemas/Schema.java
@@ -0,0 +1,173 @@
+package lu.greenhalos.j2asyncapi.schemas;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+
+
+/**
+ * @author Ben Antony - antony@greenhalos.lu
+ */
+public class Schema {
+
+ private String $ref;
+ private String title;
+ private Map properties;
+ private String type;
+ private String format;
+ private List> examples;
+ private String description;
+ private Object items;
+ private List