Skip to content

Commit e1c96a9

Browse files
jpfinnejpfinne
andauthored
[java] [Spring] useJspecify for java clients and spring generator (#23256)
* useJspecify for java clients and spring generator * Merge master * Regenerate documentation * Remove ignore file * Doc only for JavaClientCodegen and SpringCodeGen * Regenerate * Simplification of JSpecify implementation * Fix typo "Only supported" * Fix documentation formatting * Fix documentation formatting * Fix extra spaces * Merge master * Fix spacing for Spring generator * Merge master * Merge master * Add samples to github flow * Try to rebuild samples on gitFlow * git update-index --chmod=+x samples/client/petstore/java/native-jackson3-jspecify/gradlew * Add jspecify to build.gradle * Add jspecify to build.gradle in dependencies { * conditionally include jspecify dependencies * merge master * Simplify spacing * Fix native request builder * Some cleanup and comments * Some cleanup --------- Co-authored-by: jpfinne <jean-paul.finne@fednot.be>
1 parent f12fe51 commit e1c96a9

File tree

224 files changed

+15463
-65
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

224 files changed

+15463
-65
lines changed

.github/workflows/samples-java-client-jdk17.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ on:
88
- samples/client/petstore/java/webclient-jakarta/**
99
- samples/client/petstore/java/restclient-*/**
1010
- samples/client/petstore/java/native-jackson3/**
11+
- samples/client/petstore/java/native-jackson3-jspecify/**
12+
- samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/**
1113
- samples/client/others/java/webclient-sealedInterface/**
1214
- samples/client/others/java/webclient-sealedInterface_3_1/**
1315
- samples/client/petstore/java/webclient-useSingleRequestParameter/**
@@ -21,6 +23,8 @@ on:
2123
- samples/client/petstore/java/webclient-jakarta/**
2224
- samples/client/petstore/java/restclient-*/**
2325
- samples/client/petstore/java/native-jackson3/**
26+
- samples/client/petstore/java/native-jackson3-jspecify/**
27+
- samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/**
2428
- samples/client/others/java/webclient-sealedInterface/**
2529
- samples/client/others/java/webclient-sealedInterface_3_1/**
2630
- samples/client/petstore/java/webclient-useSingleRequestParameter/**
@@ -44,6 +48,8 @@ jobs:
4448
- samples/client/petstore/java/restclient-nullable-arrays
4549
- samples/client/petstore/java/restclient-springBoot4-jackson2
4650
- samples/client/petstore/java/restclient-springBoot4-jackson3
51+
- samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify
52+
- samples/client/petstore/java/native-jackson3-jspecify
4753
- samples/client/petstore/java/restclient-swagger2
4854
- samples/client/petstore/java/restclient-useSingleRequestParameter
4955
- samples/client/petstore/java/restclient-useSingleRequestParameter-static

.github/workflows/samples-spring-jdk17.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
- samples/client/petstore/spring-http-interface-springboot-4/**
99
- samples/openapi3/server/petstore/springboot-3/**
1010
- samples/openapi3/server/petstore/springboot-4/**
11+
- samples/openapi3/server/petstore/springboot-4-jspecify/**
1112
- samples/server/petstore/springboot-api-response-examples/**
1213
- samples/server/petstore/springboot-lombok-data/**
1314
- samples/server/petstore/springboot-lombok-tostring/**
@@ -22,6 +23,7 @@ on:
2223
- samples/client/petstore/spring-http-interface-springboot-4/**
2324
- samples/openapi3/server/petstore/springboot-3/**
2425
- samples/openapi3/server/petstore/springboot-4/**
26+
- samples/openapi3/server/petstore/springboot-4-jspecify/**
2527
- samples/server/petstore/springboot-api-response-examples/**
2628
- samples/server/petstore/springboot-lombok-data/**
2729
- samples/server/petstore/springboot-lombok-tostring/**
@@ -44,6 +46,7 @@ jobs:
4446
# servers
4547
- samples/openapi3/server/petstore/springboot-3
4648
- samples/openapi3/server/petstore/springboot-4
49+
- samples/openapi3/server/petstore/springboot-4-jspecify
4750
- samples/server/petstore/springboot-api-response-examples
4851
- samples/server/petstore/springboot-lombok-data
4952
- samples/server/petstore/springboot-lombok-tostring
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
generatorName: java
2+
outputDir: samples/client/petstore/java/native-jackson3-jspecify
3+
library: native
4+
inputSpec: modules/openapi-generator/src/test/resources/3_0/java/jspecify.yaml
5+
templateDir: modules/openapi-generator/src/main/resources/Java
6+
validateSpec: false
7+
additionalProperties:
8+
artifactId: petstore-native-jackson3
9+
hideGenerationTimestamp: "true"
10+
generateBuilders: true
11+
useReflectionEqualsHashCode: "true"
12+
useJackson3: "true"
13+
openApiNullable: "false"
14+
useJspecify: true
15+
typeMappings:
16+
OffsetDateTime: java.time.Instant
17+
BigDecimal: java.math.BigDecimal
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
generatorName: java
2+
outputDir: samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify
3+
library: restclient
4+
inputSpec: modules/openapi-generator/src/test/resources/3_0/java/jspecify.yaml
5+
templateDir: modules/openapi-generator/src/main/resources/Java
6+
validateSpec: false
7+
additionalProperties:
8+
artifactId: petstore-restclient
9+
hideGenerationTimestamp: "true"
10+
containerDefaultToNull: "true"
11+
useSpringBoot4: true
12+
useJackson3: true
13+
openApiNullable: false
14+
useJspecify: true
15+
typeMappings:
16+
OffsetDateTime: java.time.Instant
17+
BigDecimal: java.math.BigDecimal
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
generatorName: java
2+
outputDir: samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify
3+
library: resttemplate
4+
inputSpec: modules/openapi-generator/src/test/resources/3_0/java/jspecify.yaml
5+
templateDir: modules/openapi-generator/src/main/resources/Java
6+
validateSpec: false
7+
additionalProperties:
8+
artifactId: petstore-resttemplate
9+
hideGenerationTimestamp: "true"
10+
containerDefaultToNull: "true"
11+
useJakartaEe: true
12+
useSpringBoot4: true
13+
useJackson3: true
14+
openApiNullable: false
15+
useJspecify: true
16+
typeMappings:
17+
OffsetDateTime: java.time.Instant
18+
BigDecimal: java.math.BigDecimal
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
generatorName: java
2+
outputDir: samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify
3+
library: webclient
4+
inputSpec: modules/openapi-generator/src/test/resources/3_0/java/jspecify.yaml
5+
templateDir: modules/openapi-generator/src/main/resources/Java
6+
validateSpec: false
7+
additionalProperties:
8+
artifactId: petstore-webclient
9+
hideGenerationTimestamp: "true"
10+
containerDefaultToNull: "true"
11+
useSpringBoot4: true
12+
useJackson3: true
13+
openApiNullable: false
14+
useJspecify: true
15+
typeMappings:
16+
OffsetDateTime: java.time.Instant
17+
BigDecimal: java.math.BigDecimal
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
generatorName: spring
2+
library: spring-boot
3+
outputDir: samples/openapi3/server/petstore/springboot-4-jspecify
4+
inputSpec: modules/openapi-generator/src/test/resources/3_0/java/jspecify.yaml
5+
templateDir: modules/openapi-generator/src/main/resources/JavaSpring
6+
validateSpec: false
7+
additionalProperties:
8+
groupId: org.openapitools.openapi3
9+
documentationProvider: springdoc
10+
interfaceOnly: true
11+
artifactId: springboot
12+
snapshotVersion: "true"
13+
useSpringBoot4: true
14+
useJackson3: true
15+
useBeanValidation: true
16+
withXml: true
17+
hideGenerationTimestamp: "true"
18+
generateConstructorWithAllArgs: true
19+
generateBuilders: true
20+
openApiNullable: false
21+
useJspecify: true

docs/generators/java-camel.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
112112
|useHttpServiceProxyFactoryInterfacesConfigurator|Generate HttpInterfacesAbstractConfigurator based on an HttpServiceProxyFactory instance (as opposed to a WebClient instance, when disabled) for generating Spring HTTP interfaces.| |false|
113113
|useJackson3|Set it in order to use jackson 3 dependencies (only allowed when `useSpringBoot4` is set).| |false|
114114
|useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false|
115+
|useJspecify|Use Jspecify for null checks| |false|
115116
|useOneOfInterfaces|whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface| |true|
116117
|useOptional|Use Optional container for optional parameters| |false|
117118
|useResponseEntity|Use the `ResponseEntity` type to wrap return values of generated API methods. If disabled, method are annotated using a `@ResponseStatus` annotation, which has the status of the first response declared in the Api definition| |true|

docs/generators/java-microprofile.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
9999
|useGzipFeature|Send gzip-encoded requests| |false|
100100
|useJackson3|Use Jackson 3 instead of Jackson 2. Supported for 'native' library (requires Java 17+) and for Spring 'resttemplate', 'webclient', and 'restclient' libraries (require useSpringBoot4=true). Incompatible with 'openApiNullable'.| |false|
101101
|useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false|
102+
|useJspecify|Use Jspecify for null checks. Only supported for [native, restclient, resttemplate, webclient]| |false|
102103
|useOneOfDiscriminatorLookup|Use the discriminator's mapping in oneOf to speed up the model lookup. IMPORTANT: Validation (e.g. one and only one match in oneOf's schemas) will be skipped. Only jersey2, jersey3, native, okhttp-gson support this option.| |false|
103104
|useOneOfInterfaces|whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface| |false|
104105
|usePlayWS|Use Play! Async HTTP client (Play WS API)| |false|

docs/generators/java.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
9999
|useGzipFeature|Send gzip-encoded requests| |false|
100100
|useJackson3|Use Jackson 3 instead of Jackson 2. Supported for 'native' library (requires Java 17+) and for Spring 'resttemplate', 'webclient', and 'restclient' libraries (require useSpringBoot4=true). Incompatible with 'openApiNullable'.| |false|
101101
|useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false|
102+
|useJspecify|Use Jspecify for null checks. Only supported for [native, restclient, resttemplate, webclient]| |false|
102103
|useOneOfDiscriminatorLookup|Use the discriminator's mapping in oneOf to speed up the model lookup. IMPORTANT: Validation (e.g. one and only one match in oneOf's schemas) will be skipped. Only jersey2, jersey3, native, okhttp-gson support this option.| |false|
103104
|useOneOfInterfaces|whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface| |false|
104105
|usePlayWS|Use Play! Async HTTP client (Play WS API)| |false|

0 commit comments

Comments
 (0)