Skip to content

Commit 3b94a73

Browse files
authored
Documentation of how to define Extension Fields for AsyncAPI (#63)
1 parent abf338f commit 3b94a73

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

docs/configuration/configuration.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,15 @@ An AsyncAPI document can contain more than one server, but it's not common.
5555

5656
As with the `Info` object, all provided fields will be present in the generated document, but not all will be displayed in the UI.
5757

58+
### Extension Fields
59+
60+
The AsyncAPI specification allows the definition of additional data fields to extend the
61+
specification at certain points (see [Specification Extensions][extensions]).
62+
63+
Extension Fields may be added to `Info`, `Contact`, `License` and `Server` objects both via `application.properties`
64+
or (deprecated) `AsyncApiDocket` . Every custom extension field must begin with `x-`, for example `x-internal-id`
65+
(see sample configurations above).
66+
5867
## Additional `application.properties`
5968

6069
The following table contains additional properties that can be specified in the `application.properties` file:
@@ -107,7 +116,8 @@ the exposed AsyncAPI document will follow accordingly.
107116
Enabling actuator support for Springwolf will break the Springwolf UI.
108117

109118

110-
[identifier]: https://www.asyncapi.com/docs/reference/specification/v2.0.0#A2SIdString.
111-
[info]: https://www.asyncapi.com/docs/reference/specification/v2.0.0#infoObject.
112-
[server]: https://www.asyncapi.com/docs/reference/specification/v2.0.0#serversObject
113-
[default-content-type]: https://www.asyncapi.com/docs/reference/specification/v2.0.0#defaultContentTypeString
119+
[identifier]: https://www.asyncapi.com/docs/reference/specification/v2.6.0#A2SIdString.
120+
[info]: https://www.asyncapi.com/docs/reference/specification/v2.6.0#infoObject.
121+
[server]: https://www.asyncapi.com/docs/reference/specification/v2.6.0#serversObject
122+
[default-content-type]: https://www.asyncapi.com/docs/reference/specification/v2.6.0#defaultContentTypeString
123+
[extensions]: https://www.asyncapi.com/docs/reference/specification/v2.6.0#specificationExtensions

docs/configuration/snippets/_configuration_asyncApiDocket.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ public AsyncApiDocket asyncApiDocket() {
2323
.build())
2424
.build();
2525

26+
info.setExtensionFields(Map.of("x-internal-id", "xyz-123"));
27+
2628
return AsyncApiDocket.builder()
2729
.basePackage("io.github.stavshamir.springwolf.example.consumers")
2830
.info(info)

docs/configuration/snippets/_configuration_properties.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ springwolf.docket.info.contact.name=springwolf
1010
springwolf.docket.info.contact.email[email protected]
1111
springwolf.docket.info.contact.url=https://github.com/springwolf/springwolf-core
1212
springwolf.docket.info.license.name=Apache License 2.0
13+
springwolf.docket.info.x-internal-id=xyz-123
1314

1415
springwolf.docket.servers.kafka.protocol=kafka
15-
springwolf.docket.servers.kafka.url=${spring.kafka.bootstrap-servers}
16+
springwolf.docket.servers.kafka.url=${spring.kafka.bootstrap-servers}

0 commit comments

Comments
 (0)