Skip to content

Commit e34647d

Browse files
author
carlos.tasada
committed
chore: Fixed MarkDown Linting
Added support for MarkDown Linting and fixed all the reported issues.
1 parent e3da4d9 commit e34647d

12 files changed

+708
-26
lines changed

.markdownlint.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"default": true,
3+
"MD013": false
4+
}

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,10 @@ vale docs/
3737
```
3838

3939
Words not part of the dictionary yet are added in [accept.txt](.github/styles/config/vocabularies/Springwolf/accept.txt).
40+
41+
## Run Markdown Linter
42+
43+
To validate that the created Markdown follows the rules:
44+
```bash
45+
npm run lint:md
46+
```

docs/behind-the-scenes.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ sidebar_position: 70
77
The following paragraphs describe how Springwolf works internally.
88

99
## Big Picture
10+
1011
When the Spring Boot application is started, Springwolf uses its scanners to find defined consumers and producers within the application.
1112
Based on the results, the channels/topics are extracted including payload type and merged together into an [AsyncAPI conform document](https://www.asyncapi.com/docs/reference/specification/v3.0.0).
1213

@@ -17,19 +18,22 @@ When publishing is enabled, the user can publish a message through the UI to ano
1718
From there, Springwolf forwards the message to the protocol specific producer.
1819

1920
## Plugins
21+
2022
`springwolf-core` provides the base functionality to orchestrate the scanning and building of the AsyncAPI document.
2123
The different protocol (AMQP, Cloud-Stream, JMS, Kafka, SNS, SQS) are supported through plugins.
2224
These plugins are found through the Spring dependency injection functionality.
2325
When building own scanner plugins, your plugin will need to implement the `ChannelsScanner` interface.
2426

2527
## Scanners
28+
2629
`springwolf-core` runs all scanners and merges the found results together into one AsyncAPI document.
2730
When the same channel/topic is found multiple times, it's merged as well.
2831

2932
The result is a [`ChannelItem`](https://www.asyncapi.com/docs/reference/specification/v3.0.0#channelObject).
3033
The `ChannelObject` contains the `Message` for the receive and/or send operation.
3134

3235
## Building an example payload
36+
3337
When the scanners scan and build the result, they also extract the payload type.
3438
The payload is registered in the `ComponentsService`, which allows to split the `Message` from the schema definition - within the AsyncAPI doc a `$ref` references is used.
3539

@@ -40,9 +44,11 @@ Additionally, Springwolf generates an example based on the provided schema.
4044
By using `swagger-parser`, all the `@Schema` and other swagger annotations are supported as well as `@JsonProperty` through the use of the ObjectMapper.
4145

4246
### ModelConverters
47+
4348
ModelConverters provide a way to improve documentation for classes, which can't be modified, for example because they're part of an external library.
4449
They follow the same plugin model.
4550

4651
## Putting it all together
52+
4753
The `AsyncApiService` collects all the channels, schemas and general info and builds the AsyncApi document.
4854
The controller access this services to serve the document to the UI.

docs/configuration/customizing.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ sidebar_position: 80
33
---
44

55
# Customizing
6+
67
Adding and changing functionality of Springwolf is easy.
78
The [configuration](../configuration/configuration.mdx) page mentions the existing ones.
89

@@ -26,6 +27,7 @@ By implementing the `AsyncApiCustomizer`, the AsyncAPI document can be modified
2627
It's the final interception point before the document is available to the user.
2728

2829
For example, the title can be adjusted - although this should be done through the configuration:
30+
2931
```java
3032
@Component
3133
public class AsyncApiTitleCustomizer implements AsyncApiCustomizer {

docs/configuration/documenting-bindings.md

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ Associate this operation with JMS, see [operation-binding] for details.
4040
### `@SnsAsyncOperationBinding`
4141

4242
Associate this operation with SNS, see [operation-binding] for details.
43+
4344
```java
4445
@SnsAsyncOperationBinding
4546
```
@@ -71,9 +72,11 @@ You can define anything and there is no validation.
7172
```
7273

7374
## Binding properties
75+
7476
Explanation of the different binding properties.
7577

7678
### General
79+
7780
The following properties are the same for all bindings.
7881

7982
#### Queue Name (Channel Name)
@@ -94,7 +97,7 @@ The Kafka headers describing the metadata of the payload, more details in the ge
9497

9598
The Springwolf comes with a special `AsyncHeadersCloudEventConstants` to document CloudEvents.
9699

97-
The `kafka` header `__TypeId__` (constant from ` AbstractJavaTypeMapper.DEFAULT_CLASSID_FIELD_NAME`) can be documented as well.
100+
The `kafka` header `__TypeId__` (constant from `AbstractJavaTypeMapper.DEFAULT_CLASSID_FIELD_NAME`) can be documented as well.
98101

99102
### AMQP
100103

@@ -106,18 +109,22 @@ The exchange name that will be used to bind queues to.
106109

107110
The routing key used when publishing a message.
108111

109-
110112
### Kafka
111113

112114
#### Group Id
115+
113116
The group id that will be used during message consumption
114117

115118
#### Client Id
119+
116120
The client id to identify the consumer
117121

118122
### Google PubSub binding annotations
123+
119124
#### Channel Binding Object
125+
120126
The Channel Bindings Object is used to describe the Google Cloud Pub/Sub Topic details.
127+
121128
```java
122129
@GooglePubSubAsyncChannelBinding(
123130
messageRetentionDuration = "messageRetentionDuration",
@@ -130,27 +137,34 @@ The Channel Bindings Object is used to describe the Google Cloud Pub/Sub Topic d
130137
lastRevisionId = "lastRevisionId",
131138
name = "projects/{project}/schemas/{schema}"))
132139
```
133-
`MessageRetentionDuration`: Indicates the minimum duration to retain a message after it's published to the topic
140+
141+
`MessageRetentionDuration`: Indicates the minimum duration to retain a message after it's published to the topic
134142

135143
`Message Storage Policy`: The Message Storage Policy Object is used to describe the Google Cloud Pub/Sub MessageStoragePolicy.
136-
- A list of IDs of GCP regions where messages that are published to the topic may be persisted in storage
144+
145+
- A list of IDs of GCP regions where messages that are published to the topic may be persisted in storage
137146

138147
`Schema Settings`:The Schema Settings Object is used to describe the Google Cloud Pub/Sub SchemaSettings.
148+
139149
- encoding: The encoding of the message
140150
- firstRevisionId: The minimum (inclusive) revision allowed for validating messages
141151
- lastRevisionId: The maximum (inclusive) revision allowed for validating messages
142152
- name: The name of the schema that messages published should be validated against (The format is `projects/{project}/schemas/{schema}`.)
153+
143154
#### Message Binding Object
155+
144156
The Message Binding Object is used to describe the Google Cloud Pub/Sub PubsubMessage details, alongside with pertinent parts of the Google Cloud Pub/Sub Schema Object.
157+
145158
```java
146159
@GooglePubSubAsyncMessageBinding(
147160
orderingKey = "key",
148161
schema = @GooglePubSubAsyncMessageSchema(name = "projects/{project}/schemas/{schema}"))
149162
```
163+
150164
`OrderingKey`: If non-empty, identifies related messages for which publish order should be respected
151165

152166
`Schema Definition`: The Schema Definition Object is used to describe the Google Cloud Pub/Sub Schema Object with AsyncAPI. While some of this information could be, or is, described using native AsyncAPI, for consistency it makes sense to provide this information here at all times, especially for cases where AsyncAPI doesn't natively support describing payloads using a supported Google Cloud Pub/Sub schema format like Protobuf
153-
- name: The name of the schema
154167

168+
- name: The name of the schema
155169

156170
[operation-binding]: https://www.asyncapi.com/docs/reference/specification/v3.0.0#operationBindingsObject

docs/configuration/documenting-consumers.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Sometimes projects are configured in a way that makes Springwolf unable to autom
1010
For these use-cases, Springwolf provides additional ways to explicitly add them to the generated document.
1111

1212
To document consumers, either:
13+
1314
- add the `@AsyncListener` annotation or
1415
- rely on the auto-detection of `@JmsListener`, `@KafkaListener`, `@RabbitListener`, `@SqsListener`
1516

@@ -23,6 +24,7 @@ Additional fields can be documented.
2324
On the same method, the protocol binding is defined. More details can be found in the [bindings](documenting-bindings.md) section.
2425

2526
Below is an example to demonstrate the annotation:
27+
2628
```java
2729
@KafkaListener
2830
@AsyncListener(operation = @AsyncOperation(
@@ -74,6 +76,7 @@ Optional. Useful when an application is connect to multiple brokers and wants to
7476
The server needs to exist in [configuration > Servers](configuration.mdx) as well.
7577

7678
## `@JmsListener`, `@KafkaListener`, `@RabbitListener`, `@SqsListener`
79+
7780
The `@JmsListener`, `@KafkaListener`, `@RabbitListener`, `@SqsListener` annotations are detected automatically.
7881
There is nothing more to do.
7982
Use the other option if the provided documentation is insufficient.

docs/configuration/documenting-producers.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ sidebar_position: 64
44

55
# Producers
66

7-
Unlike consumers which are defined declaratively with an annotation,
8-
producers are defined imperatively (that's `KafkaTemplate`),
7+
Unlike consumers which are defined declaratively with an annotation,
8+
producers are defined imperatively (that's `KafkaTemplate`),
99
and there is no implementation uniform enough so that metadata can be picked up automatically.
1010

1111
Because producers are also an important part of AsyncAPI,
@@ -19,6 +19,7 @@ Additional fields can be documented.
1919
On the same method, the protocol binding is defined. More details can be found in the [bindings](documenting-bindings.md) section.
2020

2121
Below is an example to demonstrate the annotation:
22+
2223
```java
2324
@AsyncPublisher(operation = @AsyncOperation(
2425
channelName = "example-producer-topic",

docs/faq.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,11 @@ logging.level.io.github.springwolf=DEBUG
3636
When the `springwolf-ui` dependency is added, the UI should be visible at [http://localhost:8080/springwolf/asyncapi-ui.html](http://localhost:8080/springwolf/asyncapi-ui.html).
3737

3838
If not, whether
39-
1. you customized the spring `context-path` setting
39+
40+
1. you customized the spring `context-path` setting
4041
2. static assets are being served at all. See the code below:
41-
```java
42+
43+
```java
4244
@Configuration
4345
public class WebConfig implements WebMvcConfigurer {
4446
@Override
@@ -83,10 +85,13 @@ Due to java type erasure some generic type information is lost during runtime.
8385
Defining your own type can resolve this.
8486

8587
Change
88+
8689
```java
8790
public void sendMessage(List<String> msg) {}
8891
```
92+
8993
to
94+
9095
```java
9196
class ListWrapper extends ArrayList<String> {}
9297

@@ -95,18 +100,19 @@ public void sendMessage(ListWrapper<String> msg) {}
95100

96101
### How to migrate from Springwolf 0.18.0 to 1.0.0
97102

98-
See https://github.com/springwolf/springwolf-core/releases/tag/v1.0.0.
103+
See <https://github.com/springwolf/springwolf-core/releases/tag/v1.0.0>.
99104

100105
### How to migrate from the deprecated `AsyncApiDocket` bean to Spring properties
101106

102-
See https://github.com/springwolf/springwolf-core/issues/445.
107+
See <https://github.com/springwolf/springwolf-core/issues/445>.
103108

104109
### Is Spring Boot 2.X supported
105110

106111
You can use an older version of Springwolf, which is build to support Spring Boot 2.X.
107112
However, these versions don't get any updates.
108113
109114
Last versions to support Spring Boot 2.X:
115+
110116
- `springwolf-amqp:0.6.0`
111117
- `springwolf-cloud-stream:0.1.0`
112118
- `springwolf-core:0.6.0`
@@ -124,7 +130,7 @@ Use the `AsyncApiService` to access the generated documentation.
124130
#### With Gradle
125131
126132
You can use the [`springdoc-openapi-gradle-plugin`](https://github.com/springdoc/springdoc-openapi-gradle-plugin) and configure the plugin
127-
for Springwolf by pointing it to the Springwolf docs endpoint:
133+
for Springwolf by pointing it to the Springwolf docs endpoint:
128134
129135
```groovy
130136
openApi {

docs/introduction/introduction.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Integrate Springwolf in minutes using the [Quickstart](../quickstart.mdx).
99
:::
1010

1111
## What's Springwolf
12+
1213
API Documentation is an important part of every project and product, but can be painful to maintain manually.
1314
Spring Boot projects have great solutions for auto-generated documentation for REST APIs to overcome this pain (such as Springfox, or springdoc-openapi).
1415

@@ -20,8 +21,8 @@ Springwolf is compliant to [AsyncAPI](https://www.asyncapi.com), which brings th
2021

2122
View the [live demo](https://demo.springwolf.dev) of Springwolf in action.
2223

23-
Also, the demos of the
24-
[AMQP](https://amqp.demo.springwolf.dev),
24+
Also, the demos of the
25+
[AMQP](https://amqp.demo.springwolf.dev),
2526
[Spring Cloud Stream](https://cloud-stream.demo.springwolf.dev),
2627
[JMS](https://jms.demo.springwolf.dev),
2728
[Kafka](https://kafka.demo.springwolf.dev),
@@ -48,6 +49,7 @@ public class ExampleConsumer {
4849
```
4950

5051
By simply adding Springwolf dependency to your project you will automatically get:
52+
5153
- An endpoint returning an AsyncAPI document describing your asynchronous API.
5254
- A web UI for convenient use by your developers, QA or clients of your asynchronous API.
5355
- An easy way to publish messages to your asynchronous API with a click of a button

docs/introduction/supported-protocols.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ Using [`@AsyncListener`](../configuration/documenting-consumers.md) and [`@Async
3232
The protocols with native support come along with a `@_ProtocolName_Binding` annotation to define protocol specific properties.
3333

3434
### `springwolf-generic-binding` add-on
35+
3536
The `springwolf-generic-binding` add-on allows to document any binding.
3637
This includes bindings not supported by Springwolf, but also any custom fields not part of the AsyncAPI specification.
3738

0 commit comments

Comments
 (0)