Skip to content

Commit c7ab326

Browse files
committed
docs: prepare 1.12.0 release
1 parent eb5db04 commit c7ab326

File tree

2 files changed

+12
-69
lines changed

2 files changed

+12
-69
lines changed

docs/faq.md

+4-59
Original file line numberDiff line numberDiff line change
@@ -20,40 +20,9 @@ Either create a custom spring controller to serve the file or [serve static reso
2020

2121
Note: `springwolf-ui` doesn't support the full AsyncAPI spec.
2222

23-
### Unit test verification
23+
### Springwolf in unit / integration test
2424

25-
With the AsyncAPI artifact checked into the repository at `src/test/resources/asyncapi.json`,
26-
a unit test can verify that the current code still matches the expected AsyncAPI specification.
27-
Additionally, a diff reveals (un)expected changes.
28-
29-
Example unit test:
30-
31-
```java
32-
@SpringBootTest(
33-
classes = {SpringwolfKafkaExampleApplication.class},
34-
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
35-
class ApiIntegrationTest {
36-
37-
@Autowired
38-
private TestRestTemplate restTemplate;
39-
40-
@Test
41-
void asyncApiResourceArtifactTest() throws IOException {
42-
String url = "/springwolf/docs";
43-
String actual = restTemplate.getForObject(url, String.class);
44-
45-
// writing the actual file can be useful for debugging (remember: gitignore)
46-
Files.writeString(Path.of("src", "test", "resources", "asyncapi.actual.json"), actual);
47-
48-
InputStream s = this.getClass().getResourceAsStream("/asyncapi.json");
49-
String expected = new String(s.readAllBytes(), StandardCharsets.UTF_8).trim();
50-
51-
assertEquals(expected, actual);
52-
}
53-
}
54-
```
55-
56-
For a full example, check the [springwolf-kafka-example ApiIntegrationTest](https://github.com/springwolf/springwolf-core/blob/master/springwolf-examples/springwolf-kafka-example/src/test/java/io/github/springwolf/examples/kafka/ApiIntegrationTest.java)
25+
See [Static Generation](static-generation.md).
5726

5827
## Troubleshooting
5928

@@ -115,8 +84,8 @@ Springwolf uses `swagger-core` to analyze classes, which is used by some OpenAPI
11584

11685
Options:
11786

118-
1. Use the same settings in Springwolf and the other library (including the [fully qualified class name (FQN) option (`springwolf.use-fqn=false`)](configuration/configuration.mdx)).
119-
2. Don't run Springwolf and the other library at the same time, for example by generating the documentation at build time.
87+
1. Use the same settings in Springwolf and the other library (including the [fully qualified class name (FQN) option](configuration/configuration.mdx)).
88+
2. Don't run Springwolf and the other library at the same time, for example by [generating the documentation at build time](static-generation.md).
12089

12190
### Generic types (List) don't contain item properties
12291

@@ -157,30 +126,6 @@ Use the `AsyncApiService` to access the generated documentation.
157126

158127
See the [customization page](configuration/customizing.md)
159128

160-
### How to generate the documentation at build time
161-
162-
#### With Gradle
163-
164-
You can use the [`springdoc-openapi-gradle-plugin`](https://github.com/springdoc/springdoc-openapi-gradle-plugin) and configure the plugin
165-
for Springwolf by pointing it to the Springwolf docs endpoint:
166-
167-
```groovy
168-
openApi {
169-
apiDocsUrl = "http://localhost:8080/springwolf/docs"
170-
outputDir = file("$buildDir/docs")
171-
outputFileName = "async-api.json"
172-
}
173-
```
174-
175-
The [`springwolf-kafka-example`](https://github.com/springwolf/springwolf-core/blob/master/springwolf-examples/springwolf-kafka-example/build.gradle)
176-
contains a working example.
177-
178-
The plugin will startup the spring boot application by using the `bootRun` task and then try to download the documentation
179-
from the given `apiDocsUrl` and store it in the `outputDir` and with the given `outputFileName`.
180-
181-
If your application is unable to start up with the `bootRun` task, see if [customBootRun](https://github.com/springdoc/springdoc-openapi-gradle-plugin#customization)
182-
properties can help you.
183-
184129
## Release Notes / Migration Guide / Updating / Upgrading
185130

186131
Releases are managed in [GitHub Releases](https://github.com/springwolf/springwolf-core/releases),

docs/static-generation.md

+8-10
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class ApiIntegrationTest {
3232
String actual = restTemplate.getForObject(url, String.class);
3333

3434
// then
35-
// writing the actual file can be useful for debugging (remember: gitignore)
35+
// writing the actual file can be useful for debugging (remember: .gitignore)
3636
Files.writeString(Path.of("src", "test", "resources", "asyncapi.actual.json"), actual);
3737

3838
// then
@@ -56,10 +56,11 @@ class StandaloneTest {
5656
@Test
5757
public void asyncApiStandaloneArtifactTest() throws IOException {
5858
// given
59-
StandaloneFactory standaloneFactory = new DefaultStandaloneFactory();
59+
StandaloneApplication standaloneApplication =
60+
DefaultStandaloneApplication.builder().buildAndStart();
6061

6162
// when
62-
AsyncAPI asyncApi = standaloneFactory.getAsyncApiService().getAsyncAPI();
63+
AsyncAPI asyncApi = standaloneApplication.getAsyncApiService().getAsyncAPI();
6364
String actual = new DefaultAsyncApiSerializerService().toJsonString(asyncApi);
6465

6566
// then
@@ -74,15 +75,15 @@ class StandaloneTest {
7475
}
7576
```
7677

77-
By default, only the `io.github.springwolf` package is scanned and `@StandaloneConfiguration` in other packages _not_ picked up.
78-
Use the `DefaultStandaloneFactory` constructor to customize the Spring environment, loaded custom beans and configurations.
78+
By default, only the `io.github.springwolf` package is scanned and `@StandaloneConfiguration` in other packages are _not_ picked up.
79+
Use the `DefaultStandaloneApplication.builder()` to customize the Spring environment, load custom beans and configurations.
7980

80-
The [`application.properties` configuration](configuration/configuration.mdx) are picked up.
81+
The [`application.properties` configuration](configuration/configuration.mdx) is picked up.
8182

8283
## Gradle Plugin (full spring context)
8384

8485
You can use the [`springdoc-openapi-gradle-plugin`](https://github.com/springdoc/springdoc-openapi-gradle-plugin) and configure the plugin
85-
for Springwolf by pointing it to the Springwolf docs endpoint:
86+
for Springwolf (taken from [`springwolf-kafka-example`](https://github.com/springwolf/springwolf-core/blob/master/springwolf-examples/springwolf-kafka-example/build.gradle)):
8687

8788
```groovy
8889
openApi {
@@ -92,9 +93,6 @@ openApi {
9293
}
9394
```
9495

95-
The [`springwolf-kafka-example`](https://github.com/springwolf/springwolf-core/blob/master/springwolf-examples/springwolf-kafka-example/build.gradle)
96-
contains a working example.
97-
9896
The plugin will start up the spring boot application by using the `bootRun` task and then try to download the documentation
9997
from the given `apiDocsUrl` and store it in the `outputDir` and with the given `outputFileName`.
10098

0 commit comments

Comments
 (0)