Skip to content

Commit 218d031

Browse files
committed
build: simplify OpenAPI template pipeline and upgrade platform stack
- upgrade Spring Boot to 3.5.12 - upgrade OpenAPI Generator to 7.21.0 customer-service-client: - remove unused upstream template extraction mechanism - introduce Maven Antrun based automated patching for model.mustache - eliminate manual template maintenance step - simplify effective template generation pipeline - improve build reproducibility and developer ergonomics general: - align module versions to 0.7.9-SNAPSHOT development line
1 parent 3217bd3 commit 218d031

5 files changed

Lines changed: 46 additions & 127 deletions

File tree

customer-service-client/pom.xml

Lines changed: 42 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>io.github.bsayli</groupId>
88
<artifactId>customer-service-client</artifactId>
9-
<version>0.7.8</version>
9+
<version>0.7.9-SNAPSHOT</version>
1010
<name>customer-service-client</name>
1111
<description>Generated client (RestClient) using generics-aware OpenAPI templates</description>
1212
<packaging>jar</packaging>
@@ -40,8 +40,8 @@
4040
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
4141
<java.version>21</java.version>
4242

43-
<spring-boot.version>3.5.11</spring-boot.version>
44-
<openapi.generator.version>7.20.0</openapi.generator.version>
43+
<spring-boot.version>3.5.12</spring-boot.version>
44+
<openapi.generator.version>7.21.0</openapi.generator.version>
4545

4646
<jakarta.validation.version>3.1.1</jakarta.validation.version>
4747
<jakarta.annotation-api.version>3.0.0</jakarta.annotation-api.version>
@@ -56,8 +56,7 @@
5656
<spotless-maven-plugin.version>3.3.0</spotless-maven-plugin.version>
5757
<maven-surefire-plugin.version>3.5.5</maven-surefire-plugin.version>
5858
<maven-failsafe-plugin.version>3.5.5</maven-failsafe-plugin.version>
59-
60-
<openapi.templates.upstream>${project.build.directory}/upstream-templates</openapi.templates.upstream>
59+
<maven-antrun-plugin.version>3.2.0</maven-antrun-plugin.version>
6160
<openapi.templates.effective>${project.build.directory}/effective-templates</openapi.templates.effective>
6261
<api-contract.version>0.7.7</api-contract.version>
6362
<slf4j-api.version>2.0.17</slf4j-api.version>
@@ -164,13 +163,16 @@
164163
<groupId>org.apache.maven.plugins</groupId>
165164
<artifactId>maven-dependency-plugin</artifactId>
166165
<version>${maven.dependency.plugin.version}</version>
166+
167167
<executions>
168+
168169
<execution>
169-
<id>unpack-openapi-upstream-templates</id>
170+
<id>extract-openapi-model-template</id>
170171
<phase>generate-sources</phase>
171172
<goals>
172173
<goal>unpack</goal>
173174
</goals>
175+
174176
<configuration>
175177
<artifactItems>
176178
<artifactItem>
@@ -179,43 +181,62 @@
179181
<version>${openapi.generator.version}</version>
180182
<type>jar</type>
181183
<overWrite>true</overWrite>
182-
<includes>templates/Java/**</includes>
183-
<outputDirectory>${openapi.templates.upstream}</outputDirectory>
184+
<includes>**/Java/model.mustache</includes>
185+
<outputDirectory>${openapi.templates.effective}</outputDirectory>
184186
</artifactItem>
185187
</artifactItems>
186188
</configuration>
187189
</execution>
190+
188191
<execution>
189192
<goals>
190193
<goal>properties</goal>
191194
</goals>
192195
</execution>
196+
193197
</executions>
194198
</plugin>
195199

