Skip to content

Commit 7521f10

Browse files
author
jpfinne
committed
Merge branch 'master' of https://github.com/jpfinne/openapi-generator into feature/jspecify
2 parents 603af01 + 0f36a83 commit 7521f10

357 files changed

Lines changed: 24242 additions & 2281 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
@@ -10,6 +10,7 @@ on:
1010
- samples/client/petstore/spring-http-interface/**
1111
- samples/client/petstore/spring-http-interface-reactive-noResponseEntity/**
1212
- samples/client/petstore/spring-http-interface-noResponseEntity/**
13+
- samples/client/petstore/spring-http-interface-useHttpServiceProxyFactoryInterfacesConfigurator/**
1314
- samples/client/petstore/java/webclient-jakarta/**
1415
- samples/client/petstore/java/microprofile-rest-client-outer-enum/**
1516
# servers
@@ -29,6 +30,7 @@ on:
2930
- samples/client/petstore/spring-http-interface/**
3031
- samples/client/petstore/spring-http-interface-reactive-noResponseEntity/**
3132
- samples/client/petstore/spring-http-interface-noResponseEntity/**
33+
- samples/client/petstore/spring-http-interface-useHttpServiceProxyFactoryInterfacesConfigurator/**
3234
- samples/client/petstore/java/webclient-jakarta/**
3335
- samples/client/petstore/java/microprofile-rest-client-outer-enum/**
3436
# servers
@@ -54,6 +56,7 @@ jobs:
5456
- samples/client/petstore/spring-http-interface
5557
- samples/client/petstore/spring-http-interface-reactive-noResponseEntity
5658
- samples/client/petstore/spring-http-interface-noResponseEntity
59+
- samples/client/petstore/spring-http-interface-useHttpServiceProxyFactoryInterfacesConfigurator
5760
- samples/client/petstore/java/webclient-jakarta
5861
- samples/client/petstore/java/microprofile-rest-client-outer-enum
5962
# servers

bin/configs/spring-http-interface-noResponseEntity.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ additionalProperties:
1717
useBeanValidation: "true"
1818
performBeanValidation: "true"
1919
useResponseEntity: "false"
20+
useSpringBoot3: "true"

bin/configs/spring-http-interface-reactive-noResponseEntity.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ additionalProperties:
1616
useBeanValidation: "true"
1717
performBeanValidation: "true"
1818
useResponseEntity: "false"
19+
useSpringBoot3: "true"
1920

bin/configs/spring-http-interface-reactive.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ additionalProperties:
1515
# validation should be ignored
1616
useBeanValidation: "true"
1717
performBeanValidation: "true"
18+
useSpringBoot3: "true"
1819

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
generatorName: spring
2+
library: spring-http-interface
3+
outputDir: samples/client/petstore/spring-http-interface-useHttpServiceProxyFactoryInterfacesConfigurator
4+
inputSpec: modules/openapi-generator/src/test/resources/3_0/spring/petstore-with-fake-endpoints-models-for-testing.yaml
5+
templateDir: modules/openapi-generator/src/main/resources/JavaSpring
6+
additionalProperties:
7+
artifactId: spring-http-interface-useHttpServiceProxyFactoryInterfacesConfigurator
8+
snapshotVersion: "true"
9+
hideGenerationTimestamp: "true"
10+
# documentation provider should be ignored
11+
documentationProvider: "springdoc"
12+
# annotation provider should be ignored
13+
annotationLibrary: "swagger2"
14+
# validation should be ignored
15+
useBeanValidation: "true"
16+
performBeanValidation: "true"
17+
useHttpServiceProxyFactoryInterfacesConfigurator: "true"
18+
useSpringBoot3: "true"

bin/configs/spring-http-interface.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ additionalProperties:
1616
# validation should be ignored
1717
useBeanValidation: "true"
1818
performBeanValidation: "true"
19+
useSpringBoot3: "true"

docs/generators/java-camel.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
7373
|interfaceOnly|Whether to generate only API interface stubs without the server files.| |false|
7474
|invokerPackage|root package for generated code| |org.openapitools.api|
7575
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C# have this enabled by default).|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|false|
76-
|library|library template (sub-template)|<dl><dt>**spring-boot**</dt><dd>Spring-boot Server application.</dd><dt>**spring-cloud**</dt><dd>Spring-Cloud-Feign client with Spring-Boot auto-configured settings.</dd><dt>**spring-http-interface**</dt><dd>Spring 6 HTTP interfaces (testing)</dd></dl>|spring-boot|
76+
|library|library template (sub-template)|<dl><dt>**spring-boot**</dt><dd>Spring-boot Server application.</dd><dt>**spring-cloud**</dt><dd>Spring-Cloud-Feign client with Spring-Boot auto-configured settings.</dd><dt>**spring-http-interface**</dt><dd>Spring 6 HTTP interfaces (testing). Requires Spring Boot 3 or 4.</dd></dl>|spring-boot|
7777
|licenseName|The name of the license| |Unlicense|
7878
|licenseUrl|The URL of the license| |http://unlicense.org|
7979
|modelPackage|package for generated models| |org.openapitools.model|
@@ -109,6 +109,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
109109
|useEnumCaseInsensitive|Use `equalsIgnoreCase` when String for enum comparison| |false|
110110
|useFeignClientContextId|Whether to generate Feign client with contextId parameter.| |true|
111111
|useFeignClientUrl|Whether to generate Feign client with url parameter.| |true|
112+
|useHttpServiceProxyFactoryInterfacesConfigurator|Generate HttpInterfacesAbstractConfigurator based on an HttpServiceProxyFactory instance (as opposed to a WebClient instance, when disabled) for generating Spring HTTP interfaces.| |false|
112113
|useJackson3|Set it in order to use jackson 3 dependencies (only allowed when `useSpringBoot4` is set and incompatible with `openApiNullable`).| |false|
113114
|useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false|
114115
|useJspecify|Use Jspecify for null checks. Ony available for Spring, RestClient, WebClient| |false|

docs/generators/spring.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
6666
|interfaceOnly|Whether to generate only API interface stubs without the server files.| |false|
6767
|invokerPackage|root package for generated code| |org.openapitools.api|
6868
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C# have this enabled by default).|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|false|
69-
|library|library template (sub-template)|<dl><dt>**spring-boot**</dt><dd>Spring-boot Server application.</dd><dt>**spring-cloud**</dt><dd>Spring-Cloud-Feign client with Spring-Boot auto-configured settings.</dd><dt>**spring-http-interface**</dt><dd>Spring 6 HTTP interfaces (testing)</dd></dl>|spring-boot|
69+
|library|library template (sub-template)|<dl><dt>**spring-boot**</dt><dd>Spring-boot Server application.</dd><dt>**spring-cloud**</dt><dd>Spring-Cloud-Feign client with Spring-Boot auto-configured settings.</dd><dt>**spring-http-interface**</dt><dd>Spring 6 HTTP interfaces (testing). Requires Spring Boot 3 or 4.</dd></dl>|spring-boot|
7070
|licenseName|The name of the license| |Unlicense|
7171
|licenseUrl|The URL of the license| |http://unlicense.org|
7272
|modelPackage|package for generated models| |org.openapitools.model|
@@ -102,6 +102,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
102102
|useEnumCaseInsensitive|Use `equalsIgnoreCase` when String for enum comparison| |false|
103103
|useFeignClientContextId|Whether to generate Feign client with contextId parameter.| |true|
104104
|useFeignClientUrl|Whether to generate Feign client with url parameter.| |true|
105+
|useHttpServiceProxyFactoryInterfacesConfigurator|Generate HttpInterfacesAbstractConfigurator based on an HttpServiceProxyFactory instance (as opposed to a WebClient instance, when disabled) for generating Spring HTTP interfaces.| |false|
105106
|useJackson3|Set it in order to use jackson 3 dependencies (only allowed when `useSpringBoot4` is set and incompatible with `openApiNullable`).| |false|
106107
|useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false|
107108
|useJspecify|Use Jspecify for null checks. Ony available for Spring, RestClient, WebClient| |false|

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,6 +1126,7 @@ public void addGenericHostSupportingFiles(final String clientPackageDir, final S
11261126
supportingFiles.add(new SupportingFile("JsonSerializerOptionsProvider.mustache", clientPackageDir, "JsonSerializerOptionsProvider.cs"));
11271127
supportingFiles.add(new SupportingFile("CookieContainer.mustache", clientPackageDir, "CookieContainer.cs"));
11281128
supportingFiles.add(new SupportingFile("Option.mustache", clientPackageDir, "Option.cs"));
1129+
supportingFiles.add(new SupportingFile("FileParameter.mustache", clientPackageDir, "FileParameter.cs"));
11291130

11301131
supportingFiles.add(new SupportingFile("IApi.mustache", sourceFolder + File.separator + packageName + File.separator + apiPackage(), getInterfacePrefix() + "Api.cs"));
11311132

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

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public class PostmanCollectionCodegen extends DefaultCodegen implements CodegenC
8080

8181

8282
// operations grouped by tag
83-
public Map<String, List<CodegenOperation>> codegenOperationsByTag = new HashMap<>();
83+
public Map<PostmanRequestFolder, List<CodegenOperation>> codegenOperationsByTag = new HashMap<>();
8484
// list of operations
8585
public List<CodegenOperation> codegenOperationsList = new ArrayList<>();
8686

@@ -319,22 +319,31 @@ public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List<Mo
319319
* @param codegenOperation Codegen operation instance
320320
*/
321321
public void addToMap(CodegenOperation codegenOperation) {
322-
323-
String key = null;
322+
String tagName;
323+
String tagDescription;
324324
if (codegenOperation.tags == null || codegenOperation.tags.isEmpty()) {
325-
key = "default";
325+
tagName = "Default";
326+
tagDescription = "Default tag";
326327
} else {
327-
key = codegenOperation.tags.get(0).getName();
328+
tagName = codegenOperation.tags.get(0).getName();
329+
tagDescription = codegenOperation.tags.get(0).getDescription();
330+
if (tagDescription == null) {
331+
tagDescription = tagName + " tag";
332+
}
328333
}
329334

330-
List<CodegenOperation> list = codegenOperationsByTag.get(key);
335+
tagName = formatDescription(tagName);
336+
tagDescription = formatDescription(tagDescription);
337+
338+
PostmanRequestFolder folder = new PostmanRequestFolder(tagName, tagDescription);
339+
List<CodegenOperation> list = codegenOperationsByTag.get(folder);
331340

332341
if (list == null) {
333342
list = new ArrayList<>();
334343
}
335344
list.add(codegenOperation);
336345

337-
codegenOperationsByTag.put(key, list);
346+
codegenOperationsByTag.put(folder, list);
338347

339348
// sort requests by path
340349
Collections.sort(list, Comparator.comparing(obj -> obj.path));
@@ -883,6 +892,30 @@ public String getPostmanType(CodegenProperty codegenProperty) {
883892
}
884893
}
885894

895+
@Getter
896+
public static class PostmanRequestFolder {
897+
private final String name;
898+
private final String description;
899+
900+
public PostmanRequestFolder(String name, String description) {
901+
this.name = name;
902+
this.description = description;
903+
}
904+
905+
@Override
906+
public boolean equals(Object o) {
907+
if (this == o) return true;
908+
if (o == null || getClass() != o.getClass()) return false;
909+
PostmanRequestFolder that = (PostmanRequestFolder) o;
910+
return Objects.equals(name, that.name) && Objects.equals(description, that.description);
911+
}
912+
913+
@Override
914+
public int hashCode() {
915+
return Objects.hash(name, description);
916+
}
917+
}
918+
886919
// Supporting models
887920
@Getter
888921
@Setter

0 commit comments

Comments
 (0)