You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: ARCHITECTURE.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,6 +12,9 @@ The core module provides the Kotlin DSL for building the AsyncAPI POJO. This POJ
12
12
13
13
Every module in this project depends on the core. The core module itself is independent of the rest of the project and does not depend on any other module.
14
14
15
+
## `annotation`
16
+
The annotation module defines technology-agnostic annotations that represent a subset of the core model.
17
+
15
18
## `script`
16
19
The script module configures the context for the `asyncapi.kts` script and defines compilation properties for the Kotlin compiler. It tells the compiler what the script environment should look like.
Copy file name to clipboardExpand all lines: README.md
+39-2Lines changed: 39 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,7 @@
10
10
*[Usage](#usage)
11
11
*[Kotlin DSL](#kotlin-dsl-usage)
12
12
*[Spring Web](#spring-web-usage)
13
+
*[Annotation](#annotation-usage)
13
14
*[Kotlin Script](#kotlin-script-usage)
14
15
*[Configuration](#configuration)
15
16
*[Spring Web](#spring-web-configuration)
@@ -39,8 +40,8 @@ The framework generally supports any JVM project. Compatibility has been tested,
39
40
|**spring‑web**| Spring Boot autoconfiguration for serving the generated document |:white_check_mark:|
40
41
|**script**| Kotlin scripting support for configuration as code |:white_check_mark:|
41
42
|**maven‑plugin**| Maven plugin for evaluating AsyncAPI scripts and packaging generated resources |:white_check_mark:|
42
-
|**annotation**| Technology agnostic annotations for meta-configuration |:soon:|
43
-
|**template**| Template engine for reusing similar AsyncAPI components |:eyes:|
43
+
|**annotation**| Technology agnostic annotations for meta-configuration |:white_check_mark:|
44
+
|**template**| Template engine for reusing similar AsyncAPI components |:x:|
44
45
45
46
## Usage
46
47
### <aname="kotlin-dsl-usage"></a>Kotlin DSL
@@ -130,6 +131,7 @@ To serve your AsyncAPI specification via Spring Web:
130
131
- add the `kotlin-asyncapi-spring-web` dependency
131
132
- enable the auto-configuration by annotating a configuration class with `@EnableAsyncApi`
132
133
- document your API with `AsyncApiExtension` beans and/or Kotlin scripting (see [Kotlin script usage](#kotlin-script-usage))
134
+
- add annotations to auto-generate components (see [annotation usage](#annotation-usage))
133
135
134
136
You can register multiple extensions to extend and override AsyncAPI components. Extensions with a higher order override extensions with a lower order. Please note that you can only extend top-level components for now (`info`, `channels`, `servers`...). Subcomponents will always be overwritten.
135
137
@@ -152,6 +154,30 @@ class AsyncApiConfiguration {
152
154
// ...
153
155
}
154
156
}
157
+
158
+
@Channel(
159
+
value ="/rooms/{roomId}",
160
+
parameters = [
161
+
Parameter(
162
+
value ="parameter",
163
+
schema =Schema(
164
+
type ="string",
165
+
examples = ["53307860c3599d1de448e19d"]
166
+
)
167
+
)
168
+
]
169
+
)
170
+
classRoomsChannel {
171
+
172
+
@Subscribe(message =Message(ChatMessage::class))
173
+
funpublish(/*...*/) { /*...*/ }
174
+
}
175
+
176
+
@Message
177
+
data classChatMessage(
178
+
valid:String,
179
+
valtext:String
180
+
)
155
181
```
156
182
```xml
157
183
<dependency>
@@ -161,6 +187,16 @@ class AsyncApiConfiguration {
161
187
</dependency>
162
188
```
163
189
190
+
### <aname="annotation-usage"></a>Annotation
191
+
The `kotlin-asyncapi-annotation` module defines technology-agnostic annotations that can be used to document event-driven microservice APIs.
| Channel |`class`| Marks a class that represents a event channel. The value property defines the name of the channel. |
196
+
| Subscribe/Publish |`method`| Marks a method that represents a channel operation. The method must be defined inside a channel class. |
197
+
| Message |`class`| Marks a class that represents a message. The value property can be used to reference a class that is annotated with this annotation. |
198
+
| Schema |`class`| Marks a class that represents a schema. The value property can be used to reference a class that is annotated with this annotation. |
[Kotlin scripting](https://github.com/Kotlin/KEEP/blob/b0c8a37db684eaf74bb1305f3c180b5d2537d787/proposals/scripting-support.md) allows us to execute a piece of code in a provided context. The IDE can still provide features like autocompletion and syntax highlighting. Furthermore, it provides the following benefits:
166
202
- separate AsyncAPI documentation from application source code
@@ -244,6 +280,7 @@ You can configure the Spring Web integration in the application properties:
0 commit comments