Skip to content

Commit 8ddea73

Browse files
committed
docs(site): restructure navigation with adoption guides
- Added adoption/index.md as parent section - Linked Server-Side and Client-Side guides under Adoption Guides - Updated index.md to reference new navigation hierarchy - Ensured menu ordering with nav_order and parent attributes
1 parent f9faf01 commit 8ddea73

File tree

6 files changed

+110
-53
lines changed

6 files changed

+110
-53
lines changed

customer-service-client/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,7 @@ It enqueues responses for **all CRUD operations** and asserts correct mapping in
498498
---
499499

500500
### Optional: Extra Class Annotations
501+
501502
*(⚙️ advanced feature — use only if needed)*
502503

503504
The generator also supports an **optional vendor extension** to attach annotations directly on top of the generated

customer-service/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,8 @@ mvn test
229229
* Focused on clarity and minimal setup.
230230
* Optional: You can attach extra annotations (e.g., Jackson) to generated wrapper classes by setting
231231
`app.openapi.wrapper.class-extra-annotation` in `application.yml`.
232-
See [customer-service-client README](../customer-service-client/README.md#optional-extra-class-annotations) for details.
232+
See [customer-service-client README](../customer-service-client/README.md#optional-extra-class-annotations) for
233+
details.
233234

234235
---
235236

docs/adoption/client-side-adoption-pom.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
---
2+
layout: default
3+
title: Client-Side Build Setup (Maven Plugins & Dependencies)
4+
parent: Client-Side Adoption
5+
nav_order: 1
6+
---
7+
18
# Client-Side Build Setup (Maven Plugins & Dependencies)
29

310
When adopting the **generics-aware OpenAPI client**, make sure to configure your `pom.xml` with the required plugins and
@@ -53,7 +60,22 @@ Add these dependencies to your client module:
5360

5461
---
5562

56-
## 2) Maven Plugins
63+
## 2) Maven Properties
64+
65+
Add these properties at the top level of your `pom.xml` (right under `<project>`), so that plugin versions and template
66+
paths are resolved correctly:
67+
68+
```xml
69+
<properties>
70+
<openapi.generator.version>7.16.0</openapi.generator.version>
71+
<openapi.templates.upstream>${project.build.directory}/openapi-templates-upstream</openapi.templates.upstream>
72+
<openapi.templates.effective>${project.build.directory}/openapi-templates-effective</openapi.templates.effective>
73+
</properties>
74+
```
75+
76+
---
77+
78+
## 3) Maven Plugins
5779

5880
These plugins **work together** to unpack upstream templates, overlay your custom Mustache files, and generate type-safe
5981
client code.
@@ -189,7 +211,7 @@ client code.
189211

190212
---
191213

192-
## 3) Why These Plugins Matter
214+
## 4) Why These Plugins Matter
193215

194216
* **maven-dependency-plugin** → unpacks stock OpenAPI templates.
195217
* **maven-resources-plugin** → overlays your custom Mustache files.

docs/adoption/index.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
layout: default
3+
title: Adoption Guides
4+
nav_order: 2
5+
has_children: true
6+
permalink: /adoption/
7+
---
8+
9+
# 📘 Adoption Guides
10+
11+
Choose one of the following:
12+
13+
- [Server-Side Adoption](server-side-adoption.md)
14+
- [Client-Side Adoption](client-side-adoption.md)

docs/adoption/server-side-adoption.md

Lines changed: 60 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -34,37 +34,38 @@ After this guide, your service will:
3434
## 2) Add dependencies (pom.xml)
3535

3636
```xml
37+
3738
<dependencies>
38-
<!-- Web + Bean Validation -->
39-
<dependency>
40-
<groupId>org.springframework.boot</groupId>
41-
<artifactId>spring-boot-starter-web</artifactId>
42-
</dependency>
43-
<dependency>
44-
<groupId>org.springframework.boot</groupId>
45-
<artifactId>spring-boot-starter-validation</artifactId>
46-
</dependency>
47-
48-
<!-- Springdoc (OpenAPI 3.1 + Swagger UI) -->
49-
<dependency>
50-
<groupId>org.springdoc</groupId>
51-
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
52-
<version>2.8.13</version>
53-
</dependency>
54-
55-
<!-- optional: configuration processor for metadata hints -->
56-
<dependency>
57-
<groupId>org.springframework.boot</groupId>
58-
<artifactId>spring-boot-configuration-processor</artifactId>
59-
<optional>true</optional>
60-
</dependency>
61-
62-
<!-- test (optional) -->
63-
<dependency>
64-
<groupId>org.springframework.boot</groupId>
65-
<artifactId>spring-boot-starter-test</artifactId>
66-
<scope>test</scope>
67-
</dependency>
39+
<!-- Web + Bean Validation -->
40+
<dependency>
41+
<groupId>org.springframework.boot</groupId>
42+
<artifactId>spring-boot-starter-web</artifactId>
43+
</dependency>
44+
<dependency>
45+
<groupId>org.springframework.boot</groupId>
46+
<artifactId>spring-boot-starter-validation</artifactId>
47+
</dependency>
48+
49+
<!-- Springdoc (OpenAPI 3.1 + Swagger UI) -->
50+
<dependency>
51+
<groupId>org.springdoc</groupId>
52+
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
53+
<version>2.8.13</version>
54+
</dependency>
55+
56+
<!-- optional: configuration processor for metadata hints -->
57+
<dependency>
58+
<groupId>org.springframework.boot</groupId>
59+
<artifactId>spring-boot-configuration-processor</artifactId>
60+
<optional>true</optional>
61+
</dependency>
62+
63+
<!-- test (optional) -->
64+
<dependency>
65+
<groupId>org.springframework.boot</groupId>
66+
<artifactId>spring-boot-starter-test</artifactId>
67+
<scope>test</scope>
68+
</dependency>
6869
</dependencies>
6970
```
7071

@@ -82,22 +83,28 @@ Add your usual build plugins (compiler, surefire/failsafe, jacoco) as you prefer
8283
**`common/api/response/ServiceResponse.java`**
8384

8485
```java
85-
package <your.base>.common.api.response;
86+
package
87+
88+
<your.base>.common.api.response;
8689

8790
import java.util.Collections;
8891
import java.util.List;
92+
8993
import org.springframework.http.HttpStatus;
9094

9195
public record ServiceResponse<T>(int status, String message, T data, List<ErrorDetail> errors) {
9296
public static <T> ServiceResponse<T> ok(T data) {
9397
return new ServiceResponse<>(HttpStatus.OK.value(), "OK", data, Collections.emptyList());
9498
}
99+
95100
public static <T> ServiceResponse<T> of(HttpStatus status, String message, T data) {
96101
return new ServiceResponse<>(status.value(), message, data, Collections.emptyList());
97102
}
103+
98104
public static <T> ServiceResponse<T> error(HttpStatus status, String message) {
99105
return new ServiceResponse<>(status.value(), message, null, Collections.emptyList());
100106
}
107+
101108
public static <T> ServiceResponse<T> error(HttpStatus status, String message, List<ErrorDetail> errors) {
102109
return new ServiceResponse<>(status.value(), message, null, errors != null ? errors : Collections.emptyList());
103110
}
@@ -209,36 +216,40 @@ public class SwaggerResponseCustomizer {
209216
**`ApiResponseSchemaFactory.java`** — builds a *composed* wrapper per concrete `T` (e.g., `CustomerDto`).
210217

211218
```java
212-
package <your.base>.common.openapi;
219+
package
220+
221+
<your.base>.common.openapi;
213222

214223
import static <your.base>.common.openapi.OpenApiSchemas.*;
215224

216225
import io.swagger.v3.oas.models.media.ComposedSchema;
217226
import io.swagger.v3.oas.models.media.ObjectSchema;
218227
import io.swagger.v3.oas.models.media.Schema;
228+
219229
import java.util.List;
220230

221231
public final class ApiResponseSchemaFactory {
222-
private ApiResponseSchemaFactory() {}
232+
private ApiResponseSchemaFactory() {
233+
}
223234

224-
public static Schema<?> createComposedWrapper(String dataRefName) {
225-
return createComposedWrapper(dataRefName, null);
226-
}
235+
public static Schema<?> createComposedWrapper(String dataRefName) {
236+
return createComposedWrapper(dataRefName, null);
237+
}
227238

228-
public static Schema<?> createComposedWrapper(String dataRefName, String classExtraAnnotation) {
229-
var schema = new ComposedSchema();
230-
schema.setAllOf(List.of(
231-
new Schema<>().$ref("#/components/schemas/" + SCHEMA_SERVICE_RESPONSE),
232-
new ObjectSchema().addProperty(PROP_DATA, new Schema<>().$ref("#/components/schemas/" + dataRefName))
233-
));
234-
235-
schema.addExtension(EXT_API_WRAPPER, true);
236-
schema.addExtension(EXT_API_WRAPPER_DATATYPE, dataRefName);
237-
if (classExtraAnnotation != null && !classExtraAnnotation.isBlank()) {
238-
schema.addExtension(EXT_CLASS_EXTRA_ANNOTATION, classExtraAnnotation);
239+
public static Schema<?> createComposedWrapper(String dataRefName, String classExtraAnnotation) {
240+
var schema = new ComposedSchema();
241+
schema.setAllOf(List.of(
242+
new Schema<>().$ref("#/components/schemas/" + SCHEMA_SERVICE_RESPONSE),
243+
new ObjectSchema().addProperty(PROP_DATA, new Schema<>().$ref("#/components/schemas/" + dataRefName))
244+
));
245+
246+
schema.addExtension(EXT_API_WRAPPER, true);
247+
schema.addExtension(EXT_API_WRAPPER_DATATYPE, dataRefName);
248+
if (classExtraAnnotation != null && !classExtraAnnotation.isBlank()) {
249+
schema.addExtension(EXT_CLASS_EXTRA_ANNOTATION, classExtraAnnotation);
250+
}
251+
return schema;
239252
}
240-
return schema;
241-
}
242253
}
243254
```
244255

docs/index.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,18 @@ nav_order: 1
88

99
Welcome! 👋
1010

11-
This site is generated from the [`spring-boot-openapi-generics-clients`](https://github.com/bsayli/spring-boot-openapi-generics-clients) repository.
11+
This site is generated from the [
12+
`spring-boot-openapi-generics-clients`](https://github.com/bsayli/spring-boot-openapi-generics-clients) repository.
1213

1314
---
1415

16+
---
17+
layout: default
18+
title: Adoption Guides
19+
nav_order: 2
20+
has_children: true
21+
---
22+
1523
## 📘 Adoption Guides
1624

1725
* [Server-Side Adoption](adoption/server-side-adoption.md)

0 commit comments

Comments
 (0)