Skip to content

Commit 058f526

Browse files
author
Kathrin Geilmann
committed
Merge branch 'refs/heads/master' into generator_problems_with_spring_reactive
2 parents fd59e50 + dd67423 commit 058f526

File tree

115 files changed

+818
-24
lines changed

Some content is hidden

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

115 files changed

+818
-24
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,18 @@ public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List<Mo
633633
List<CodegenOperation> operations = objectMap.getOperation();
634634
for (CodegenOperation operation : operations) {
635635
if (operation.pathParams != null && operation.pathParams.size() > 0) {
636+
637+
// For types with `isAnyType` we assume it's a `serde_json::Value` type.
638+
// However for path, query, and headers it's unlikely to be JSON so we default to `String`.
639+
// Note that we keep the default `serde_json::Value` for body parameters.
640+
for (var param : operation.allParams) {
641+
if (param.isAnyType && (param.isPathParam || param.isQueryParam || param.isHeaderParam)) {
642+
param.dataType = "String";
643+
param.isPrimitiveType = true;
644+
param.isString = true;
645+
}
646+
}
647+
636648
for (var pathParam : operation.pathParams) {
637649
if (!pathParam.baseName.contains("-")) {
638650
continue;

modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/pom-sb3.mustache

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@
5757

5858
<build>
5959
<sourceDirectory>src/main/java</sourceDirectory>
60-
{{^interfaceOnly}}
6160
<plugins>
61+
{{^interfaceOnly}}
6262
<plugin>
6363
<groupId>org.springframework.boot</groupId>
6464
<artifactId>spring-boot-maven-plugin</artifactId>
@@ -76,6 +76,21 @@
7676
{{/lombok}}
7777
</configuration>
7878
</plugin>
79+
{{/interfaceOnly}}
80+
{{#interfaceOnly}}
81+
<plugin>
82+
<groupId>org.apache.maven.plugins</groupId>
83+
<artifactId>maven-source-plugin</artifactId>
84+
<executions>
85+
<execution>
86+
<id>attach-sources</id>
87+
<goals>
88+
<goal>jar</goal>
89+
</goals>
90+
</execution>
91+
</executions>
92+
</plugin>
93+
{{/interfaceOnly}}
7994
{{#apiFirst}}
8095
<plugin>
8196
<groupId>org.openapitools</groupId>
@@ -109,7 +124,6 @@
109124
</plugin>
110125
{{/apiFirst}}
111126
</plugins>
112-
{{/interfaceOnly}}
113127
</build>
114128
<dependencies>
115129
<dependency>

modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/pom.mustache

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@
5050
{{/parentOverridden}}
5151
<build>
5252
<sourceDirectory>src/main/java</sourceDirectory>
53-
{{^interfaceOnly}}
5453
<plugins>
54+
{{^interfaceOnly}}
5555
<plugin>
5656
<groupId>org.springframework.boot</groupId>
5757
<artifactId>spring-boot-maven-plugin</artifactId>
@@ -69,6 +69,21 @@
6969
{{/lombok}}
7070
</configuration>
7171
</plugin>
72+
{{/interfaceOnly}}
73+
{{#interfaceOnly}}
74+
<plugin>
75+
<groupId>org.apache.maven.plugins</groupId>
76+
<artifactId>maven-source-plugin</artifactId>
77+
<executions>
78+
<execution>
79+
<id>attach-sources</id>
80+
<goals>
81+
<goal>jar</goal>
82+
</goals>
83+
</execution>
84+
</executions>
85+
</plugin>
86+
{{/interfaceOnly}}
7287
{{#apiFirst}}
7388
<plugin>
7489
<groupId>org.openapitools</groupId>
@@ -102,7 +117,6 @@
102117
</plugin>
103118
{{/apiFirst}}
104119
</plugins>
105-
{{/interfaceOnly}}
106120
</build>
107121
<dependencies>
108122
<dependency>

modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-cloud/pom-sb3.mustache

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,20 @@
4545

4646
<build>
4747
<sourceDirectory>src/main/java</sourceDirectory>
48+
{{#interfaceOnly}}<plugins>
49+
<plugin>
50+
<groupId>org.apache.maven.plugins</groupId>
51+
<artifactId>maven-source-plugin</artifactId>
52+
<executions>
53+
<execution>
54+
<id>attach-sources</id>
55+
<goals>
56+
<goal>jar</goal>
57+
</goals>
58+
</execution>
59+
</executions>
60+
</plugin>
61+
</plugins>{{/interfaceOnly}}
4862
</build>
4963

5064
{{^parentOverridden}}

modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-cloud/pom.mustache

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,20 @@
4444
{{/parentOverridden}}
4545
<build>
4646
<sourceDirectory>src/main/java</sourceDirectory>
47+
{{#interfaceOnly}}<plugins>
48+
<plugin>
49+
<groupId>org.apache.maven.plugins</groupId>
50+
<artifactId>maven-source-plugin</artifactId>
51+
<executions>
52+
<execution>
53+
<id>attach-sources</id>
54+
<goals>
55+
<goal>jar</goal>
56+
</goals>
57+
</execution>
58+
</executions>
59+
</plugin>
60+
</plugins>{{/interfaceOnly}}
4761
</build>
4862

4963
{{^parentOverridden}}

modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/pom-sb3.mustache

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,18 @@
5252
</execution>
5353
</executions>
5454
</plugin>{{/interfaceOnly}}
55+
{{#interfaceOnly}}<plugin>
56+
<groupId>org.apache.maven.plugins</groupId>
57+
<artifactId>maven-source-plugin</artifactId>
58+
<executions>
59+
<execution>
60+
<id>attach-sources</id>
61+
<goals>
62+
<goal>jar</goal>
63+
</goals>
64+
</execution>
65+
</executions>
66+
</plugin>{{/interfaceOnly}}
5567
<plugin>
5668
<artifactId>kotlin-maven-plugin</artifactId>
5769
<groupId>org.jetbrains.kotlin</groupId>

modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/pom.mustache

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,18 @@
3939
</execution>
4040
</executions>
4141
</plugin>{{/interfaceOnly}}
42+
{{#interfaceOnly}}<plugin>
43+
<groupId>org.apache.maven.plugins</groupId>
44+
<artifactId>maven-source-plugin</artifactId>
45+
<executions>
46+
<execution>
47+
<id>attach-sources</id>
48+
<goals>
49+
<goal>jar</goal>
50+
</goals>
51+
</execution>
52+
</executions>
53+
</plugin>{{/interfaceOnly}}
4254
<plugin>
4355
<artifactId>kotlin-maven-plugin</artifactId>
4456
<groupId>org.jetbrains.kotlin</groupId>

modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-cloud/pom-sb3.mustache

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,18 @@
6969
</execution>
7070
</executions>
7171
</plugin>{{/interfaceOnly}}
72+
{{#interfaceOnly}}<plugin>
73+
<groupId>org.apache.maven.plugins</groupId>
74+
<artifactId>maven-source-plugin</artifactId>
75+
<executions>
76+
<execution>
77+
<id>attach-sources</id>
78+
<goals>
79+
<goal>jar</goal>
80+
</goals>
81+
</execution>
82+
</executions>
83+
</plugin>{{/interfaceOnly}}
7284
<plugin>
7385
<artifactId>kotlin-maven-plugin</artifactId>
7486
<groupId>org.jetbrains.kotlin</groupId>

modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-cloud/pom.mustache

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,18 @@
4949
</execution>
5050
</executions>
5151
</plugin>{{/interfaceOnly}}
52+
{{#interfaceOnly}}<plugin>
53+
<groupId>org.apache.maven.plugins</groupId>
54+
<artifactId>maven-source-plugin</artifactId>
55+
<executions>
56+
<execution>
57+
<id>attach-sources</id>
58+
<goals>
59+
<goal>jar</goal>
60+
</goals>
61+
</execution>
62+
</executions>
63+
</plugin>{{/interfaceOnly}}
5264
<plugin>
5365
<artifactId>kotlin-maven-plugin</artifactId>
5466
<groupId>org.jetbrains.kotlin</groupId>

modules/openapi-generator/src/test/resources/3_0/rust/petstore.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,11 @@ paths:
615615
description: To test escaping of parameters in rust code works
616616
schema:
617617
type: string
618+
# For testing `isAnyType` types
619+
- name: anyType
620+
in: query
621+
required: true
622+
schema: {}
618623
responses:
619624
'200':
620625
description: successful operation
@@ -996,3 +1001,9 @@ components:
9961001
properties:
9971002
dummy:
9981003
type: string
1004+
AnyTypeTest:
1005+
type: object
1006+
properties:
1007+
foo: {}
1008+
required: ["foo"]
1009+

0 commit comments

Comments
 (0)