Skip to content

Commit e665491

Browse files
authored
Merge pull request #73 from ctasada/ctasada/markdown-linting
chore: Fixed MarkDown Linting
2 parents e3da4d9 + f66ea7e commit e665491

17 files changed

+741
-34
lines changed

.github/workflows/build.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,18 @@ jobs:
3737
files: docs
3838
fail_on_error: true
3939

40+
- name: Lint md files
41+
uses: DavidAnson/markdownlint-cli2-action@v16
42+
with:
43+
config: './conf/.markdownlint.json'
44+
globs: './docs/**/*.md'
45+
46+
- name: Lint mdx files
47+
uses: DavidAnson/markdownlint-cli2-action@v16
48+
with:
49+
config: './conf/.mdx.markdownlint.json'
50+
globs: './docs/**/*.mdx'
51+
4052
- name: Deploy to GitHub Pages
4153
if: github.ref == 'refs/heads/master'
4254
uses: peaceiris/actions-gh-pages@v3

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+
```

conf/.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+
}

conf/.mdx.markdownlint.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": ".markdownlint.json",
3+
4+
"first-line-heading": false,
5+
"no-bare-urls": false,
6+
"no-inline-html": false
7+
}

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/configuration.mdx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,14 @@ The following table contains additional properties that can be specified in the
8080
| `springwolf.plugin.sqs.publishing.enabled` | `false` | Allow (anyone) to produce SQS messages from the UI. *Note that this has security implications* |
8181
| `springwolf.plugin.sqs.scanner.sqs-listener.enabled` | `true` | Enable scanner to find methods annotated with `@SqsListener`. |
8282

83-
84-
8583
## Actuator support
8684

8785
Springwolf supports exposing the AsyncAPI document as part of Spring Boot’s actuator endpoint.
8886
The AsyncAPI document will then be moved underneath actuators base path, that's `/actuator/springwolf/docs.json` or `/actuator/springwolf/docs.yaml` respectively.
8987

9088
To enable it, add the `spring-boot-actuator` dependency first.
9189
Second, enable the actuator endpoint in the `application.properties` file:
90+
9291
```properties
9392
# Move Springwolf endpoint to actuator
9493
springwolf.endpoint.actuator.enabled=true

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-messages.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Springwolf provides different ways to document the messages. The `message` is pa
1717
A message can be defined as part of the `@AsyncOperation` annotation, using `message = @AsyncMessage()` field.
1818

1919
For example:
20+
2021
```java
2122
@AsyncPublisher(operation = @AsyncOperation(
2223
channelName = "example-producer-topic",
@@ -39,6 +40,7 @@ public void sendMessage(ExamplePayloadDto msg) {
3940
Springwolf tries to auto-detect the payload type based on the method signature.
4041

4142
When the method has multiple arguments, the payload can be indicated via `@Payload`, that's
43+
4244
```java
4345
public void sendMessage(@Payload ExamplePayloadDto msg, String traceId, Object loggingContext) {}
4446
```
@@ -62,7 +64,6 @@ First, the base property `springwolf.payload.extractable-classes`.
6264
Second, the canonical class name, `java.util.function.Function` in this case.
6365
And third, the generic parameter index (`1`).
6466

65-
6667
## Schema
6768

6869
Under the hood Springwolf relies on swagger-core `ModelConverters` to define the message schema.

0 commit comments

Comments
 (0)