-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 5f7eb39
Showing
56 changed files
with
11,657 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven | ||
|
||
name: Java CI with Maven | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: '11' | ||
distribution: 'temurin' | ||
cache: maven | ||
- name: Build with Maven | ||
run: ./mvnw -B verify |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
target/ | ||
.mvn/timing.properties | ||
.mvn/wrapper/maven-wrapper.jar | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip | ||
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# j2asyncapi | ||
|
||
A lib which helps you generate `asyncapi.yaml` from your Java code based on annotations. | ||
|
||
## How to use | ||
|
||
1. Include the dependencies in your `pom.xml` | ||
|
||
```xml | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>lu.greenhalos</groupId> | ||
<artifactId>j2asyncapi-annotation</artifactId> | ||
<version>${j2asyncapi.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>lu.greenhalos</groupId> | ||
<artifactId>j2asyncapi-processor</artifactId> | ||
<version>${j2asyncapi.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
``` | ||
|
||
2. Copy [this test](./j2asyncapi-processor/src/test/java/lu/greenhalos/j2asyncapi/annoations/WriteToFileTest.java) | ||
from this Repository to your code base | ||
3. Change `ExampleBaseApplication.class` with a valid base class of yours e.g. your SpringBootApplication class with the | ||
main method. | ||
4. Change the constant `DOCS_TARGET` to your needs. | ||
5. Annotate a method which is a publisher e.g. a methode which is already annotated with `@RabbitListener` with the | ||
j2asyncapi annotation `@AsyncApi`: | ||
```java | ||
class Listener { | ||
|
||
@AsyncApi( | ||
type = LISTENER, exchange = "exchange", routingKey = "routing.key", payload = ExampleListenerMessage.class, | ||
description = "Description explaining exactly what happens here" | ||
) | ||
@RabbitListener(queues = "${some.long.path.to.the.queue.name}") | ||
public void on(Message message) { | ||
// do your stuff | ||
} | ||
} | ||
``` | ||
6. Run the copied test. The resulting asyncapi.yml is generated to your `DOCS_TARGET`. | ||
|
||
## How to build | ||
|
||
🥁 it is a simple a running: | ||
```shell | ||
./mvnw clean verify # or install in case you want to publish it to you local .m2 repository | ||
``` | ||
|
||
# TODOS | ||
|
||
* Date and Times | ||
* AsyncApi.Message | ||
* @JsonIgnore | ||
* Empty body | ||
* anonymous queue | ||
* process java.util.Locale | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# Application API 0.1.0 documentation | ||
|
||
* Support: [Fancy Team](https://greenhalos.lu) | ||
* Email support: [[email protected]](mailto:[email protected]) | ||
|
||
|
||
## Table of Contents | ||
|
||
* [Servers](#servers) | ||
* [test](#test-server) | ||
* [Operations](#operations) | ||
* [PUB exchange/routing.key](#pub-exchangeroutingkey-operation) | ||
* [SUB exchange/routing.key](#sub-exchangeroutingkey-operation) | ||
|
||
## Servers | ||
|
||
### `test` Server | ||
|
||
* URL: `http://rabbitmq` | ||
* Protocol: `amqp` | ||
|
||
RabbitMQ Server | ||
|
||
|
||
## Operations | ||
|
||
### PUB `exchange/routing.key` Operation | ||
|
||
Description explaining exactly what happens here | ||
|
||
#### Message lu.greenhalos.j2asyncapi.annoations.example.listener.ExampleListener$ExampleListenerMessage `<anonymous-message-1>` | ||
|
||
##### Payload | ||
|
||
| Name | Type | Description | Value | Constraints | Notes | | ||
|---|---|---|---|---|---| | ||
| (root) | - | - | - | - | **additional properties are allowed** | | ||
| amount | number | - | examples (`42.42`, `352.01`) | format (`float`) | - | | ||
| currency | string | - | examples (`"blah"`, `"blub"`) | - | - | | ||
|
||
> Examples of payload _(generated)_ | ||
```json | ||
{ | ||
"amount": 42.42, | ||
"currency": "blah" | ||
} | ||
``` | ||
|
||
|
||
|
||
### SUB `exchange/routing.key` Operation | ||
|
||
Description explaining exactly what happens here | ||
|
||
#### Message lu.greenhalos.j2asyncapi.annoations.example.publisher.ExamplePublisher$ExamplePublisherMessage `<anonymous-message-2>` | ||
|
||
##### Payload | ||
|
||
| Name | Type | Description | Value | Constraints | Notes | | ||
|---|---|---|---|---|---| | ||
| (root) | - | - | - | - | **additional properties are allowed** | | ||
| amount | number | - | examples (`42.42`, `352.01`) | format (`float`) | - | | ||
| currency | string | - | examples (`"blah"`, `"blub"`) | - | - | | ||
|
||
> Examples of payload _(generated)_ | ||
```json | ||
{ | ||
"amount": 42.42, | ||
"currency": "blah" | ||
} | ||
``` | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
asyncapi: "2.0.0" | ||
info: | ||
title: "Application API" | ||
version: "0.1.0" | ||
contact: | ||
name: "Fancy Team" | ||
url: "https://greenhalos.lu" | ||
email: "[email protected]" | ||
servers: | ||
test: | ||
url: "http://rabbitmq" | ||
protocol: "amqp" | ||
description: "RabbitMQ Server" | ||
channels: | ||
exchange/routing.key: | ||
description: "Description explaining exactly what happens here" | ||
subscribe: | ||
message: | ||
payload: | ||
properties: | ||
amount: | ||
title: "amount" | ||
examples: | ||
- 42.42 | ||
- 352.01 | ||
type: "number" | ||
format: "float" | ||
currency: | ||
title: "currency" | ||
examples: | ||
- 42 | ||
- 352 | ||
type: "integer" | ||
format: "int32" | ||
title: "lu.greenhalos.j2asyncapi.annoations.example.publisher.ExamplePublisher$ExamplePublisherMessage" | ||
publish: | ||
message: | ||
payload: | ||
properties: | ||
amount: | ||
title: "amount" | ||
examples: | ||
- 42.42 | ||
- 352.01 | ||
type: "number" | ||
format: "float" | ||
currency: | ||
title: "currency" | ||
examples: | ||
- "EUR" | ||
- "USD" | ||
- "CHF" | ||
type: "string" | ||
title: "lu.greenhalos.j2asyncapi.annoations.example.listener.ExampleListener$ExampleListenerMessage" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# Application API 0.1.0 documentation | ||
|
||
* Support: [Fancy Team](https://greenhalos.lu) | ||
* Email support: [[email protected]](mailto:[email protected]) | ||
|
||
|
||
## Table of Contents | ||
|
||
* [Servers](#servers) | ||
* [test](#test-server) | ||
* [Operations](#operations) | ||
* [SUB channelName](#sub-channelname-operation) | ||
|
||
## Servers | ||
|
||
### `test` Server | ||
|
||
* URL: `http://rabbitmq` | ||
* Protocol: `amqp` | ||
|
||
RabbitMQ Server | ||
|
||
|
||
## Operations | ||
|
||
### SUB `channelName` Operation | ||
|
||
Publish information | ||
|
||
#### Message lu.greenhalos.j2asyncapi.core.Example `<anonymous-message-1>` | ||
|
||
##### Payload | ||
|
||
| Name | Type | Description | Value | Constraints | Notes | | ||
|---|---|---|---|---|---| | ||
| (root) | - | - | - | - | **additional properties are allowed** | | ||
| floatingAmount | number | - | examples (`42.42`, `352.01`) | format (`float`) | - | | ||
| bigDecimalAmount | number | - | examples (`42.42`, `352.01`) | format (`float`) | - | | ||
| intAmount | integer | - | examples (`42`, `352`) | format (`int32`) | - | | ||
| innerExample | - | - | - | - | **additional properties are allowed** | | ||
| innerExample.innerCurrency | string | - | examples (`"blah"`, `"blub"`) | - | - | | ||
| innerExample.nestedInnerExample | - | - | - | - | **additional properties are allowed** | | ||
| innerExample.nestedInnerExample.nestedInnerCurrency | string | - | examples (`"blah"`, `"blub"`) | - | - | | ||
| finalCurrency | string | - | examples (`"blah"`, `"blub"`) | - | - | | ||
| currency | string | - | examples (`"blah"`, `"blub"`) | - | - | | ||
| listCurrency | array<string> | - | - | - | - | | ||
| listCurrency (single item) | string | - | examples (`"blah"`, `"blub"`) | - | - | | ||
| privateFinalCurrency | string | - | examples (`"blah"`, `"blub"`) | - | - | | ||
| isFancy | boolean | - | examples (`true`, `false`) | - | - | | ||
| doubleAmount | number | - | examples (`42.42`, `352.01`) | format (`double`) | - | | ||
| longAmount | integer | - | examples (`42`, `352`) | format (`int64`) | - | | ||
|
||
> Examples of payload _(generated)_ | ||
```json | ||
{ | ||
"floatingAmount": 42.42, | ||
"bigDecimalAmount": 42.42, | ||
"intAmount": 42, | ||
"innerExample": { | ||
"innerCurrency": "blah", | ||
"nestedInnerExample": { | ||
"nestedInnerCurrency": "blah" | ||
} | ||
}, | ||
"finalCurrency": "blah", | ||
"currency": "blah", | ||
"listCurrency": [ | ||
"blah" | ||
], | ||
"privateFinalCurrency": "blah", | ||
"isFancy": true, | ||
"doubleAmount": 42.42, | ||
"longAmount": 42 | ||
} | ||
``` | ||
|
||
|
||
|
Oops, something went wrong.