Skip to content

Commit 49fa455

Browse files
committed
Merge branch 'master' into feature/add-support-for-includeHttpRequestContext-to-java-spring-codegen
# Conflicts: # .github/workflows/samples-jdk17.yaml
2 parents 0a83778 + 3ecb490 commit 49fa455

302 files changed

Lines changed: 17919 additions & 2646 deletions

File tree

Some content is hidden

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

.github/workflows/samples-jdk17.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ on:
1515
# servers
1616
- samples/openapi3/server/petstore/springboot-3/**
1717
- samples/openapi3/server/petstore/springboot-3-include-http-request-context/**
18+
- samples/server/petstore/springboot-x-implements-skip/**
1819
- samples/server/petstore/java-camel/**
1920
- samples/server/petstore/java-helidon-server/v3/mp/**
2021
- samples/server/petstore/java-helidon-server/v3/se/**
@@ -33,6 +34,7 @@ on:
3334
# servers
3435
- samples/openapi3/server/petstore/springboot-3/**
3536
- samples/openapi3/server/petstore/springboot-3-include-http-request-context/**
37+
- samples/server/petstore/springboot-x-implements-skip/**
3638
- samples/server/petstore/java-camel/**
3739
- samples/server/petstore/java-helidon-server/v3/mp/**
3840
- samples/server/petstore/java-helidon-server/v3/se/**
@@ -57,6 +59,7 @@ jobs:
5759
# servers
5860
- samples/openapi3/server/petstore/springboot-3
5961
- samples/openapi3/server/petstore/springboot-3-include-http-request-context
62+
- samples/server/petstore/springboot-x-implements-skip
6063
- samples/server/petstore/java-camel/
6164
- samples/server/petstore/java-helidon-server/v3/mp/
6265
- samples/server/petstore/java-helidon-server/v3/se

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,7 +1260,7 @@ If you want to join the committee, please kindly apply by sending an email to te
12601260
| JMeter | @kannkyo (2021/01) |
12611261
| Jetbrains HTTP Client | @jlengrand (2023/01) |
12621262
| Julia | @tanmaykm (2023/01) |
1263-
| Kotlin | @karismann (2019/03) @Zomzog (2019/04) @andrewemery (2019/10) @4brunu (2019/11) @yutaka0m (2020/03) @stefankoppier (2022/06) @e5l (2024/10) |
1263+
| Kotlin | @karismann (2019/03) @Zomzog (2019/04) @andrewemery (2019/10) @4brunu (2019/11) @yutaka0m (2020/03) @stefankoppier (2022/06) @e5l (2024/10) @dennisameling (2026/02) |
12641264
| Lua | @daurnimator (2017/08) |
12651265
| N4JS | @mmews-n4 (2023/03) |
12661266
| Nim | |
@@ -1276,7 +1276,7 @@ If you want to join the committee, please kindly apply by sending an email to te
12761276
| Rust | @frol (2017/07) @farcaller (2017/08) @richardwhiuk (2019/07) @paladinzh (2020/05) @jacob-pro (2022/10) @dsteeley (2025/07) |
12771277
| Scala | @clasnake (2017/07), @shijinkui (2018/01), @ramzimaalej (2018/03), @chameleon82 (2020/03), @Bouillie (2020/04) @fish86 (2023/06) |
12781278
| Swift | @jgavris (2017/07) @ehyche (2017/08) @Edubits (2017/09) @jaz-ah (2017/09) @4brunu (2019/11) @dydus0x14 (2023/06) |
1279-
| TypeScript | @TiFu (2017/07) @taxpon (2017/07) @sebastianhaas (2017/07) @kenisteward (2017/07) @Vrolijkx (2017/09) @macjohnny (2018/01) @topce (2018/10) @akehir (2019/07) @petejohansonxo (2019/11) @amakhrov (2020/02) @davidgamero (2022/03) @mkusaka (2022/04) @joscha (2024/10) |
1279+
| TypeScript | @TiFu (2017/07) @taxpon (2017/07) @sebastianhaas (2017/07) @kenisteward (2017/07) @Vrolijkx (2017/09) @macjohnny (2018/01) @topce (2018/10) @akehir (2019/07) @petejohansonxo (2019/11) @amakhrov (2020/02) @davidgamero (2022/03) @mkusaka (2022/04) @joscha (2024/10) @dennisameling (2026/02) |
12801280
| Xojo | @Topheee (2023/04) |
12811281

12821282

bin/configs/java-camel-petstore-new.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@ outputDir: samples/server/petstore/java-camel
33
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
44
templateDir: modules/openapi-generator/src/main/resources/java-camel-server
55
additionalProperties:
6-
oas3: "true"
76
hideGenerationTimestamp: true
87
camelRestBindingMode: "auto"
98
performBeanValidation: true
109
#dateLibrary: "java8-localdatetime"
1110
camelDataformatProperties: "json.out.disableFeatures=WRITE_DATES_AS_TIMESTAMPS"
12-
library: "spring-boot"
1311
withXml: true
1412
jackson: true
1513
camelUseDefaultValidationErrorProcessor: true

bin/configs/kotlin-spring-boot-x-kotlin-implements.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,14 @@ additionalProperties:
1313
serializableModel: true
1414
beanValidations: true
1515
includeHttpRequestContext: true
16+
schemaImplements:
17+
Pet: com.some.pack.WithId
18+
Category: [ com.some.pack.CategoryInterface ]
19+
Dog: [ com.some.pack.Canine ]
20+
schemaImplementsFields:
21+
Pet: id
22+
Category: [ name, id ]
23+
Dog: [ bark, breed ]
24+
xKotlinImplementsSkip: [ com.some.pack.WithPhotoUrls ]
25+
xKotlinImplementsFieldsSkip:
26+
Pet: [ photoUrls ]

bin/configs/kotlin-spring-declarative-interface-wrapped.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ additionalProperties:
1313
reactive: false
1414
useResponseEntity: true
1515
useFlowForArrayReturnType: false
16+
requestMappingMode: "api_interface"
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
generatorName: spring
2+
outputDir: samples/server/petstore/springboot-x-implements-skip
3+
inputSpec: modules/openapi-generator/src/test/resources/3_0/spring/petstore-with-fake-endpoints-models-for-testing-x-implements.yaml
4+
templateDir: modules/openapi-generator/src/main/resources/JavaSpring
5+
additionalProperties:
6+
documentationProvider: springfox
7+
artifactId: springboot
8+
snapshotVersion: "true"
9+
hideGenerationTimestamp: "true"
10+
camelCaseDollarSign: "true"
11+
modelNameSuffix: 'Dto'
12+
xImplementsSkip: [ com.custompackage.InterfaceToSkip ]
13+
schemaImplements:
14+
Foo: [ com.custompackage.WithBar, com.custompackage.WithDefaultMethod ]
15+
Animal: com.custompackage.WithColor

docs/generators/java-camel.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
8888
|resourceFolder|resource folder for generated resources| |src/main/resources|
8989
|responseWrapper|wrap the responses in given type (Future, Callable, CompletableFuture,ListenableFuture, DeferredResult, RxObservable, RxSingle or fully qualified type)| |null|
9090
|returnSuccessCode|Generated server returns 2xx code| |false|
91+
|schemaImplements|Ability to supply interfaces per schema that should be implemented (serves similar purpose as vendor extension `x-implements`, but is fully decoupled from the api spec). Example: yaml `schemaImplements: {Pet: com.some.pack.WithId, Category: [com.some.pack.CategoryInterface], Dog: [com.some.pack.Canine, com.some.pack.OtherInterface]}` implements interfaces in schemas `Pet` (interface `com.some.pack.WithId`), `Category` (interface `com.some.pack.CategoryInterface`), `Dog`(interfaces `com.some.pack.Canine`, `com.some.pack.OtherInterface`)| |empty map|
9192
|scmConnection|SCM connection in generated pom.xml| |scm:git:git@github.com:openapitools/openapi-generator.git|
9293
|scmDeveloperConnection|SCM developer connection in generated pom.xml| |scm:git:git@github.com:openapitools/openapi-generator.git|
9394
|scmUrl|SCM URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
@@ -119,6 +120,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
119120
|useTags|use tags for creating interface and controller classnames| |false|
120121
|virtualService|Generates the virtual service. For more details refer - https://github.com/virtualansoftware/virtualan/wiki| |false|
121122
|withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false|
123+
|xImplementsSkip|Ability to choose interfaces that should NOT be implemented in the models despite their presence in vendor extension `x-implements`. Takes a list of fully qualified interface names. Example: yaml `xImplementsSkip: [com.some.pack.WithPhotoUrls]` skips implementing the interface `com.some.pack.WithPhotoUrls` in any schema| |empty list|
122124

123125
## SUPPORTED VENDOR EXTENSIONS
124126

docs/generators/kotlin-spring.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl
4343
|parcelizeModels|toggle "@Parcelize" for generated models| |null|
4444
|reactive|use coroutines for reactive behavior| |false|
4545
|requestMappingMode|Where to generate the class level @RequestMapping annotation.|<dl><dt>**api_interface**</dt><dd>Generate the @RequestMapping annotation on the generated Api Interface.</dd><dt>**controller**</dt><dd>Generate the @RequestMapping annotation on the generated Api Controller Implementation.</dd><dt>**none**</dt><dd>Do not add a class level @RequestMapping annotation.</dd></dl>|controller|
46+
|schemaImplements|A map of single interface or a list of interfaces per schema name that should be implemented (serves similar purpose as `x-kotlin-implements`, but is fully decoupled from the api spec). Example: yaml `schemaImplements: {Pet: com.some.pack.WithId, Category: [com.some.pack.CategoryInterface], Dog: [com.some.pack.Canine, com.some.pack.OtherInterface]}` implements interfaces in schemas `Pet` (interface `com.some.pack.WithId`), `Category` (interface `com.some.pack.CategoryInterface`), `Dog`(interfaces `com.some.pack.Canine`, `com.some.pack.OtherInterface`)| |empty map|
47+
|schemaImplementsFields|A map of single field or a list of fields per schema name that should be prepended with `override` (serves similar purpose as `x-kotlin-implements-fields`, but is fully decoupled from the api spec). Example: yaml `schemaImplementsFields: {Pet: id, Category: [name, id], Dog: [bark, breed]}` marks fields to be prepended with `override` in schemas `Pet` (field `id`), `Category` (fields `name`, `id`) and `Dog` (fields `bark`, `breed`)| |empty map|
4648
|serializableModel|boolean - toggle &quot;implements Serializable&quot; for generated models| |null|
4749
|serverPort|configuration the port in which the sever is to run on| |8080|
4850
|serviceImplementation|generate stub service implementations that extends service interfaces. If this is set to true service interfaces will also be generated| |false|
@@ -59,6 +61,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl
5961
|useSpringBoot3|Generate code and provide dependencies for use with Spring Boot &ge; 3 (use jakarta instead of javax in imports). Enabling this option will also enable `useJakartaEe`.| |false|
6062
|useSwaggerUI|Open the OpenApi specification in swagger-ui. Will also import and configure needed dependencies| |true|
6163
|useTags|Whether to use tags for creating interface and controller class names| |false|
64+
|xKotlinImplementsFieldsSkip|A list of fields per schema name that should NOT be created with `override` keyword despite their presence in vendor extension `x-kotlin-implements-fields` for the schema. Example: yaml `xKotlinImplementsFieldsSkip: Pet: [photoUrls]` skips `override` for `photoUrls` in schema `Pet`| |empty map|
65+
|xKotlinImplementsSkip|A list of fully qualified interfaces that should NOT be implemented despite their presence in vendor extension `x-kotlin-implements`. Example: yaml `xKotlinImplementsSkip: [com.some.pack.WithPhotoUrls]` skips implementing the interface in any schema| |empty list|
6266

6367
## SUPPORTED VENDOR EXTENSIONS
6468

docs/generators/spring.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
8181
|resourceFolder|resource folder for generated resources| |src/main/resources|
8282
|responseWrapper|wrap the responses in given type (Future, Callable, CompletableFuture,ListenableFuture, DeferredResult, RxObservable, RxSingle or fully qualified type)| |null|
8383
|returnSuccessCode|Generated server returns 2xx code| |false|
84+
|schemaImplements|Ability to supply interfaces per schema that should be implemented (serves similar purpose as vendor extension `x-implements`, but is fully decoupled from the api spec). Example: yaml `schemaImplements: {Pet: com.some.pack.WithId, Category: [com.some.pack.CategoryInterface], Dog: [com.some.pack.Canine, com.some.pack.OtherInterface]}` implements interfaces in schemas `Pet` (interface `com.some.pack.WithId`), `Category` (interface `com.some.pack.CategoryInterface`), `Dog`(interfaces `com.some.pack.Canine`, `com.some.pack.OtherInterface`)| |empty map|
8485
|scmConnection|SCM connection in generated pom.xml| |scm:git:git@github.com:openapitools/openapi-generator.git|
8586
|scmDeveloperConnection|SCM developer connection in generated pom.xml| |scm:git:git@github.com:openapitools/openapi-generator.git|
8687
|scmUrl|SCM URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
@@ -112,6 +113,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
112113
|useTags|use tags for creating interface and controller classnames| |false|
113114
|virtualService|Generates the virtual service. For more details refer - https://github.com/virtualansoftware/virtualan/wiki| |false|
114115
|withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false|
116+
|xImplementsSkip|Ability to choose interfaces that should NOT be implemented in the models despite their presence in vendor extension `x-implements`. Takes a list of fully qualified interface names. Example: yaml `xImplementsSkip: [com.some.pack.WithPhotoUrls]` skips implementing the interface `com.some.pack.WithPhotoUrls` in any schema| |empty list|
115117

116118
## SUPPORTED VENDOR EXTENSIONS
117119

modules/openapi-generator/src/main/java/org/openapitools/codegen/CliOption.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@ public static CliOption newString(String opt, String description) {
112112
return new CliOption(opt, description, SchemaTypeUtil.STRING_TYPE);
113113
}
114114

115+
public static CliOption newString(String opt, String description, String defaultValue) {
116+
return new CliOption(opt, description, SchemaTypeUtil.STRING_TYPE).defaultValue(String.valueOf(defaultValue));
117+
}
118+
115119
@JsonIgnore
116120
public String getOptionHelp() {
117121
StringBuilder sb = new StringBuilder(description);

0 commit comments

Comments
 (0)