Skip to content

Commit 5f4157c

Browse files
authored
feat: Add vale language tool (#48)
* feat: Add vale language tool * Add microsoft style
1 parent 00062f9 commit 5f4157c

21 files changed

+138
-84
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# the words in this list are alphabetically sorted
2+
AMQP
3+
APIs
4+
auto-detect
5+
auto-detected
6+
auto-detection
7+
auto-generated
8+
Baeldung
9+
declaratively
10+
Docusaurus
11+
Gradle
12+
Kafka
13+
Netlify
14+
objectmapper
15+
Springfox
16+
Springwolf
17+
UI

.github/workflows/build.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010

1111
permissions:
1212
contents: write
13+
checks: write
1314

1415
jobs:
1516
deploy:
@@ -28,6 +29,12 @@ jobs:
2829
- name: Build website
2930
run: npm run build
3031

32+
- name: Running spell check with vale
33+
uses: errata-ai/vale-action@reviewdog
34+
with:
35+
files: docs
36+
fail_on_error: true
37+
3138
- name: Deploy to GitHub Pages
3239
if: github.ref == 'refs/heads/master'
3340
uses: peaceiris/actions-gh-pages@v3

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.github/styles
12
node_modules
23
.docusaurus
34
build/**

.vale.ini

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
StylesPath = ".github/styles"
2+
Vocab = Springwolf
3+
4+
MinAlertLevel = warning
5+
Packages = Microsoft
6+
7+
8+
[*.md]
9+
BasedOnStyles = Vale, Microsoft
10+
11+
BlockIgnores = (import .*;)
12+
13+
Microsoft.Headings = NO

README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
Latest docs are deployed to
66
- [https://www.springwolf.dev](https://www.springwolf.dev)
7-
- Backup: [https://springwolf.github.io](https://springwolf.github.io)
7+
- Fallback: [https://springwolf.github.io](https://springwolf.github.io)
88

99
## Updating the website & documentation
1010

@@ -26,3 +26,14 @@ npm start
2626

2727
This command starts a local development server and opens up a browser window.
2828
Most changes are reflected live without having to restart the server.
29+
30+
## Language Style
31+
32+
The [vale](https://vale.sh) tool is used to verify the language style.
33+
After installing, verify the documentation with
34+
```bash
35+
vale sync
36+
vale docs/
37+
```
38+
39+
Words not part of the dictionary yet are added in [accept.txt](.github/styles/Vocab/Springwolf/accept.txt).

docs/behind-the-scenes.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ The following paragraphs describe how Springwolf works internally.
1010
When the Spring Boot application is started, Springwolf uses its scanners to find defined consumers and producers within the application.
1111
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/v2.6.0).
1212

13-
The AsyncAPI document is accessible an endpoint.
14-
When the Springwolf ui is opened, the browser fetches the document and renders it (see demo).
13+
The AsyncApi document is accessible an endpoint.
14+
When the Springwolf UI is opened, the browser fetches the document and renders it (see demo).
1515

16-
When publishing is enabled, the user can publish a message through the ui to another endpoint.
16+
When publishing is enabled, the user can publish a message through the UI to another endpoint.
1717
From there, Springwolf forwards the message to the protocol specific producer.
1818

1919
## Plugins
@@ -24,7 +24,7 @@ When building own scanner plugins, your plugin will need to implement the `Chann
2424

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

2929
The result is a [`ChannelItem`](https://www.asyncapi.com/docs/reference/specification/v2.6.0#channelItemObject).
3030
The `ChannelItem` contains the `Message` for the subscribe and/or publish operation.
@@ -33,15 +33,15 @@ The `ChannelItem` contains the `Message` for the subscribe and/or publish operat
3333
When the scanners scan and build the result, they also extract the payload type.
3434
The payload is registered in the `SchemasService`, which allows to split the `Message` from the schema definition - within the AsyncAPI doc a `$ref` references is used.
3535

36-
Using `swagger-parser` any class can be converted into a OpenAPI schema.
37-
The schema is then used to serialized it into an example json for the AsyncAPI document.
36+
Using `swagger-inflector` any class can be converted into a OpenApi schema.
37+
This is used to instantiate an Example object with default values and serialized into an example JSON for the AsyncApi document.
3838

3939
By using `swagger-parser`, all the `@Schema` and other swagger annotations are supported as well as `@JsonProperty` through the use of the objectmapper.
4040

4141
### ModelConverters
42-
ModelConverters provide a way to improve documentation for classes, which cannot be modified, for example because they are part of an external library.
42+
ModelConverters provide a way to improve documentation for classes, which can't be modified, for example because they're part of an external library.
4343
They follow the same plugin model.
4444

4545
## Putting it all together
4646
The `AsyncApiService` collects all the channels, schemas and general info and builds the AsyncApi document.
47-
The controller access this services to serve the document to the ui.
47+
The controller access this services to serve the document to the UI.

docs/configuration/configuration.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ sidebar_position: 30
44
import Tabs from '@theme/Tabs';
55
import TabItem from '@theme/TabItem';
66
import CodeBlock from '@theme/CodeBlock';
7-
import CodeConfigurationProperties from '!!raw-loader!./snippets/_configuration_properties.md';
8-
import CodeConfigurationAsyncApiDocket from '!!raw-loader!./snippets/_configuration_asyncApiDocket.md';
7+
import CodeConfigurationProperties from '!!raw-loader!./snippets/_configuration_properties.properties';
8+
import CodeConfigurationAsyncApiDocket from '!!raw-loader!./snippets/_configuration_asyncApiDocket.java';
99

1010
# Configuration
1111

12-
There are 2 ways to configure Springwolf which cannot be combined:
12+
There are 2 ways to configure Springwolf which can't be combined:
1313

1414
1. `application.properties`, which is simple and moves all configuration to this file and annotations
1515
2. (deprecated) `AsyncApiDocket`, which allows adding producers and consumers via code (instead of annotations)
@@ -27,31 +27,31 @@ There are 2 ways to configure Springwolf which cannot be combined:
2727

2828
## Properties
2929

30-
### basePackage (required)
30+
### `basePackage` (required)
3131

32-
It is recommended to structure the project such that all consumers and producers (classes containing listener/producer methods) are in the same package - it is not mandatory, and if they are scattered across multiple packages, just provide the highest in hierarchy package that contains all of them.
32+
It's recommended to structure the project such that all consumers and producers (classes containing listener/producer methods) are in the same package - it's not mandatory, and if they're scattered across multiple packages, just provide the highest in hierarchy package that contains all classes.
3333

3434
The base package will be scanned for classes containing `@Component` annotated classes (that includes `@Service` annotated classes) for methods annotated with `@KafkaListener`, `@RabbitListener`, `@AsyncListener`, `@AsyncPublisher`, etc.
3535

36-
### id
36+
### `id`
3737

3838
The `Identifier` value represents a unique universal identifier of the application. See [Identifier][identifier].
3939

40-
### default-content-type
40+
### `default-content-type`
4141

4242
A string representing the default content type to use when encoding/decoding a message's payload. See [Default Content Type][default-content-type]
4343

44-
### Info (required)
44+
### `Info` (required)
4545

4646
The `Info` object provides metadata about the API (see [Info Object][info]).
4747

4848
All provided fields will be present in the generated document, but not all will be displayed in the UI.
4949

50-
### Server
50+
### `Server`
5151

5252
The `Server` object provides metadata the can help the reader understand the protocol, version, login details and more (see [Server Object][server]).
5353

54-
An AsyncAPI document can contain more than one server, but it is not common.
54+
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

@@ -69,11 +69,11 @@ The following table contains additional properties that can be specified in the
6969
| `springwolf.scanner.async-listener.enabled` | `true` | Enable scanner to find methods annotated with `@AsyncListener`. |
7070
| `springwolf.scanner.async-publisher.enabled` | `true` | Enable scanner to find methods annotated with `@AsyncPublisher`. |
7171
| **AMQP** | | |
72-
| `springwolf.plugin.amqp.publishing.enabled` | `false` | Allow (anyone) to produce amqp messages from the UI. *Note that this has security implications* |
72+
| `springwolf.plugin.amqp.publishing.enabled` | `false` | Allow (anyone) to produce AMQP messages from the UI. *Note that this has security implications* |
7373
| `springwolf.plugin.amqp.scanner.rabbit-listener.enabled` | `true` | Enable scanner to find methods annotated with `@RabbitListener`. |
7474
| **Kafka** | | |
75-
| `springwolf.plugin.kafka.publishing.enabled` | `false` | Allow (anyone) to produce kafka messages from the UI. *Note that this has security implications* |
76-
| `springwolf.plugin.kafka.publishing.producer` | `null` | Configure the kafka producer used to publish messages from the UI. Uses identical parameters as `spring.kafka.producer` |
75+
| `springwolf.plugin.kafka.publishing.enabled` | `false` | Allow (anyone) to produce Kafka messages from the UI. *Note that this has security implications* |
76+
| `springwolf.plugin.kafka.publishing.producer` | `null` | Configure the Kafka producer used to publish messages from the UI. Uses identical parameters as `spring.kafka.producer` |
7777
| `springwolf.plugin.kafka.scanner.kafka-listener.enabled` | `true` | Enable scanner to find methods annotated with `@KafkaListener`. |
7878

7979
[identifier]: https://www.asyncapi.com/docs/reference/specification/v2.0.0#A2SIdString.

docs/configuration/customizing.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ When you feel that Springwolf is missing a feature, you are able to add it yours
1010
To learn more about how Springwolf works, look [behind the scenes](../behind-the-scenes.md).
1111

1212
:::note
13+
<!-- vale Microsoft.We = NO -->
1314
Please let us know on GitHub or Discord, so that other people can benefit from it as well.
1415
[Contributions are welcome, here are some basic tips](https://github.com/springwolf/springwolf-core/blob/master/CONTRIBUTING.md).
16+
<!-- vale Microsoft.We = YES -->
1517
:::
1618

1719
Springwolf uses interfaces to allow to inject functionality at integration points.
@@ -21,7 +23,7 @@ All default implementations are Spring managed beans, which can be overridden.
2123
## `AsyncApiCustomizer` - Full AsyncAPI document
2224

2325
By implementing the `AsyncApiCustomizer`, the AsyncAPI document can be modified after Springwolf has done all the scanning and has built the document.
24-
It is the final interception point before the document is available to the user.
26+
It's the final interception point before the document is available to the user.
2527

2628
For example, the title can be adjusted - although this should be done through the configuration:
2729
```java

docs/configuration/documenting-consumers.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,23 +61,23 @@ Optional. The description allows for human-friendly text to verbosely explain th
6161
### Payload Type
6262

6363
The class object of the payload that will be consumed from this channel.
64-
If not specified, it is extracted from the method arguments.
64+
If not specified, it's extracted from the method arguments.
6565

6666
### Header
6767

6868
Optional. The headers describing the metadata of the payload.
6969

7070
### `@AmqpAsyncOperationBinding`
7171

72-
Associate this operation with amqp, see [operation-binding] for details.
72+
Associate this operation with AMQP, see [operation-binding] for details.
7373

7474
```java
7575
@AmqpAsyncOperationBinding(cc = "example-topic-routing-key")
7676
```
7777

7878
### `@KafkaAsyncOperationBinding`
7979

80-
Associate this operation with kafka, see [operation-binding] for details.
80+
Associate this operation with Kafka, see [operation-binding] for details.
8181

8282
```java
8383
@KafkaAsyncOperationBinding(
@@ -91,7 +91,7 @@ Associate this operation with kafka, see [operation-binding] for details.
9191
## Option 2: `ConsumerData` (deprecated)
9292

9393
:::note
94-
Must use configuration via `AsyncApiDocket` and cannot use `application.properties`.
94+
Must use configuration via `AsyncApiDocket` and can't use `application.properties`.
9595
:::
9696

9797
Below is an example of describing a Kafka consumer:
@@ -143,7 +143,7 @@ The class object of the payload that will be consumed from this channel.
143143

144144
Optional. The headers describing the metadata of the payload.
145145
By default, `AsyncHeaders.NOT_DOCUMENTED` is used to indicate that no explicit header documentation exists.
146-
Use `AsyncHeaders` to add your custom headers, use `AsyncHeaders.NOT_USED` if you do not use headers and `AsyncHeadersForCloudEventsBuilder` if your events follow the CloudEvent specification.
146+
Use `AsyncHeaders` to add your custom headers, use `AsyncHeaders.NOT_USED` if you don't use headers and `AsyncHeadersForCloudEventsBuilder` if your events follow the CloudEvent specification.
147147

148148

149149
### `AmqpConsumerData`
@@ -218,7 +218,7 @@ The class object of the payload that will be consumed from this channel.
218218

219219
The Kafka headers describing the metadata of the payload, more details in the generic ConsumerData.
220220

221-
The Springwolf Kafka plugin comes with a special `AsyncHeadersForSpringKafkaBuilder` to document the `__TypeId__` header of the spring-kafka dependency.
221+
The Springwolf Kafka plugin comes with a special `AsyncHeadersForSpringKafkaBuilder` to document the `__TypeId__` header of the `spring-kafka` dependency.
222222

223223
## Examples
224224

docs/configuration/documenting-messages.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ sidebar_position: 68
55
import Tabs from '@theme/Tabs';
66
import TabItem from '@theme/TabItem';
77
import CodeBlock from '@theme/CodeBlock';
8-
import CodeSchemaGroovy from '!!raw-loader!./snippets/_schema_groovy.md';
9-
import CodeSchemaMaven from '!!raw-loader!./snippets/_schema_maven.md';
8+
import CodeSchemaGroovy from '!!raw-loader!./snippets/_schema_groovy.gradle';
9+
import CodeSchemaMaven from '!!raw-loader!./snippets/_schema_maven.xml';
1010

1111
# Messages
1212

@@ -44,7 +44,7 @@ The default Jackson `ModelResolver` supports schema definitions via `@Schema` to
4444

4545
The `@Schema` annotation allows to set many properties like `description`, `example`, `requiredMode` to document payloads.
4646

47-
All properties are part of the produced AsyncApi file. However, not all of them are displayed in Springwolf-ui. The ones listed above are included.
47+
All properties are part of the produced AsyncApi file. However, not all are displayed in `springwolf-ui`. The ones listed above are included.
4848

4949
### Usage
5050

@@ -60,6 +60,8 @@ Add the following dependency:
6060
</Tabs>
6161

6262
Then, add the `@Schema` annotation to the payload class:
63+
64+
<!-- vale off -->
6365
```java
6466
import io.swagger.v3.oas.annotations.media.Schema;
6567
import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED;
@@ -74,17 +76,18 @@ public class ExamplePayloadDto {
7476
}
7577
}
7678
```
79+
<!-- vale on -->
7780

7881
:::note
7982
The `@AsyncMessage.description` field will always override the `@Schema` description if provided
8083
:::
8184

82-
For a full example, take a look at [ExamplePayloadDto.java in springwolf-amqp-example](https://github.com/springwolf/springwolf-core/blob/master/springwolf-examples/springwolf-amqp-example/src/main/java/io/github/stavshamir/springwolf/example/amqp/dtos/ExamplePayloadDto.java)
85+
For a full example, take a look at [ExamplePayloadDto.java in `springwolf-amqp-example`](https://github.com/springwolf/springwolf-core/blob/master/springwolf-examples/springwolf-amqp-example/src/main/java/io/github/stavshamir/springwolf/example/amqp/dtos/ExamplePayloadDto.java)
8386

8487
## Custom ModelConverters
8588

8689
Additionally, custom `ModelConverters` are supported.
8790
These are needed when swagger is unable to extract a schema from a class.
8891

8992
One example is `javax.money.MonetaryAmount`.
90-
Adding a model converter is demoed in [springwolf-add-ons/springwolf-common-model-converters](https://github.com/springwolf/springwolf-core/tree/master/springwolf-add-ons/springwolf-common-model-converters)
93+
Adding a model converter is demoed in [`springwolf-add-ons/springwolf-common-model-converters`](https://github.com/springwolf/springwolf-core/tree/master/springwolf-add-ons/springwolf-common-model-converters)

0 commit comments

Comments
 (0)