Skip to content

Commit d7a2e4a

Browse files
Apache Camel: implicit headers (#14674)
* Apache Camel: fix implicit headers * ./mvnw clean package ./bin/generate-samples.sh ./bin/utils/export_docs_generators.sh * Q * Created samples/openapi3/client/3_0_3_unit_test/python/test/.gitempty * update samples --------- Co-authored-by: Giacomo Carnevale <[email protected]>
1 parent b6abace commit d7a2e4a

File tree

9 files changed

+32
-23
lines changed

9 files changed

+32
-23
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ additionalProperties:
1515
camelUseDefaultValidationErrorProcessor: true
1616
camelRestClientRequestValidation: true
1717
camelSecurityDefinitions: true
18+
implicitHeaders: true

modules/openapi-generator/src/main/resources/java-camel-server/api.mustache

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,13 @@ public class {{classname}} extends RouteBuilder {
7575
.type(RestParamType.header)
7676
.required({{required}}){{#description}}
7777
.description("{{{.}}}"){{/description}}
78-
.endParam(){{/headerParams}}{{#bodyParams}}
78+
.endParam(){{/headerParams}}{{#implicitHeadersParams}}
79+
.param()
80+
.name("{{baseName}}")
81+
.type(RestParamType.header)
82+
.required({{required}}){{#description}}
83+
.description("{{{.}}}"){{/description}}
84+
.endParam(){{/implicitHeadersParams}}{{#bodyParams}}
7985
.param()
8086
.name("{{paramName}}")
8187
.type(RestParamType.body)

modules/openapi-generator/src/main/resources/java-camel-server/pom.mustache

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ Do not edit the class manually.
3939

4040
<properties>
4141
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
42-
<org.springframework.boot.version>2.6.2</org.springframework.boot.version>
43-
<org.apache.camel.version>3.14.0</org.apache.camel.version>
42+
<org.springframework.boot.version>2.7.8</org.springframework.boot.version>
43+
<org.apache.camel.version>3.20.1</org.apache.camel.version>
4444
</properties>
4545

4646
<dependencyManagement>
@@ -74,10 +74,9 @@ Do not edit the class manually.
7474
<plugin>
7575
<groupId>org.apache.maven.plugins</groupId>
7676
<artifactId>maven-compiler-plugin</artifactId>
77-
<version>3.8.0</version>
77+
<version>3.10.1</version>
7878
<configuration>
79-
<source>1.8</source>
80-
<target>1.8</target>
79+
<release>11</release>
8180
</configuration>
8281
</plugin>
8382
<plugin>
@@ -117,7 +116,7 @@ Do not edit the class manually.
117116
<dependency>
118117
<groupId>org.openapitools</groupId>
119118
<artifactId>jackson-databind-nullable</artifactId>
120-
<version>0.2.1</version>
119+
<version>0.2.4</version>
121120
</dependency>
122121
<dependency>
123122
<groupId>io.swagger</groupId>
@@ -128,19 +127,19 @@ Do not edit the class manually.
128127
<dependency>
129128
<groupId>io.swagger.core.v3</groupId>
130129
<artifactId>swagger-annotations</artifactId>
131-
<version>2.2.7</version>
130+
<version>2.2.8</version>
132131
</dependency>
133132
{{/oas3}}
134133
{{#jackson}}
135134
<dependency>
136135
<groupId>com.fasterxml.jackson.datatype</groupId>
137136
<artifactId>jackson-datatype-jsr310</artifactId>
138-
<version>2.13.0</version>
137+
<version>2.14.2</version>
139138
</dependency>
140139
<dependency>
141140
<groupId>com.fasterxml.jackson.datatype</groupId>
142141
<artifactId>jackson-datatype-jdk8</artifactId>
143-
<version>2.13.0</version>
142+
<version>2.14.2</version>
144143
</dependency>
145144
<dependency>
146145
<groupId>org.apache.camel</groupId>

modules/openapi-generator/src/main/resources/java-camel-server/restConfiguration.mustache

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ public class RestConfiguration extends RouteBuilder {
1414
@Override
1515
public void configure() throws Exception {
1616
restConfiguration()
17+
.scheme("{{scheme}}")
18+
.host("{{host}}")
1719
.component("{{camelRestComponent}}")
1820
.bindingMode(RestBindingMode.{{camelRestBindingMode}}){{#camelDataformatProperties}}
1921
.dataFormatProperty("{{key}}", "{{value}}"){{/camelDataformatProperties}}

modules/openapi-generator/src/main/resources/java-camel-server/routesImpl.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public class {{classname}}RoutesImpl extends RouteBuilder {
2828
.log(LoggingLevel.INFO, "HEADERS: ${headers}"){{#hasProduces}}{{#examples}}{{#-first}}{{^isArray}}{{^isMap}}{{^isPrimitiveType}}
2929
.setBody(constant({{>exampleString}}))
3030
.unmarshal().json(JsonLibrary.Jackson, {{returnType}}.class){{/isPrimitiveType}}{{/isMap}}{{/isArray}}{{#isArray}}
31-
.setBody(constant({{>exampleStringArray}}))
31+
.setBody(constant({{>exampleString}}))
3232
.unmarshal().json(JsonLibrary.Jackson, {{returnBaseType}}[].class){{/isArray}}{{/-first}}{{/examples}}{{/hasProduces}};{{/operation}}{{/operations}}
3333
}
3434
}

samples/server/petstore/java-camel/pom.xml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ Do not edit the class manually.
3939

4040
<properties>
4141
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
42-
<org.springframework.boot.version>2.6.2</org.springframework.boot.version>
43-
<org.apache.camel.version>3.14.0</org.apache.camel.version>
42+
<org.springframework.boot.version>2.7.8</org.springframework.boot.version>
43+
<org.apache.camel.version>3.20.1</org.apache.camel.version>
4444
</properties>
4545

4646
<dependencyManagement>
@@ -74,10 +74,9 @@ Do not edit the class manually.
7474
<plugin>
7575
<groupId>org.apache.maven.plugins</groupId>
7676
<artifactId>maven-compiler-plugin</artifactId>
77-
<version>3.8.0</version>
77+
<version>3.10.1</version>
7878
<configuration>
79-
<source>1.8</source>
80-
<target>1.8</target>
79+
<release>11</release>
8180
</configuration>
8281
</plugin>
8382
<plugin>
@@ -117,7 +116,7 @@ Do not edit the class manually.
117116
<dependency>
118117
<groupId>org.openapitools</groupId>
119118
<artifactId>jackson-databind-nullable</artifactId>
120-
<version>0.2.1</version>
119+
<version>0.2.4</version>
121120
</dependency>
122121
<dependency>
123122
<groupId>io.swagger</groupId>
@@ -127,17 +126,17 @@ Do not edit the class manually.
127126
<dependency>
128127
<groupId>io.swagger.core.v3</groupId>
129128
<artifactId>swagger-annotations</artifactId>
130-
<version>2.2.7</version>
129+
<version>2.2.8</version>
131130
</dependency>
132131
<dependency>
133132
<groupId>com.fasterxml.jackson.datatype</groupId>
134133
<artifactId>jackson-datatype-jsr310</artifactId>
135-
<version>2.13.0</version>
134+
<version>2.14.2</version>
136135
</dependency>
137136
<dependency>
138137
<groupId>com.fasterxml.jackson.datatype</groupId>
139138
<artifactId>jackson-datatype-jdk8</artifactId>
140-
<version>2.13.0</version>
139+
<version>2.14.2</version>
141140
</dependency>
142141
<dependency>
143142
<groupId>org.apache.camel</groupId>

samples/server/petstore/java-camel/src/main/java/org/openapitools/RestConfiguration.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ public class RestConfiguration extends RouteBuilder {
1414
@Override
1515
public void configure() throws Exception {
1616
restConfiguration()
17+
.scheme("http")
18+
.host("petstore.swagger.io")
1719
.component("servlet")
1820
.bindingMode(RestBindingMode.auto)
1921
.dataFormatProperty("json.out.disableFeatures", "WRITE_DATES_AS_TIMESTAMPS")

samples/server/petstore/java-camel/src/main/java/org/openapitools/api/PetApi.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public void configure() throws Exception {
7474
.description("Pet id to delete")
7575
.endParam()
7676
.param()
77-
.name("apiKey")
77+
.name("api_key")
7878
.type(RestParamType.header)
7979
.required(false)
8080
.endParam()

samples/server/petstore/java-camel/src/main/java/org/openapitools/api/PetApiRoutesImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public void configure() throws Exception {
4848
.log(LoggingLevel.INFO, "BODY TYPE: ${body.getClass().getName()}")
4949
.end()
5050
.log(LoggingLevel.INFO, "HEADERS: ${headers}")
51-
.setBody(constant("[[ { \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\" }, { \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\" } ]]"))
51+
.setBody(constant("[ { \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\" }, { \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\" } ]"))
5252
.unmarshal().json(JsonLibrary.Jackson, Pet[].class);
5353
/**
5454
GET /pet/findByTags : Finds Pets by tags
@@ -60,7 +60,7 @@ public void configure() throws Exception {
6060
.log(LoggingLevel.INFO, "BODY TYPE: ${body.getClass().getName()}")
6161
.end()
6262
.log(LoggingLevel.INFO, "HEADERS: ${headers}")
63-
.setBody(constant("[[ { \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\" }, { \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\" } ]]"))
63+
.setBody(constant("[ { \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\" }, { \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\" } ]"))
6464
.unmarshal().json(JsonLibrary.Jackson, Pet[].class);
6565
/**
6666
GET /pet/{petId} : Find pet by ID

0 commit comments

Comments
 (0)