196200
<plugin>
197201
<groupId>org.apache.maven.plugins</groupId>
198-
<artifactId>maven-resources-plugin</artifactId>
199-
<version>${maven.resources.plugin.version}</version>
202+
<artifactId>maven-antrun-plugin</artifactId>
203+
<version>${maven-antrun-plugin.version}</version>
204+
200205
<executions>
201206
<execution>
202-
<id>copy-upstream-to-effective</id>
207+
<id>patch-openapi-model-template</id>
203208
<phase>generate-sources</phase>
204209
<goals>
205-
<goal>copy-resources</goal>
210+
<goal>run</goal>
206211
</goals>
212+
207213
<configuration>
208-
<outputDirectory>${openapi.templates.effective}</outputDirectory>
209-
<resources>
210-
<resource>
211-
<directory>${openapi.templates.upstream}/templates</directory>
212-
<includes>
213-
<include>Java/**</include>
214-
</includes>
215-
</resource>
216-
</resources>
214+
<target>
215+
216+
<replaceregexp byline="false" flags="s">
217+
218+
<regexp pattern="(.*)\{\{#models}}\s*\{\{#model}}[\s\S]*?\{\{\/model}}\s*\{\{\/models}}\s*$"/>
219+
220+
<substitution expression="\1{{#models}}{{#model}}{{#vendorExtensions.x-api-wrapper}}{{>api_wrapper}}{{/vendorExtensions.x-api-wrapper}}{{^vendorExtensions.x-api-wrapper}}{{#isEnum}}{{>modelEnum}}{{/isEnum}}{{^isEnum}}{{#vendorExtensions.x-is-one-of-interface}}{{>oneof_interface}}{{/vendorExtensions.x-is-one-of-interface}}{{^vendorExtensions.x-is-one-of-interface}}{{>pojo}}{{/vendorExtensions.x-is-one-of-interface}}{{/isEnum}}{{/vendorExtensions.x-api-wrapper}}{{/model}}{{/models}}"/>
221+
222+
<fileset dir="${openapi.templates.effective}">
223+
<include name="**/Java/model.mustache"/>
224+
</fileset>
225+
226+
</replaceregexp>
227+
228+
</target>
217229
</configuration>
230+
218231
</execution>
232+
</executions>
233+
</plugin>
234+
235+
<plugin>
236+
<groupId>org.apache.maven.plugins</groupId>
237+
<artifactId>maven-resources-plugin</artifactId>
238+
<version>${maven.resources.plugin.version}</version>
239+
<executions>
219240

220241
<execution>
221242
<id>overlay-local-templates</id>

customer-service-client/src/main/resources/customer-api-docs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ openapi: 3.1.0
22
info:
33
title: Customer Service API
44
description: Customer Service API with type-safe generic responses using OpenAPI
5-
version: 0.7.8
5+
version: 0.7.9-SNAPSHOT
66
servers:
77
- url: http://localhost:8084/customer-service
88
description: Local service URL

customer-service-client/src/main/resources/openapi-templates/model.mustache

Lines changed: 0 additions & 102 deletions
This file was deleted.

customer-service/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
<parent>
88
<groupId>org.springframework.boot</groupId>
99
<artifactId>spring-boot-starter-parent</artifactId>
10-
<version>3.5.11</version>
10+
<version>3.5.12</version>
1111
<relativePath/>
1212
</parent>
1313

1414
<groupId>io.github.bsayli</groupId>
1515
<artifactId>customer-service</artifactId>
16-
<version>0.7.8</version>
16+
<version>0.7.9-SNAPSHOT</version>
1717
<name>customer-service</name>
1818
<description>Spring Boot 3.5 + Springdoc (OpenAPI) for generics-aware client generation</description>
1919
<url>https://github.com/bsayli/spring-boot-openapi-generics-clients</url>

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>io.github.bsayli</groupId>
88
<artifactId>spring-boot-openapi-generics-clients</artifactId>
9-
<version>0.7.8</version>
9+
<version>0.7.9-SNAPSHOT</version>
1010
<packaging>pom</packaging>
1111

1212
<name>spring-boot-openapi-generics-clients (aggregator)</name>

0 commit comments

Comments
 (0)