forked from loafle/openapi-generator-original
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 <gcarnevale@imolainformatica.it>
This commit is contained in:
parent
b6abace9dc
commit
d7a2e4a293
@ -15,3 +15,4 @@ additionalProperties:
|
||||
camelUseDefaultValidationErrorProcessor: true
|
||||
camelRestClientRequestValidation: true
|
||||
camelSecurityDefinitions: true
|
||||
implicitHeaders: true
|
||||
|
@ -75,7 +75,13 @@ public class {{classname}} extends RouteBuilder {
|
||||
.type(RestParamType.header)
|
||||
.required({{required}}){{#description}}
|
||||
.description("{{{.}}}"){{/description}}
|
||||
.endParam(){{/headerParams}}{{#bodyParams}}
|
||||
.endParam(){{/headerParams}}{{#implicitHeadersParams}}
|
||||
.param()
|
||||
.name("{{baseName}}")
|
||||
.type(RestParamType.header)
|
||||
.required({{required}}){{#description}}
|
||||
.description("{{{.}}}"){{/description}}
|
||||
.endParam(){{/implicitHeadersParams}}{{#bodyParams}}
|
||||
.param()
|
||||
.name("{{paramName}}")
|
||||
.type(RestParamType.body)
|
||||
|
@ -39,8 +39,8 @@ Do not edit the class manually.
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<org.springframework.boot.version>2.6.2</org.springframework.boot.version>
|
||||
<org.apache.camel.version>3.14.0</org.apache.camel.version>
|
||||
<org.springframework.boot.version>2.7.8</org.springframework.boot.version>
|
||||
<org.apache.camel.version>3.20.1</org.apache.camel.version>
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
@ -74,10 +74,9 @@ Do not edit the class manually.
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.0</version>
|
||||
<version>3.10.1</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<release>11</release>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
@ -117,7 +116,7 @@ Do not edit the class manually.
|
||||
<dependency>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>jackson-databind-nullable</artifactId>
|
||||
<version>0.2.1</version>
|
||||
<version>0.2.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
@ -128,19 +127,19 @@ Do not edit the class manually.
|
||||
<dependency>
|
||||
<groupId>io.swagger.core.v3</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
<version>2.2.7</version>
|
||||
<version>2.2.8</version>
|
||||
</dependency>
|
||||
{{/oas3}}
|
||||
{{#jackson}}
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||
<version>2.13.0</version>
|
||||
<version>2.14.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-jdk8</artifactId>
|
||||
<version>2.13.0</version>
|
||||
<version>2.14.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.camel</groupId>
|
||||
|
@ -14,6 +14,8 @@ public class RestConfiguration extends RouteBuilder {
|
||||
@Override
|
||||
public void configure() throws Exception {
|
||||
restConfiguration()
|
||||
.scheme("{{scheme}}")
|
||||
.host("{{host}}")
|
||||
.component("{{camelRestComponent}}")
|
||||
.bindingMode(RestBindingMode.{{camelRestBindingMode}}){{#camelDataformatProperties}}
|
||||
.dataFormatProperty("{{key}}", "{{value}}"){{/camelDataformatProperties}}
|
||||
|
@ -28,7 +28,7 @@ public class {{classname}}RoutesImpl extends RouteBuilder {
|
||||
.log(LoggingLevel.INFO, "HEADERS: ${headers}"){{#hasProduces}}{{#examples}}{{#-first}}{{^isArray}}{{^isMap}}{{^isPrimitiveType}}
|
||||
.setBody(constant({{>exampleString}}))
|
||||
.unmarshal().json(JsonLibrary.Jackson, {{returnType}}.class){{/isPrimitiveType}}{{/isMap}}{{/isArray}}{{#isArray}}
|
||||
.setBody(constant({{>exampleStringArray}}))
|
||||
.setBody(constant({{>exampleString}}))
|
||||
.unmarshal().json(JsonLibrary.Jackson, {{returnBaseType}}[].class){{/isArray}}{{/-first}}{{/examples}}{{/hasProduces}};{{/operation}}{{/operations}}
|
||||
}
|
||||
}
|
||||
|
@ -39,8 +39,8 @@ Do not edit the class manually.
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<org.springframework.boot.version>2.6.2</org.springframework.boot.version>
|
||||
<org.apache.camel.version>3.14.0</org.apache.camel.version>
|
||||
<org.springframework.boot.version>2.7.8</org.springframework.boot.version>
|
||||
<org.apache.camel.version>3.20.1</org.apache.camel.version>
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
@ -74,10 +74,9 @@ Do not edit the class manually.
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.0</version>
|
||||
<version>3.10.1</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<release>11</release>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
@ -117,7 +116,7 @@ Do not edit the class manually.
|
||||
<dependency>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>jackson-databind-nullable</artifactId>
|
||||
<version>0.2.1</version>
|
||||
<version>0.2.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
@ -127,17 +126,17 @@ Do not edit the class manually.
|
||||
<dependency>
|
||||
<groupId>io.swagger.core.v3</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
<version>2.2.7</version>
|
||||
<version>2.2.8</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||
<version>2.13.0</version>
|
||||
<version>2.14.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-jdk8</artifactId>
|
||||
<version>2.13.0</version>
|
||||
<version>2.14.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.camel</groupId>
|
||||
|
@ -14,6 +14,8 @@ public class RestConfiguration extends RouteBuilder {
|
||||
@Override
|
||||
public void configure() throws Exception {
|
||||
restConfiguration()
|
||||
.scheme("http")
|
||||
.host("petstore.swagger.io")
|
||||
.component("servlet")
|
||||
.bindingMode(RestBindingMode.auto)
|
||||
.dataFormatProperty("json.out.disableFeatures", "WRITE_DATES_AS_TIMESTAMPS")
|
||||
|
@ -74,7 +74,7 @@ public class PetApi extends RouteBuilder {
|
||||
.description("Pet id to delete")
|
||||
.endParam()
|
||||
.param()
|
||||
.name("apiKey")
|
||||
.name("api_key")
|
||||
.type(RestParamType.header)
|
||||
.required(false)
|
||||
.endParam()
|
||||
|
@ -48,7 +48,7 @@ public class PetApiRoutesImpl extends RouteBuilder {
|
||||
.log(LoggingLevel.INFO, "BODY TYPE: ${body.getClass().getName()}")
|
||||
.end()
|
||||
.log(LoggingLevel.INFO, "HEADERS: ${headers}")
|
||||
.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\" } ]]"))
|
||||
.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\" } ]"))
|
||||
.unmarshal().json(JsonLibrary.Jackson, Pet[].class);
|
||||
/**
|
||||
GET /pet/findByTags : Finds Pets by tags
|
||||
@ -60,7 +60,7 @@ public class PetApiRoutesImpl extends RouteBuilder {
|
||||
.log(LoggingLevel.INFO, "BODY TYPE: ${body.getClass().getName()}")
|
||||
.end()
|
||||
.log(LoggingLevel.INFO, "HEADERS: ${headers}")
|
||||
.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\" } ]]"))
|
||||
.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\" } ]"))
|
||||
.unmarshal().json(JsonLibrary.Jackson, Pet[].class);
|
||||
/**
|
||||
GET /pet/{petId} : Find pet by ID
|
||||
|
Loading…
x
Reference in New Issue
Block a user