Apache Camel Server Generator (#11162)

* Created Apache Camel language

* Added unit test

* Fix template dir

* Fix description api

* Camel Dataformat Properties

* Apache Camel Doc

* Apache Camel Doc

* Apache Camel Doc

* Apache Camel maven plugin example

* Fix LOGGER

* Samples

* Camel 3.14

* Samples

* samples

* up to date

* Rename camel to java-camel

* up to date

* Fix SerializedName in modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache
This commit is contained in:
Giacomo
2022-01-12 18:28:02 +01:00
committed by GitHub
parent 69b64ebb0e
commit 2e6e82161f
45 changed files with 4092 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
generatorName: java-camel
outputDir: samples/server/petstore/java-camel
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/java-camel-server
additionalProperties:
oas3: "true"
hideGenerationTimestamp: true
camelRestBindingMode: "auto"
performBeanValidation: true
#dateLibrary: "java8-localdatetime"
camelDataformatProperties: "json.out.disableFeatures=WRITE_DATES_AS_TIMESTAMPS"
library: "spring-boot"
withXml: true
jackson: true
camelUseDefaulValidationtErrorProcessor: true
camelRestClientRequestValidation: true
camelSecurityDefinitions: true

View File

@@ -97,6 +97,7 @@ The following generators are available:
* [graphql-nodejs-express-server](generators/graphql-nodejs-express-server.md)
* [haskell](generators/haskell.md)
* [haskell-yesod (beta)](generators/haskell-yesod.md)
* [java-camel](generators/java-camel.md)
* [java-inflector](generators/java-inflector.md)
* [java-msf4j](generators/java-msf4j.md)
* [java-pkmst](generators/java-pkmst.md)

View File

@@ -0,0 +1,314 @@
---
title: Config Options for java-camel
sidebar_label: java-camel
---
These options may be applied as additional-properties (cli) or configOptions (plugins). Refer to [configuration docs](https://openapi-generator.tech/docs/configuration) for more details.
| Option | Description | Values | Default |
| ------ | ----------- | ------ | ------- |
|additionalEnumTypeAnnotations|Additional annotations for enum type(class level annotations)| |null|
|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations). List separated by semicolon(;) or new line (Linux or Windows)| |null|
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|apiFirst|Generate the API from the OAI spec at server compile time (API first approach)| |false|
|apiPackage|package for generated api classes| |org.openapitools.api|
|artifactDescription|artifact description in generated pom.xml| |OpenAPI Java|
|artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |openapi-spring|
|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|async|use async Callable controllers| |false|
|basePackage|base package (invokerPackage) for generated code| |org.openapitools|
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|camelDataformatProperties|list of dataformat properties separated by comma (propertyName1=propertyValue2,...| ||
|camelRestBindingMode|binding mode to be used by the REST consumer| |auto|
|camelRestClientRequestValidation|enable validation of the client request to check whether the Content-Type and Accept headers from the client is supported by the Rest-DSL configuration| |false|
|camelRestComponent|name of the Camel component to use as the REST consumer| |servlet|
|camelSecurityDefinitions|generate camel security definitions| |true|
|camelUseDefaulValidationtErrorProcessor|generate default validation error processor| |true|
|camelValidationErrorProcessor|validation error processor bean name| |validationErrorProcessor|
|configPackage|configuration package for generated code| |org.openapitools.configuration|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date (if you really have a good reason not to use threetenbp</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+) - note: this also sets &quot;java8&quot; to true</dd><dt>**threetenbp**</dt><dd>Backport of JSR310 (preferred for jdk &lt; 1.8)</dd></dl>|threetenbp|
|delegatePattern|Whether to generate the server files using the delegate pattern| |false|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org|
|developerOrganizationUrl|developer organization URL in generated pom.xml| |http://openapitools.org|
|disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false|
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|enumUnknownDefaultCase|If the server adds new enum cases, that are unknown by an old spec/client, the client will fail to parse the network response.With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the server sends an enum case that is not known by the client/spec, they can safely fallback to this case.|<dl><dt>**false**</dt><dd>No changes to the enum's are made, this is the default option.</dd><dt>**true**</dt><dd>With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the enum case sent by the server is not known by the client/spec, can safely be decoded to this case.</dd></dl>|false|
|fullJavaUtil|whether to use fully qualified name for classes under java.util. This option only works for Java API client| |false|
|groupId|groupId in generated pom.xml| |org.openapitools|
|hateoas|Use Spring HATEOAS library to allow adding HATEOAS links| |false|
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false|
|ignoreAnyOfInEnum|Ignore anyOf keyword in enum| |false|
|implicitHeaders|Skip header parameters in the generated API methods using @ApiImplicitParams annotation.| |false|
|interfaceOnly|Whether to generate only API interface stubs without the server files.| |false|
|invokerPackage|root package for generated code| |org.openapitools.api|
|java8|Use Java8 classes instead of third party equivalents. Starting in 5.x, JDK8 is the default and the support for JDK7, JDK6 has been dropped|<dl><dt>**true**</dt><dd>Use Java 8 classes such as Base64. Use java8 default interface when a responseWrapper is used. IMPORTANT: This option has been deprecated as Java 8 is the default.</dd><dt>**false**</dt><dd>Various third party libraries as needed</dd></dl>|true|
|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>|true|
|library|library template (sub-template)|<dl><dt>**spring-boot**</dt><dd>Spring-boot Server application using the SpringFox integration.</dd><dt>**spring-mvc**</dt><dd>Spring-MVC Server application using the SpringFox integration.</dd><dt>**spring-cloud**</dt><dd>Spring-Cloud-Feign client with Spring-Boot auto-configured settings.</dd></dl>|spring-boot|
|licenseName|The name of the license| |Unlicense|
|licenseUrl|The URL of the license| |http://unlicense.org|
|modelPackage|package for generated models| |org.openapitools.model|
|oas3|Use OAS 3 Swagger annotations instead of OAS 2 annotations| |false|
|openApiNullable|Enable OpenAPI Jackson Nullable library| |true|
|parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|performBeanValidation|Use Bean Validation Impl. to perform BeanValidation| |false|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|reactive|wrap responses in Mono/Flux Reactor types (spring-boot only)| |false|
|responseWrapper|wrap the responses in given type (Future, Callable, CompletableFuture,ListenableFuture, DeferredResult, RxObservable, RxSingle or fully qualified type)| |null|
|returnSuccessCode|Generated server returns 2xx code| |false|
|scmConnection|SCM connection in generated pom.xml| |scm:git:git@github.com:openapitools/openapi-generator.git|
|scmDeveloperConnection|SCM developer connection in generated pom.xml| |scm:git:git@github.com:openapitools/openapi-generator.git|
|scmUrl|SCM URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
|serializableModel|boolean - toggle &quot;implements Serializable&quot; for generated models| |false|
|singleContentTypes|Whether to select only one produces/consumes content-type by operation.| |false|
|skipDefaultInterface|Whether to generate default implementations for java8 interfaces| |false|
|snapshotVersion|Uses a SNAPSHOT version.|<dl><dt>**true**</dt><dd>Use a SnapShot Version</dd><dt>**false**</dt><dd>Use a Release Version</dd></dl>|null|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|sourceFolder|source folder for generated code| |src/main/java|
|swaggerDocketConfig|Generate Spring OpenAPI Docket configuration class.| |false|
|title|server title name or client service name| |OpenAPI Spring|
|unhandledException|Declare operation methods to throw a generic exception and allow unhandled exceptions (useful for Spring `@ControllerAdvice` directives).| |false|
|useBeanValidation|Use BeanValidation API annotations| |true|
|useOptional|Use Optional container for optional parameters| |false|
|useSpringController|Annotate the generated API as a Spring Controller| |false|
|useTags|use tags for creating interface and controller classnames| |false|
|virtualService|Generates the virtual service. For more details refer - https://github.com/virtualansoftware/virtualan/wiki| |false|
|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|
## IMPORT MAPPING
| Type/Alias | Imports |
| ---------- | ------- |
|Array|java.util.List|
|ArrayList|java.util.ArrayList|
|BigDecimal|java.math.BigDecimal|
|Date|java.util.Date|
|DateTime|org.joda.time.*|
|File|java.io.File|
|HashMap|java.util.HashMap|
|LinkedHashSet|java.util.LinkedHashSet|
|List|java.util.*|
|LocalDate|org.joda.time.*|
|LocalDateTime|org.joda.time.*|
|LocalTime|org.joda.time.*|
|Map|java.util.Map|
|Set|java.util.*|
|Timestamp|java.sql.Timestamp|
|URI|java.net.URI|
|UUID|java.util.UUID|
## INSTANTIATION TYPES
| Type/Alias | Instantiated By |
| ---------- | --------------- |
|array|ArrayList|
|map|HashMap|
|set|LinkedHashSet|
## LANGUAGE PRIMITIVES
<ul class="column-ul">
<li>Boolean</li>
<li>Double</li>
<li>Float</li>
<li>Integer</li>
<li>Long</li>
<li>Object</li>
<li>String</li>
<li>boolean</li>
<li>byte[]</li>
</ul>
## RESERVED WORDS
<ul class="column-ul">
<li>abstract</li>
<li>apiclient</li>
<li>apiexception</li>
<li>apiresponse</li>
<li>assert</li>
<li>boolean</li>
<li>break</li>
<li>byte</li>
<li>case</li>
<li>catch</li>
<li>char</li>
<li>class</li>
<li>configuration</li>
<li>const</li>
<li>continue</li>
<li>default</li>
<li>do</li>
<li>double</li>
<li>else</li>
<li>enum</li>
<li>extends</li>
<li>final</li>
<li>finally</li>
<li>float</li>
<li>for</li>
<li>goto</li>
<li>if</li>
<li>implements</li>
<li>import</li>
<li>instanceof</li>
<li>int</li>
<li>interface</li>
<li>localreturntype</li>
<li>localvaraccept</li>
<li>localvaraccepts</li>
<li>localvarauthnames</li>
<li>localvarcollectionqueryparams</li>
<li>localvarcontenttype</li>
<li>localvarcontenttypes</li>
<li>localvarcookieparams</li>
<li>localvarformparams</li>
<li>localvarheaderparams</li>
<li>localvarpath</li>
<li>localvarpostbody</li>
<li>localvarqueryparams</li>
<li>long</li>
<li>native</li>
<li>new</li>
<li>null</li>
<li>object</li>
<li>package</li>
<li>private</li>
<li>protected</li>
<li>public</li>
<li>return</li>
<li>short</li>
<li>static</li>
<li>strictfp</li>
<li>stringutil</li>
<li>super</li>
<li>switch</li>
<li>synchronized</li>
<li>this</li>
<li>throw</li>
<li>throws</li>
<li>transient</li>
<li>try</li>
<li>void</li>
<li>volatile</li>
<li>while</li>
</ul>
## FEATURE SET
### Client Modification Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|BasePath|✓|ToolingExtension
|Authorizations|✗|ToolingExtension
|UserAgent|✗|ToolingExtension
|MockServer|✗|ToolingExtension
### Data Type Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Custom|✗|OAS2,OAS3
|Int32|✓|OAS2,OAS3
|Int64|✓|OAS2,OAS3
|Float|✓|OAS2,OAS3
|Double|✓|OAS2,OAS3
|Decimal|✓|ToolingExtension
|String|✓|OAS2,OAS3
|Byte|✓|OAS2,OAS3
|Binary|✓|OAS2,OAS3
|Boolean|✓|OAS2,OAS3
|Date|✓|OAS2,OAS3
|DateTime|✓|OAS2,OAS3
|Password|✓|OAS2,OAS3
|File|✓|OAS2
|Array|✓|OAS2,OAS3
|Maps|✓|ToolingExtension
|CollectionFormat|✓|OAS2
|CollectionFormatMulti|✓|OAS2
|Enum|✓|OAS2,OAS3
|ArrayOfEnum|✓|ToolingExtension
|ArrayOfModel|✓|ToolingExtension
|ArrayOfCollectionOfPrimitives|✓|ToolingExtension
|ArrayOfCollectionOfModel|✓|ToolingExtension
|ArrayOfCollectionOfEnum|✓|ToolingExtension
|MapOfEnum|✓|ToolingExtension
|MapOfModel|✓|ToolingExtension
|MapOfCollectionOfPrimitives|✓|ToolingExtension
|MapOfCollectionOfModel|✓|ToolingExtension
|MapOfCollectionOfEnum|✓|ToolingExtension
### Documentation Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Readme|✓|ToolingExtension
|Model|✓|ToolingExtension
|Api|✓|ToolingExtension
### Global Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Host|✓|OAS2,OAS3
|BasePath|✓|OAS2,OAS3
|Info|✓|OAS2,OAS3
|Schemes|✗|OAS2,OAS3
|PartialSchemes|✓|OAS2,OAS3
|Consumes|✓|OAS2
|Produces|✓|OAS2
|ExternalDocumentation|✓|OAS2,OAS3
|Examples|✓|OAS2,OAS3
|XMLStructureDefinitions|✓|OAS2,OAS3
|MultiServer|✗|OAS3
|ParameterizedServer|✗|OAS3
|ParameterStyling|✗|OAS3
|Callbacks|✗|OAS3
|LinkObjects|✗|OAS3
### Parameter Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Path|✓|OAS2,OAS3
|Query|✓|OAS2,OAS3
|Header|✓|OAS2,OAS3
|Body|✓|OAS2
|FormUnencoded|✓|OAS2
|FormMultipart|✓|OAS2
|Cookie|✗|OAS3
### Schema Support Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Simple|✓|OAS2,OAS3
|Composite|✓|OAS2,OAS3
|Polymorphism|✓|OAS2,OAS3
|Union|✗|OAS3
### Security Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|BasicAuth|✓|OAS2,OAS3
|ApiKey|✓|OAS2,OAS3
|OpenIDConnect|✗|OAS3
|BearerToken|✗|OAS3
|OAuth2_Implicit|✓|OAS2,OAS3
|OAuth2_Password|✓|OAS2,OAS3
|OAuth2_ClientCredentials|✓|OAS2,OAS3
|OAuth2_AuthorizationCode|✓|OAS2,OAS3
### Wire Format Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|JSON|✓|OAS2,OAS3
|XML|✓|OAS2,OAS3
|PROTOBUF|✗|ToolingExtension
|Custom|✓|OAS2,OAS3

View File

@@ -0,0 +1,198 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.openapitools</groupId>
<artifactId>sample-project</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>sample-project</name>
<url>https://maven.apache.org</url>
<build>
<plugins>
<!-- activate the plugin -->
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>5.3.1-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<executions>
<execution>
<id>camel-server</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<!-- specify the swagger yaml -->
<inputSpec>${project.basedir}/swagger.yaml</inputSpec>
<!-- target to generate java client code -->
<generatorName>camel</generatorName>
<!-- hint: if you want to generate java server code, e.g. based on Spring Boot,
you can use the following target: <generatorName>spring</generatorName> -->
<!-- pass any necessary config options -->
<configOptions>
<camelRestBindingMode>auto</camelRestBindingMode>
<useBeanValidation>true</useBeanValidation>
<performBeanValidation>true</performBeanValidation>
<camelDataformatProperties>json.out.disableFeatures=WRITE_DATES_AS_TIMESTAMPS</camelDataformatProperties>
<withXml>true</withXml>
<jackson>true</jackson>
<camelUseDefaulValidationtErrorProcessor>true</camelUseDefaulValidationtErrorProcessor>
<!--
Define bean validation error processor
<camelUseDefaulValidationtErrorProcessor>false</camelUseDefaulValidationtErrorProcessor>
<camelValidationErrorProcessor>errorProcessorBeanName</camelValidationErrorProcessor>
-->
<camelRestClientRequestValidation>true</camelRestClientRequestValidation>
<camelSecurityDefinitions>true</camelSecurityDefinitions>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<proc>none</proc>
</configuration>
</plugin>
</plugins>
<pluginManagement>
</pluginManagement>
</build>
<pluginRepositories>
<pluginRepository>
<id>sonatype-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</pluginRepository>
</pluginRepositories>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-bom</artifactId>
<version>3.13.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.apache.camel.springboot</groupId>
<artifactId>camel-spring-boot-bom</artifactId>
<version>3.13.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.6.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.camel.springboot</groupId>
<artifactId>camel-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel.springboot</groupId>
<artifactId>camel-servlet-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>jackson-databind-nullable</artifactId>
<version>0.2.1</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.6.3</version>
</dependency>
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations</artifactId>
<version>2.1.11</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>2.13.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jdk8</artifactId>
<version>2.13.0</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-jackson</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-jacksonxml</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-jaxb</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-direct</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-bean-validator</artifactId>
</dependency>
<!-- Test dependencies -->
<dependency>
<groupId>com.mashape.unirest</groupId>
<artifactId>unirest-java</artifactId>
<version>1.4.9</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-test-spring-junit5</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
<swagger-annotations-version>1.5.8</swagger-annotations-version>
<spring-boot-starter-web.version>2.2.1.RELEASE</spring-boot-starter-web.version>
<springfox-version>2.8.0</springfox-version>
</properties>
</project>

View File

@@ -0,0 +1,186 @@
package org.openapitools.codegen.languages;
import io.swagger.v3.oas.models.Operation;
import org.openapitools.codegen.CliOption;
import org.openapitools.codegen.CodegenOperation;
import org.openapitools.codegen.CodegenType;
import org.openapitools.codegen.SupportingFile;
import org.openapitools.codegen.languages.features.BeanValidationFeatures;
import org.openapitools.codegen.languages.features.OptionalFeatures;
import org.openapitools.codegen.languages.features.PerformBeanValidationFeatures;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class JavaCamelServerCodegen extends SpringCodegen implements BeanValidationFeatures, PerformBeanValidationFeatures, OptionalFeatures {
private static final String APPLICATION_JSON = "application/json";
private static final String APPLICATION_XML = "application/xml";
public static final String PROJECT_NAME = "projectName";
public static final String CAMEL_REST_COMPONENT = "camelRestComponent";
public static final String CAMEL_REST_BINDING_MODE = "camelRestBindingMode";
public static final String CAMEL_REST_CLIENT_REQUEST_VALIDATION = "camelRestClientRequestValidation";
public static final String CAMEL_USE_DEFAULT_VALIDATION_ERROR_PROCESSOR = "camelUseDefaulValidationtErrorProcessor";
public static final String CAMEL_VALIDATION_ERROR_PROCESSOR = "camelValidationErrorProcessor";
public static final String CAMEL_SECURITY_DEFINITIONS = "camelSecurityDefinitions";
public static final String CAMEL_DATAFORMAT_PROPERTIES = "camelDataformatProperties";
private String camelRestComponent = "servlet";
private String camelRestBindingMode = "auto";
private boolean camelRestClientRequestValidation = false;
private boolean camelUseDefaulValidationtErrorProcessor = true;
private String camelValidationErrorProcessor = "validationErrorProcessor";
private boolean camelSecurityDefinitions = true;
private String camelDataformatProperties = "";
private final Logger LOGGER = LoggerFactory.getLogger(JavaCamelServerCodegen.class);
public CodegenType getTag() {
return CodegenType.SERVER;
}
public String getName() {
return "java-camel";
}
public String getHelp() {
return "Generates a camel server.";
}
public JavaCamelServerCodegen() {
super();
templateDir = "java-camel-server";
addCliOptions();
artifactId = "openapi-camel";
super.library = "";
}
@Override
public void processOpts() {
if (!additionalProperties.containsKey(DATE_LIBRARY)) {
additionalProperties.put(DATE_LIBRARY, "legacy");
}
super.processOpts();
super.apiTemplateFiles.remove("apiController.mustache");
LOGGER.info("***** Java Apache Camel Server Generator *****");
supportingFiles.clear();
manageAdditionalProperties();
Map<String, String> dataFormatProperties = new HashMap<>();
if (!"off".equals(camelRestBindingMode)) {
Arrays.stream(camelDataformatProperties.split(",")).forEach(property -> {
String[] dataFormatProperty = property.split("=");
if (dataFormatProperty.length == 2) {
dataFormatProperties.put(dataFormatProperty[0].trim(), dataFormatProperty[1].trim());
}
});
}
additionalProperties.put(CAMEL_DATAFORMAT_PROPERTIES, dataFormatProperties.entrySet());
supportingFiles.add(new SupportingFile("restConfiguration.mustache",
(sourceFolder + File.separator + basePackage).replace(".", java.io.File.separator),
"RestConfiguration.java"));
if (performBeanValidation) {
apiTemplateFiles.put("validation.mustache", "Validator.java");
if (camelUseDefaulValidationtErrorProcessor) {
supportingFiles.add(new SupportingFile("errorProcessor.mustache",
(sourceFolder + File.separator + basePackage).replace(".", java.io.File.separator),
"ValidationErrorProcessor.java"));
}
}
if (SPRING_BOOT.equals(library)) {
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
supportingFiles.add(new SupportingFile("openapi2SpringBoot.mustache",
(sourceFolder + File.separator + basePackage).replace(".", java.io.File.separator),
"OpenAPI2SpringBoot.java"));
if (!interfaceOnly) {
apiTemplateFiles.put("routesImpl.mustache", "RoutesImpl.java");
}
supportingFiles.add(new SupportingFile("application.mustache",
("src.main.resources").replace(".", java.io.File.separator), "application.properties"));
supportingFiles.add(new SupportingFile("pom.mustache", "", "pom.xml"));
supportingFiles.add(new SupportingFile("RFC3339DateFormat.mustache",
(sourceFolder + File.separator + basePackage).replace(".", java.io.File.separator),
"RFC3339DateFormat.java"));
apiTestTemplateFiles.put("test.mustache", ".java");
}
}
@Override
public void addOperationToGroup(String tag, String resourcePath, Operation operation, CodegenOperation co, Map<String, List<CodegenOperation>> operations) {
boolean bindingModeOff = false;
if (co.hasProduces) {
for (Map<String, String> produces : co.produces) {
String mediaType = produces.get("mediaType");
if (!APPLICATION_JSON.equals(mediaType) && !APPLICATION_XML.equals(mediaType)) {
bindingModeOff = true;
}
if (APPLICATION_JSON.equals(mediaType)) {
produces.put("isJson", "true");
}
if (APPLICATION_XML.equals(mediaType)) {
produces.put("isXml", "true");
}
}
}
if (co.hasConsumes) {
for (Map<String, String> consumes : co.consumes) {
String mediaType = consumes.get("mediaType");
if (!APPLICATION_JSON.equals(mediaType) && !APPLICATION_XML.equals(mediaType)) {
bindingModeOff = true;
}
if (APPLICATION_JSON.equals(mediaType)) {
consumes.put("isJson", "true");
}
if (APPLICATION_XML.equals(mediaType)) {
consumes.put("isXml", "true");
}
}
}
co.vendorExtensions.put(CAMEL_REST_BINDING_MODE, bindingModeOff);
super.addOperationToGroup(tag, resourcePath, operation, co, operations);
}
private void addCliOptions() {
cliOptions.add(new CliOption(CAMEL_REST_COMPONENT, "name of the Camel component to use as the REST consumer").defaultValue(camelRestComponent));
cliOptions.add(new CliOption(CAMEL_REST_BINDING_MODE, "binding mode to be used by the REST consumer").defaultValue(camelRestBindingMode));
cliOptions.add(CliOption.newBoolean(CAMEL_REST_CLIENT_REQUEST_VALIDATION, "enable validation of the client request to check whether the Content-Type and Accept headers from the client is supported by the Rest-DSL configuration", camelRestClientRequestValidation));
cliOptions.add(CliOption.newBoolean(CAMEL_USE_DEFAULT_VALIDATION_ERROR_PROCESSOR, "generate default validation error processor", camelUseDefaulValidationtErrorProcessor));
cliOptions.add(new CliOption(CAMEL_VALIDATION_ERROR_PROCESSOR, "validation error processor bean name").defaultValue(camelValidationErrorProcessor));
cliOptions.add(CliOption.newBoolean(CAMEL_SECURITY_DEFINITIONS, "generate camel security definitions", camelSecurityDefinitions));
cliOptions.add(new CliOption(CAMEL_DATAFORMAT_PROPERTIES, "list of dataformat properties separated by comma (propertyName1=propertyValue2,...").defaultValue(camelDataformatProperties));
}
private void manageAdditionalProperties() {
camelRestComponent = manageAdditionalProperty(CAMEL_REST_COMPONENT, camelRestComponent);
camelRestBindingMode = manageAdditionalProperty(CAMEL_REST_BINDING_MODE, camelRestBindingMode);
camelRestClientRequestValidation = manageAdditionalProperty(CAMEL_REST_CLIENT_REQUEST_VALIDATION, camelRestClientRequestValidation);
camelUseDefaulValidationtErrorProcessor = manageAdditionalProperty(CAMEL_USE_DEFAULT_VALIDATION_ERROR_PROCESSOR, camelUseDefaulValidationtErrorProcessor);
camelValidationErrorProcessor = manageAdditionalProperty(CAMEL_VALIDATION_ERROR_PROCESSOR, camelValidationErrorProcessor);
camelSecurityDefinitions = manageAdditionalProperty(CAMEL_SECURITY_DEFINITIONS, camelSecurityDefinitions);
camelDataformatProperties = manageAdditionalProperty(CAMEL_DATAFORMAT_PROPERTIES, camelDataformatProperties);
}
private <T> T manageAdditionalProperty(String propertyName, T defaultValue) {
if (additionalProperties.containsKey(propertyName)) {
Object propertyValue = additionalProperties.get(propertyName);
if (defaultValue instanceof Boolean && !(propertyValue instanceof Boolean)) {
return (T) manageBooleanAdditionalProperty((String) propertyValue);
}
return (T) additionalProperties.get(propertyName);
}
additionalProperties.put(propertyName, defaultValue);
return defaultValue;
}
private Boolean manageBooleanAdditionalProperty(String propertyValue) {
return Boolean.parseBoolean(propertyValue);
}
}

View File

@@ -141,3 +141,5 @@ org.openapitools.codegen.languages.TypeScriptNodeClientCodegen
org.openapitools.codegen.languages.TypeScriptReduxQueryClientCodegen
org.openapitools.codegen.languages.TypeScriptRxjsClientCodegen
org.openapitools.codegen.languages.WsdlSchemaCodegen
org.openapitools.codegen.languages.JavaCamelServerCodegen

View File

@@ -0,0 +1,7 @@
# OpenAPI generated server
Apache Camel Server
```bash
mvn clean test
```

View File

@@ -0,0 +1,95 @@
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) ({{{generatorVersion}}}).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package {{apiPackage}};
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.model.rest.RestParamType;
import org.springframework.stereotype.Component;
import {{modelPackage}}.*;
import org.apache.camel.model.rest.RestBindingMode;
import org.apache.camel.LoggingLevel;
@Component
public class {{classname}} extends RouteBuilder {
@Override
public void configure() throws Exception {
{{#performBeanValidation}}
onException(Exception.class)
.log(LoggingLevel.ERROR, "${exception.message}: ${exception.stacktrace}")
.handled(true)
.process("{{camelValidationErrorProcessor}}");
{{/performBeanValidation}}
{{#operations}}{{#operation}}
/**
{{httpMethod}} {{{path}}}{{#summary}} : {{.}}{{/summary}}
**/
rest(){{#camelSecurityDefinitions}}{{#hasAuthMethods}}
.securityDefinitions(){{#authMethods}}{{#isOAuth}}
.oauth2("{{name}}"){{#flow}}
.flow("{{flow}}"){{/flow}}{{#tokenUrl}}
.tokenUrl("{{tokenUrl}}"){{/tokenUrl}}{{#authorizationUrl}}
.authorizationUrl("{{authorizationUrl}}"){{/authorizationUrl}}{{#refreshUrl}}
.refreshUrl("{{refreshUrl}}"){{/refreshUrl}}{{#scopes}}
.withScope("{{scope}}"{{#description}},"{{{.}}}"{{/description}}){{/scopes}}
{{^-last}}.end(){{/-last}}{{#-last}}
.endSecurityDefinition(){{/-last}}{{/isOAuth}}{{#isApiKey}}
.apiKey("{{name}}"){{#isKeyInHeader}}
.withHeader("{{name}}"){{/isKeyInHeader}}{{#isKeyInQuery}}
.withQuery("{{name}}").{{/isKeyInQuery}}{{#isKeyInCookie}}
.withCookie("{{name}}").{{/isKeyInCookie}}
{{^-last}}.end(){{/-last}}{{#-last}}
.endSecurityDefinition(){{/-last}}{{/isApiKey}}{{#isBasic}}{{#isBasicBasic}}
.basicAuth("{{name}}"){{#-last}}.end(){{/-last}}{{/isBasicBasic}}{{#isBasicBearer}}
.bearerToken("{{name}}"{{#bearerFormat}}, "{{bearerFormat}}"{{/bearerFormat}}){{#-last}}.end(){{/-last}}{{/isBasicBearer}}{{/isBasic}}{{/authMethods}}{{/hasAuthMethods}}{{/camelSecurityDefinitions}}
.{{#lambda.lowercase}}{{httpMethod}}{{/lambda.lowercase}}("{{path}}")
.description("{{#summary}}{{{.}}}{{/summary}}")
.id("{{operationId}}Api"){{#vendorExtensions}}{{#camelRestBindingMode}}
.clientRequestValidation(false)
.bindingMode(RestBindingMode.off){{/camelRestBindingMode}}{{/vendorExtensions}}{{#hasProduces}}
.produces("{{#produces}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/produces}}"){{^isArray}}{{^isMap}}{{^isPrimitiveType}}
.outType({{returnType}}.class){{/isPrimitiveType}}{{/isMap}}{{/isArray}}{{#isArray}}
.outType({{returnBaseType}}[].class){{/isArray}}{{/hasProduces}}{{#hasConsumes}}
.consumes("{{#consumes}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/consumes}}"){{#bodyParams}}{{^isArray}}{{^isMap}}{{^isPrimitiveType}}
.type({{baseType}}.class){{/isPrimitiveType}}{{/isMap}}{{/isArray}}{{#isArray}}
.type({{baseType}}[].class){{/isArray}}{{/bodyParams}}
{{/hasConsumes}}{{#pathParams}}
.param()
.name("{{paramName}}")
.type(RestParamType.path)
.required({{required}}){{#description}}
.description("{{{.}}}"){{/description}}
.endParam(){{/pathParams}}{{#queryParams}}
.param()
.name("{{paramName}}")
.type(RestParamType.query)
.required({{required}}){{#description}}
.description("{{{.}}}"){{/description}}
.endParam(){{/queryParams}}{{#headerParams}}
.param()
.name("{{paramName}}")
.type(RestParamType.header)
.required({{required}}){{#description}}
.description("{{{.}}}"){{/description}}
.endParam(){{/headerParams}}{{#bodyParams}}
.param()
.name("{{paramName}}")
.type(RestParamType.body)
.required({{required}}){{#description}}
.description("{{{.}}}"){{/description}}
.endParam(){{/bodyParams}}{{#formParams}}
.param()
.name("{{paramName}}")
.type(RestParamType.formData)
.required({{required}}){{#description}}
.description("{{{.}}}"){{/description}}
.endParam(){{/formParams}}{{#performBeanValidation}}
.to("direct:validate-{{operationId}}");{{/performBeanValidation}}{{^performBeanValidation}}
.to("direct:{{operationId}}");{{/performBeanValidation}}
{{/operation}}{{/operations}}
}
}

View File

@@ -0,0 +1,8 @@
# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) ({{{generatorVersion}}}).
# https://openapi-generator.tech
# Do not edit the class manually.
camel.springboot.name=camel-{{artifactId}}
camel.servlet.mapping.context-path=/api/v1/*
server.port=8080

View File

@@ -0,0 +1,33 @@
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) ({{{generatorVersion}}}).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package {{basePackage}};
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.component.bean.validator.BeanValidationException;
import org.springframework.stereotype.Component;
{{#jackson}}
import com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException;{{/jackson}}
@Component("{{camelValidationErrorProcessor}}")
public class ValidationErrorProcessor implements Processor {
@Override
public void process(Exchange exchange) throws Exception {
Exception fault = exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Exception.class);
int httpStatusCode = 500;
if (fault instanceof BeanValidationException) {
httpStatusCode = 400;
}
{{#jackson}}
if (fault instanceof UnrecognizedPropertyException) {
httpStatusCode = 400;
}
{{/jackson}}
exchange.getIn().setHeader(Exchange.HTTP_RESPONSE_CODE, httpStatusCode);
exchange.getIn().setBody(fault.getMessage());
}
}

View File

@@ -0,0 +1 @@
{{#lambdaSplitString}}{{#lambdaRemoveLineBreak}}{{#lambdaEscapeDoubleQuote}}{{#lambdaTrimWhitespace}}{{{example}}}{{/lambdaTrimWhitespace}}{{/lambdaEscapeDoubleQuote}}{{/lambdaRemoveLineBreak}}{{/lambdaSplitString}}

View File

@@ -0,0 +1 @@
{{#lambdaSplitString}}{{#lambdaRemoveLineBreak}}{{#lambdaEscapeDoubleQuote}}{{#lambdaTrimWhitespace}}[{{{example}}}]{{/lambdaTrimWhitespace}}{{/lambdaEscapeDoubleQuote}}{{/lambdaRemoveLineBreak}}{{/lambdaSplitString}}

View File

@@ -0,0 +1,193 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--
NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) ({{{generatorVersion}}}).
https://openapi-generator.tech
Do not edit the class manually.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>{{groupId}}</groupId>
<artifactId>{{artifactId}}</artifactId>
<packaging>jar</packaging>
<name>{{artifactId}}</name>
<version>{{artifactVersion}}</version>
<scm>
<connection>{{scmConnection}}</connection>
<developerConnection>{{scmDeveloperConnection}}</developerConnection>
<url>{{scmUrl}}</url>
</scm>
<licenses>
<license>
<name>{{licenseName}}</name>
<url>{{licenseUrl}}</url>
<distribution>repo</distribution>
</license>
</licenses>
<developers>
<developer>
<name>{{developerName}}</name>
<email>{{developerEmail}}</email>
<organization>{{developerOrganization}}</organization>
<organizationUrl>{{developerOrganizationUrl}}</organizationUrl>
</developer>
</developers>
<properties>
<org.springframework.boot.version>2.6.2</org.springframework.boot.version>
<org.apache.camel.version>3.14.0</org.apache.camel.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-bom</artifactId>
<version>${org.apache.camel.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.apache.camel.springboot</groupId>
<artifactId>camel-spring-boot-bom</artifactId>
<version>${org.apache.camel.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${org.springframework.boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.camel.springboot</groupId>
<artifactId>camel-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel.springboot</groupId>
<artifactId>camel-servlet-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>jackson-databind-nullable</artifactId>
<version>0.2.1</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.6.3</version>
</dependency>
{{#oas3}}
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations</artifactId>
<version>2.1.11</version>
</dependency>
{{/oas3}}
{{#jackson}}
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>2.13.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jdk8</artifactId>
<version>2.13.0</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-jackson</artifactId>
</dependency>
{{#withXml}}
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-jacksonxml</artifactId>
</dependency>
{{/withXml}}{{/jackson}}
{{#withXml}}
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-jaxb</artifactId>
</dependency>
{{/withXml}}
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-direct</artifactId>
</dependency>
{{#useBeanValidation}}
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-bean-validator</artifactId>
</dependency>
{{/useBeanValidation}}
<!-- Test dependencies -->
<dependency>
<groupId>com.mashape.unirest</groupId>
<artifactId>unirest-java</artifactId>
<version>1.4.9</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-test-spring-junit5</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,22 @@
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) ({{{generatorVersion}}}).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package {{apiPackage}};
import org.apache.camel.builder.RouteBuilder;
import org.springframework.stereotype.Component;
import org.apache.camel.model.rest.RestBindingMode;
@Component
public class RestConfiguration extends RouteBuilder {
@Override
public void configure() throws Exception {
restConfiguration()
.component("{{camelRestComponent}}")
.bindingMode(RestBindingMode.{{camelRestBindingMode}}){{#camelDataformatProperties}}
.dataFormatProperty("{{key}}", "{{value}}"){{/camelDataformatProperties}}
.clientRequestValidation({{camelRestClientRequestValidation}});
}
}

View File

@@ -0,0 +1,34 @@
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) ({{{generatorVersion}}}).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package {{apiPackage}};
import org.apache.camel.builder.RouteBuilder;
import org.springframework.stereotype.Component;
import org.apache.camel.LoggingLevel;
import {{modelPackage}}.*;
import org.apache.camel.model.dataformat.JsonLibrary;
@Component
public class {{classname}}RoutesImpl extends RouteBuilder {
@Override
public void configure() throws Exception {
{{#operations}}{{#operation}}
/**
{{httpMethod}} {{{path}}}{{#summary}} : {{.}}{{/summary}}
**/
from("direct:{{operationId}}")
.id("{{operationId}}")
.choice()
.when(simple("${body} != null"))
.log(LoggingLevel.INFO, "BODY TYPE: ${body.getClass().getName()}")
.end()
.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}}))
.unmarshal().json(JsonLibrary.Jackson, {{returnBaseType}}[].class){{/isArray}}{{/-first}}{{/examples}}{{/hasProduces}};{{/operation}}{{/operations}}
}
}

View File

@@ -0,0 +1,63 @@
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) ({{{generatorVersion}}}).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package {{apiPackage}};
import org.junit.jupiter.api.Test;
import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
import org.springframework.boot.test.context.SpringBootTest;
import com.mashape.unirest.request.HttpRequest;
import com.mashape.unirest.request.HttpRequestWithBody;
import com.mashape.unirest.http.Unirest;
import com.mashape.unirest.http.JsonNode;
import com.mashape.unirest.http.HttpResponse;
import java.io.InputStream;
import org.junit.jupiter.api.Assertions;
@CamelSpringBootTest
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
public class {{classname}}Test {
private static final String API_URL = "http://127.0.0.1:8080/api/v1";
{{#operations}}{{#operation}}{{#examples}}{{#-first}}{{#vendorExtensions}}{{^camelRestBindingMode}}
@Test
public void {{operationId}}TestJson() throws Exception {
String contentType = "application/json";
String accept = "application/json";
String url = API_URL + "{{path}}";
HttpRequest httpRequest = Unirest.{{#lambda.lowercase}}{{httpMethod}}{{/lambda.lowercase}}(url);{{#hasConsumes}}
httpRequest = httpRequest.header("Content-Type", contentType);{{/hasConsumes}}{{#hasProduces}}
httpRequest = httpRequest.header("Accept", accept);{{/hasProduces}}{{#pathParams}}
httpRequest = httpRequest.routeParam("{{paramName}}", "1");{{/pathParams}}{{#queryParams}}
httpRequest = httpRequest.queryString("{{paramName}}", "1");{{/queryParams}}
{{#hasConsumes}}{{#examples}}{{#-first}}
String requestBody = {{>exampleString}};
httpRequest = ((HttpRequestWithBody) httpRequest).body(requestBody).getHttpRequest();
{{/-first}}{{/examples}}{{/hasConsumes}}
{{#hasProduces}}{{#produces}}{{#isJson}}
HttpResponse<JsonNode> httpResponse = httpRequest.asJson();{{/isJson}}{{/produces}}{{/hasProduces}}{{^hasProduces}}
HttpResponse<InputStream> httpResponse = httpRequest.asBinary();{{/hasProduces}}
Assertions.assertTrue(httpResponse.getStatus() < 400 || httpResponse.getStatus() == 415);
}
{{#examples}}{{#-last}}{{^isArray}}
@Test
public void {{operationId}}TestXml() throws Exception {
String contentType = "application/xml";
String accept = "application/xml";
String url = API_URL + "{{path}}";
HttpRequest httpRequest = Unirest.{{#lambda.lowercase}}{{httpMethod}}{{/lambda.lowercase}}(url);{{#hasConsumes}}
httpRequest = httpRequest.header("Content-Type", contentType);{{/hasConsumes}}{{#hasProduces}}
httpRequest = httpRequest.header("Accept", accept);{{/hasProduces}}{{#pathParams}}
httpRequest = httpRequest.routeParam("{{paramName}}", "1");{{/pathParams}}{{#queryParams}}
httpRequest = httpRequest.queryString("{{paramName}}", "1");{{/queryParams}}
{{#hasConsumes}}{{#examples}}{{^-first}}
String requestBody = {{>exampleString}};
httpRequest = ((HttpRequestWithBody) httpRequest).body(requestBody).getHttpRequest();
{{/-first}}{{/examples}}{{/hasConsumes}}
{{#hasProduces}}{{#produces}}{{#isXml}}
HttpResponse<String> httpResponse = httpRequest.asString();{{/isXml}}{{/produces}}{{/hasProduces}}{{^hasProduces}}
HttpResponse<InputStream> httpResponse = httpRequest.asBinary();{{/hasProduces}}
Assertions.assertTrue(httpResponse.getStatus() < 400 || httpResponse.getStatus() == 415);
}{{/isArray}}{{/-last}}{{/examples}}{{/camelRestBindingMode}}{{/vendorExtensions}}{{/-first}}{{/examples}}{{/operation}}{{/operations}}
}

View File

@@ -0,0 +1,28 @@
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) ({{{generatorVersion}}}).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package {{apiPackage}};
import org.apache.camel.builder.RouteBuilder;
import org.springframework.stereotype.Component;
import org.apache.camel.LoggingLevel;
@Component
public class {{classname}}Validator extends RouteBuilder {
@Override
public void configure() throws Exception {
onException(Exception.class)
.log(LoggingLevel.ERROR, "${exception.message}: ${exception.stacktrace}")
.handled(true)
.process("{{camelValidationErrorProcessor}}");
{{#operations}}{{#operation}}
from("direct:validate-{{operationId}}")
.id("validate-{{operationId}}"){{#hasConsumes}}
.to("bean-validator://validate-request"){{/hasConsumes}}
.to("direct:{{operationId}}"){{^hasProduces}};{{/hasProduces}}{{#hasProduces}}
.to("bean-validator://validate-response");{{/hasProduces}}
{{/operation}}{{/operations}}
}
}

View File

@@ -0,0 +1,23 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.
# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md

View File

@@ -0,0 +1,22 @@
README.md
pom.xml
src/main/java/org/openapitools/OpenAPI2SpringBoot.java
src/main/java/org/openapitools/RFC3339DateFormat.java
src/main/java/org/openapitools/RestConfiguration.java
src/main/java/org/openapitools/ValidationErrorProcessor.java
src/main/java/org/openapitools/api/PetApi.java
src/main/java/org/openapitools/api/PetApiRoutesImpl.java
src/main/java/org/openapitools/api/PetApiValidator.java
src/main/java/org/openapitools/api/StoreApi.java
src/main/java/org/openapitools/api/StoreApiRoutesImpl.java
src/main/java/org/openapitools/api/StoreApiValidator.java
src/main/java/org/openapitools/api/UserApi.java
src/main/java/org/openapitools/api/UserApiRoutesImpl.java
src/main/java/org/openapitools/api/UserApiValidator.java
src/main/java/org/openapitools/model/Category.java
src/main/java/org/openapitools/model/ModelApiResponse.java
src/main/java/org/openapitools/model/Order.java
src/main/java/org/openapitools/model/Pet.java
src/main/java/org/openapitools/model/Tag.java
src/main/java/org/openapitools/model/User.java
src/main/resources/application.properties

View File

@@ -0,0 +1 @@
5.4.0-SNAPSHOT

View File

@@ -0,0 +1,7 @@
# OpenAPI generated server
Apache Camel Server
```bash
mvn clean test
```

View File

@@ -0,0 +1,185 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--
NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (5.4.0-SNAPSHOT).
https://openapi-generator.tech
Do not edit the class manually.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.openapitools</groupId>
<artifactId>openapi-camel</artifactId>
<packaging>jar</packaging>
<name>openapi-camel</name>
<version>1.0.0</version>
<scm>
<connection>scm:git:git@github.com:openapitools/openapi-generator.git</connection>
<developerConnection>scm:git:git@github.com:openapitools/openapi-generator.git</developerConnection>
<url>https://github.com/openapitools/openapi-generator</url>
</scm>
<licenses>
<license>
<name>Unlicense</name>
<url>https://www.apache.org/licenses/LICENSE-2.0.html</url>
<distribution>repo</distribution>
</license>
</licenses>
<developers>
<developer>
<name>OpenAPI-Generator Contributors</name>
<email>team@openapitools.org</email>
<organization>OpenAPITools.org</organization>
<organizationUrl>http://openapitools.org</organizationUrl>
</developer>
</developers>
<properties>
<org.springframework.boot.version>2.6.2</org.springframework.boot.version>
<org.apache.camel.version>3.14.0</org.apache.camel.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-bom</artifactId>
<version>${org.apache.camel.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.apache.camel.springboot</groupId>
<artifactId>camel-spring-boot-bom</artifactId>
<version>${org.apache.camel.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${org.springframework.boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.camel.springboot</groupId>
<artifactId>camel-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel.springboot</groupId>
<artifactId>camel-servlet-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>jackson-databind-nullable</artifactId>
<version>0.2.1</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.6.3</version>
</dependency>
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations</artifactId>
<version>2.1.11</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>2.13.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jdk8</artifactId>
<version>2.13.0</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-jackson</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-jacksonxml</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-jaxb</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-direct</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-bean-validator</artifactId>
</dependency>
<!-- Test dependencies -->
<dependency>
<groupId>com.mashape.unirest</groupId>
<artifactId>unirest-java</artifactId>
<version>1.4.9</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-test-spring-junit5</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,64 @@
package org.openapitools;
import com.fasterxml.jackson.databind.Module;
import org.openapitools.jackson.nullable.JsonNullableModule;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.ExitCodeGenerator;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
@SpringBootApplication
@ComponentScan(basePackages = {"org.openapitools", "org.openapitools.api" , "org.openapitools.configuration"})
public class OpenAPI2SpringBoot implements CommandLineRunner {
@Override
public void run(String... arg0) throws Exception {
if (arg0.length > 0 && arg0[0].equals("exitcode")) {
throw new ExitException();
}
}
public static void main(String[] args) throws Exception {
new SpringApplication(OpenAPI2SpringBoot.class).run(args);
}
static class ExitException extends RuntimeException implements ExitCodeGenerator {
private static final long serialVersionUID = 1L;
@Override
public int getExitCode() {
return 10;
}
}
@Bean
public WebMvcConfigurer webConfigurer() {
return new WebMvcConfigurerAdapter() {
/*@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOrigins("*")
.allowedMethods("*")
.allowedHeaders("Content-Type");
}*/
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/swagger-ui/**").addResourceLocations("classpath:/META-INF/resources/webjars/swagger-ui/3.14.2/");
}
};
}
@Bean
public Module jsonNullableModule() {
return new JsonNullableModule();
}
}

View File

@@ -0,0 +1,38 @@
package org.openapitools;
import com.fasterxml.jackson.databind.util.StdDateFormat;
import java.text.DateFormat;
import java.text.FieldPosition;
import java.text.ParsePosition;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.TimeZone;
public class RFC3339DateFormat extends DateFormat {
private static final long serialVersionUID = 1L;
private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC");
private final StdDateFormat fmt = new StdDateFormat()
.withTimeZone(TIMEZONE_Z)
.withColonInTimeZone(true);
public RFC3339DateFormat() {
this.calendar = new GregorianCalendar();
}
@Override
public Date parse(String source, ParsePosition pos) {
return fmt.parse(source, pos);
}
@Override
public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) {
return fmt.format(date, toAppendTo, fieldPosition);
}
@Override
public Object clone() {
return this;
}
}

View File

@@ -0,0 +1,22 @@
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (5.4.0-SNAPSHOT).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.api;
import org.apache.camel.builder.RouteBuilder;
import org.springframework.stereotype.Component;
import org.apache.camel.model.rest.RestBindingMode;
@Component
public class RestConfiguration extends RouteBuilder {
@Override
public void configure() throws Exception {
restConfiguration()
.component("servlet")
.bindingMode(RestBindingMode.auto)
.dataFormatProperty("json.out.disableFeatures", "WRITE_DATES_AS_TIMESTAMPS")
.clientRequestValidation(true);
}
}

View File

@@ -0,0 +1,30 @@
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (5.4.0-SNAPSHOT).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.component.bean.validator.BeanValidationException;
import org.springframework.stereotype.Component;
import com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException;
@Component("validationErrorProcessor")
public class ValidationErrorProcessor implements Processor {
@Override
public void process(Exchange exchange) throws Exception {
Exception fault = exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Exception.class);
int httpStatusCode = 500;
if (fault instanceof BeanValidationException) {
httpStatusCode = 400;
}
if (fault instanceof UnrecognizedPropertyException) {
httpStatusCode = 400;
}
exchange.getIn().setHeader(Exchange.HTTP_RESPONSE_CODE, httpStatusCode);
exchange.getIn().setBody(fault.getMessage());
}
}

View File

@@ -0,0 +1,268 @@
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (5.4.0-SNAPSHOT).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.api;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.model.rest.RestParamType;
import org.springframework.stereotype.Component;
import org.openapitools.model.*;
import org.apache.camel.model.rest.RestBindingMode;
import org.apache.camel.LoggingLevel;
@Component
public class PetApi extends RouteBuilder {
@Override
public void configure() throws Exception {
onException(Exception.class)
.log(LoggingLevel.ERROR, "${exception.message}: ${exception.stacktrace}")
.handled(true)
.process("validationErrorProcessor");
/**
POST /pet : Add a new pet to the store
**/
rest()
.securityDefinitions()
.oauth2("petstore_auth")
.flow("implicit")
.authorizationUrl("http://petstore.swagger.io/api/oauth/dialog")
.withScope("write:pets","modify pets in your account")
.withScope("read:pets","read your pets")
.endSecurityDefinition()
.post("/pet")
.description("Add a new pet to the store")
.id("addPetApi")
.produces("application/xml, application/json")
.outType(Pet.class)
.consumes("application/json, application/xml")
.type(Pet.class)
.param()
.name("pet")
.type(RestParamType.body)
.required(true)
.description("Pet object that needs to be added to the store")
.endParam()
.to("direct:validate-addPet");
/**
DELETE /pet/{petId} : Deletes a pet
**/
rest()
.securityDefinitions()
.oauth2("petstore_auth")
.flow("implicit")
.authorizationUrl("http://petstore.swagger.io/api/oauth/dialog")
.withScope("write:pets","modify pets in your account")
.withScope("read:pets","read your pets")
.endSecurityDefinition()
.delete("/pet/{petId}")
.description("Deletes a pet")
.id("deletePetApi")
.param()
.name("petId")
.type(RestParamType.path)
.required(true)
.description("Pet id to delete")
.endParam()
.param()
.name("apiKey")
.type(RestParamType.header)
.required(false)
.endParam()
.to("direct:validate-deletePet");
/**
GET /pet/findByStatus : Finds Pets by status
**/
rest()
.securityDefinitions()
.oauth2("petstore_auth")
.flow("implicit")
.authorizationUrl("http://petstore.swagger.io/api/oauth/dialog")
.withScope("read:pets","read your pets")
.endSecurityDefinition()
.get("/pet/findByStatus")
.description("Finds Pets by status")
.id("findPetsByStatusApi")
.produces("application/xml, application/json")
.outType(Pet[].class)
.param()
.name("status")
.type(RestParamType.query)
.required(true)
.description("Status values that need to be considered for filter")
.endParam()
.to("direct:validate-findPetsByStatus");
/**
GET /pet/findByTags : Finds Pets by tags
**/
rest()
.securityDefinitions()
.oauth2("petstore_auth")
.flow("implicit")
.authorizationUrl("http://petstore.swagger.io/api/oauth/dialog")
.withScope("read:pets","read your pets")
.endSecurityDefinition()
.get("/pet/findByTags")
.description("Finds Pets by tags")
.id("findPetsByTagsApi")
.produces("application/xml, application/json")
.outType(Pet[].class)
.param()
.name("tags")
.type(RestParamType.query)
.required(true)
.description("Tags to filter by")
.endParam()
.to("direct:validate-findPetsByTags");
/**
GET /pet/{petId} : Find pet by ID
**/
rest()
.securityDefinitions()
.apiKey("api_key")
.withHeader("api_key")
.endSecurityDefinition()
.get("/pet/{petId}")
.description("Find pet by ID")
.id("getPetByIdApi")
.produces("application/xml, application/json")
.outType(Pet.class)
.param()
.name("petId")
.type(RestParamType.path)
.required(true)
.description("ID of pet to return")
.endParam()
.to("direct:validate-getPetById");
/**
PUT /pet : Update an existing pet
**/
rest()
.securityDefinitions()
.oauth2("petstore_auth")
.flow("implicit")
.authorizationUrl("http://petstore.swagger.io/api/oauth/dialog")
.withScope("write:pets","modify pets in your account")
.withScope("read:pets","read your pets")
.endSecurityDefinition()
.put("/pet")
.description("Update an existing pet")
.id("updatePetApi")
.produces("application/xml, application/json")
.outType(Pet.class)
.consumes("application/json, application/xml")
.type(Pet.class)
.param()
.name("pet")
.type(RestParamType.body)
.required(true)
.description("Pet object that needs to be added to the store")
.endParam()
.to("direct:validate-updatePet");
/**
POST /pet/{petId} : Updates a pet in the store with form data
**/
rest()
.securityDefinitions()
.oauth2("petstore_auth")
.flow("implicit")
.authorizationUrl("http://petstore.swagger.io/api/oauth/dialog")
.withScope("write:pets","modify pets in your account")
.withScope("read:pets","read your pets")
.endSecurityDefinition()
.post("/pet/{petId}")
.description("Updates a pet in the store with form data")
.id("updatePetWithFormApi")
.clientRequestValidation(false)
.bindingMode(RestBindingMode.off)
.consumes("application/x-www-form-urlencoded")
.param()
.name("petId")
.type(RestParamType.path)
.required(true)
.description("ID of pet that needs to be updated")
.endParam()
.param()
.name("name")
.type(RestParamType.formData)
.required(false)
.description("Updated name of the pet")
.endParam()
.param()
.name("status")
.type(RestParamType.formData)
.required(false)
.description("Updated status of the pet")
.endParam()
.to("direct:validate-updatePetWithForm");
/**
POST /pet/{petId}/uploadImage : uploads an image
**/
rest()
.securityDefinitions()
.oauth2("petstore_auth")
.flow("implicit")
.authorizationUrl("http://petstore.swagger.io/api/oauth/dialog")
.withScope("write:pets","modify pets in your account")
.withScope("read:pets","read your pets")
.endSecurityDefinition()
.post("/pet/{petId}/uploadImage")
.description("uploads an image")
.id("uploadFileApi")
.clientRequestValidation(false)
.bindingMode(RestBindingMode.off)
.produces("application/json")
.outType(ModelApiResponse.class)
.consumes("multipart/form-data")
.param()
.name("petId")
.type(RestParamType.path)
.required(true)
.description("ID of pet to update")
.endParam()
.param()
.name("additionalMetadata")
.type(RestParamType.formData)
.required(false)
.description("Additional data to pass to server")
.endParam()
.param()
.name("file")
.type(RestParamType.formData)
.required(false)
.description("file to upload")
.endParam()
.to("direct:validate-uploadFile");
}
}

View File

@@ -0,0 +1,112 @@
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (5.4.0-SNAPSHOT).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.api;
import org.apache.camel.builder.RouteBuilder;
import org.springframework.stereotype.Component;
import org.apache.camel.LoggingLevel;
import org.openapitools.model.*;
import org.apache.camel.model.dataformat.JsonLibrary;
@Component
public class PetApiRoutesImpl extends RouteBuilder {
@Override
public void configure() throws Exception {
/**
POST /pet : Add a new pet to the store
**/
from("direct:addPet")
.id("addPet")
.choice()
.when(simple("${body} != null"))
.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\" }"))
.unmarshal().json(JsonLibrary.Jackson, Pet.class);
/**
DELETE /pet/{petId} : Deletes a pet
**/
from("direct:deletePet")
.id("deletePet")
.choice()
.when(simple("${body} != null"))
.log(LoggingLevel.INFO, "BODY TYPE: ${body.getClass().getName()}")
.end()
.log(LoggingLevel.INFO, "HEADERS: ${headers}");
/**
GET /pet/findByStatus : Finds Pets by status
**/
from("direct:findPetsByStatus")
.id("findPetsByStatus")
.choice()
.when(simple("${body} != null"))
.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\" }]"))
.unmarshal().json(JsonLibrary.Jackson, Pet[].class);
/**
GET /pet/findByTags : Finds Pets by tags
**/
from("direct:findPetsByTags")
.id("findPetsByTags")
.choice()
.when(simple("${body} != null"))
.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\" }]"))
.unmarshal().json(JsonLibrary.Jackson, Pet[].class);
/**
GET /pet/{petId} : Find pet by ID
**/
from("direct:getPetById")
.id("getPetById")
.choice()
.when(simple("${body} != null"))
.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\" }"))
.unmarshal().json(JsonLibrary.Jackson, Pet.class);
/**
PUT /pet : Update an existing pet
**/
from("direct:updatePet")
.id("updatePet")
.choice()
.when(simple("${body} != null"))
.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\" }"))
.unmarshal().json(JsonLibrary.Jackson, Pet.class);
/**
POST /pet/{petId} : Updates a pet in the store with form data
**/
from("direct:updatePetWithForm")
.id("updatePetWithForm")
.choice()
.when(simple("${body} != null"))
.log(LoggingLevel.INFO, "BODY TYPE: ${body.getClass().getName()}")
.end()
.log(LoggingLevel.INFO, "HEADERS: ${headers}");
/**
POST /pet/{petId}/uploadImage : uploads an image
**/
from("direct:uploadFile")
.id("uploadFile")
.choice()
.when(simple("${body} != null"))
.log(LoggingLevel.INFO, "BODY TYPE: ${body.getClass().getName()}")
.end()
.log(LoggingLevel.INFO, "HEADERS: ${headers}")
.setBody(constant("{ \"code\" : 0, \"type\" : \"type\", \"message\" : \"message\" }"))
.unmarshal().json(JsonLibrary.Jackson, ModelApiResponse.class);
}
}

View File

@@ -0,0 +1,64 @@
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (5.4.0-SNAPSHOT).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.api;
import org.apache.camel.builder.RouteBuilder;
import org.springframework.stereotype.Component;
import org.apache.camel.LoggingLevel;
@Component
public class PetApiValidator extends RouteBuilder {
@Override
public void configure() throws Exception {
onException(Exception.class)
.log(LoggingLevel.ERROR, "${exception.message}: ${exception.stacktrace}")
.handled(true)
.process("validationErrorProcessor");
from("direct:validate-addPet")
.id("validate-addPet")
.to("bean-validator://validate-request")
.to("direct:addPet")
.to("bean-validator://validate-response");
from("direct:validate-deletePet")
.id("validate-deletePet")
.to("direct:deletePet");
from("direct:validate-findPetsByStatus")
.id("validate-findPetsByStatus")
.to("direct:findPetsByStatus")
.to("bean-validator://validate-response");
from("direct:validate-findPetsByTags")
.id("validate-findPetsByTags")
.to("direct:findPetsByTags")
.to("bean-validator://validate-response");
from("direct:validate-getPetById")
.id("validate-getPetById")
.to("direct:getPetById")
.to("bean-validator://validate-response");
from("direct:validate-updatePet")
.id("validate-updatePet")
.to("bean-validator://validate-request")
.to("direct:updatePet")
.to("bean-validator://validate-response");
from("direct:validate-updatePetWithForm")
.id("validate-updatePetWithForm")
.to("bean-validator://validate-request")
.to("direct:updatePetWithForm");
from("direct:validate-uploadFile")
.id("validate-uploadFile")
.to("bean-validator://validate-request")
.to("direct:uploadFile")
.to("bean-validator://validate-response");
}
}

View File

@@ -0,0 +1,97 @@
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (5.4.0-SNAPSHOT).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.api;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.model.rest.RestParamType;
import org.springframework.stereotype.Component;
import org.openapitools.model.*;
import org.apache.camel.model.rest.RestBindingMode;
import org.apache.camel.LoggingLevel;
@Component
public class StoreApi extends RouteBuilder {
@Override
public void configure() throws Exception {
onException(Exception.class)
.log(LoggingLevel.ERROR, "${exception.message}: ${exception.stacktrace}")
.handled(true)
.process("validationErrorProcessor");
/**
DELETE /store/order/{orderId} : Delete purchase order by ID
**/
rest()
.delete("/store/order/{orderId}")
.description("Delete purchase order by ID")
.id("deleteOrderApi")
.param()
.name("orderId")
.type(RestParamType.path)
.required(true)
.description("ID of the order that needs to be deleted")
.endParam()
.to("direct:validate-deleteOrder");
/**
GET /store/inventory : Returns pet inventories by status
**/
rest()
.securityDefinitions()
.apiKey("api_key")
.withHeader("api_key")
.endSecurityDefinition()
.get("/store/inventory")
.description("Returns pet inventories by status")
.id("getInventoryApi")
.produces("application/json")
.to("direct:validate-getInventory");
/**
GET /store/order/{orderId} : Find purchase order by ID
**/
rest()
.get("/store/order/{orderId}")
.description("Find purchase order by ID")
.id("getOrderByIdApi")
.produces("application/xml, application/json")
.outType(Order.class)
.param()
.name("orderId")
.type(RestParamType.path)
.required(true)
.description("ID of pet that needs to be fetched")
.endParam()
.to("direct:validate-getOrderById");
/**
POST /store/order : Place an order for a pet
**/
rest()
.post("/store/order")
.description("Place an order for a pet")
.id("placeOrderApi")
.produces("application/xml, application/json")
.outType(Order.class)
.consumes("application/json")
.type(Order.class)
.param()
.name("order")
.type(RestParamType.body)
.required(true)
.description("order placed for purchasing the pet")
.endParam()
.to("direct:validate-placeOrder");
}
}

View File

@@ -0,0 +1,64 @@
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (5.4.0-SNAPSHOT).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.api;
import org.apache.camel.builder.RouteBuilder;
import org.springframework.stereotype.Component;
import org.apache.camel.LoggingLevel;
import org.openapitools.model.*;
import org.apache.camel.model.dataformat.JsonLibrary;
@Component
public class StoreApiRoutesImpl extends RouteBuilder {
@Override
public void configure() throws Exception {
/**
DELETE /store/order/{orderId} : Delete purchase order by ID
**/
from("direct:deleteOrder")
.id("deleteOrder")
.choice()
.when(simple("${body} != null"))
.log(LoggingLevel.INFO, "BODY TYPE: ${body.getClass().getName()}")
.end()
.log(LoggingLevel.INFO, "HEADERS: ${headers}");
/**
GET /store/inventory : Returns pet inventories by status
**/
from("direct:getInventory")
.id("getInventory")
.choice()
.when(simple("${body} != null"))
.log(LoggingLevel.INFO, "BODY TYPE: ${body.getClass().getName()}")
.end()
.log(LoggingLevel.INFO, "HEADERS: ${headers}");
/**
GET /store/order/{orderId} : Find purchase order by ID
**/
from("direct:getOrderById")
.id("getOrderById")
.choice()
.when(simple("${body} != null"))
.log(LoggingLevel.INFO, "BODY TYPE: ${body.getClass().getName()}")
.end()
.log(LoggingLevel.INFO, "HEADERS: ${headers}")
.setBody(constant("{ \"petId\" : 6, \"quantity\" : 1, \"id\" : 0, \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\", \"complete\" : false, \"status\" : \"placed\" }"))
.unmarshal().json(JsonLibrary.Jackson, Order.class);
/**
POST /store/order : Place an order for a pet
**/
from("direct:placeOrder")
.id("placeOrder")
.choice()
.when(simple("${body} != null"))
.log(LoggingLevel.INFO, "BODY TYPE: ${body.getClass().getName()}")
.end()
.log(LoggingLevel.INFO, "HEADERS: ${headers}")
.setBody(constant("{ \"petId\" : 6, \"quantity\" : 1, \"id\" : 0, \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\", \"complete\" : false, \"status\" : \"placed\" }"))
.unmarshal().json(JsonLibrary.Jackson, Order.class);
}
}

View File

@@ -0,0 +1,42 @@
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (5.4.0-SNAPSHOT).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.api;
import org.apache.camel.builder.RouteBuilder;
import org.springframework.stereotype.Component;
import org.apache.camel.LoggingLevel;
@Component
public class StoreApiValidator extends RouteBuilder {
@Override
public void configure() throws Exception {
onException(Exception.class)
.log(LoggingLevel.ERROR, "${exception.message}: ${exception.stacktrace}")
.handled(true)
.process("validationErrorProcessor");
from("direct:validate-deleteOrder")
.id("validate-deleteOrder")
.to("direct:deleteOrder");
from("direct:validate-getInventory")
.id("validate-getInventory")
.to("direct:getInventory")
.to("bean-validator://validate-response");
from("direct:validate-getOrderById")
.id("validate-getOrderById")
.to("direct:getOrderById")
.to("bean-validator://validate-response");
from("direct:validate-placeOrder")
.id("validate-placeOrder")
.to("bean-validator://validate-request")
.to("direct:placeOrder")
.to("bean-validator://validate-response");
}
}

View File

@@ -0,0 +1,206 @@
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (5.4.0-SNAPSHOT).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.api;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.model.rest.RestParamType;
import org.springframework.stereotype.Component;
import org.openapitools.model.*;
import org.apache.camel.model.rest.RestBindingMode;
import org.apache.camel.LoggingLevel;
@Component
public class UserApi extends RouteBuilder {
@Override
public void configure() throws Exception {
onException(Exception.class)
.log(LoggingLevel.ERROR, "${exception.message}: ${exception.stacktrace}")
.handled(true)
.process("validationErrorProcessor");
/**
POST /user : Create user
**/
rest()
.securityDefinitions()
.apiKey("api_key")
.withHeader("api_key")
.endSecurityDefinition()
.post("/user")
.description("Create user")
.id("createUserApi")
.consumes("application/json")
.type(User.class)
.param()
.name("user")
.type(RestParamType.body)
.required(true)
.description("Created user object")
.endParam()
.to("direct:validate-createUser");
/**
POST /user/createWithArray : Creates list of users with given input array
**/
rest()
.securityDefinitions()
.apiKey("api_key")
.withHeader("api_key")
.endSecurityDefinition()
.post("/user/createWithArray")
.description("Creates list of users with given input array")
.id("createUsersWithArrayInputApi")
.consumes("application/json")
.type(User[].class)
.param()
.name("user")
.type(RestParamType.body)
.required(true)
.description("List of user object")
.endParam()
.to("direct:validate-createUsersWithArrayInput");
/**
POST /user/createWithList : Creates list of users with given input array
**/
rest()
.securityDefinitions()
.apiKey("api_key")
.withHeader("api_key")
.endSecurityDefinition()
.post("/user/createWithList")
.description("Creates list of users with given input array")
.id("createUsersWithListInputApi")
.consumes("application/json")
.type(User[].class)
.param()
.name("user")
.type(RestParamType.body)
.required(true)
.description("List of user object")
.endParam()
.to("direct:validate-createUsersWithListInput");
/**
DELETE /user/{username} : Delete user
**/
rest()
.securityDefinitions()
.apiKey("api_key")
.withHeader("api_key")
.endSecurityDefinition()
.delete("/user/{username}")
.description("Delete user")
.id("deleteUserApi")
.param()
.name("username")
.type(RestParamType.path)
.required(true)
.description("The name that needs to be deleted")
.endParam()
.to("direct:validate-deleteUser");
/**
GET /user/{username} : Get user by user name
**/
rest()
.get("/user/{username}")
.description("Get user by user name")
.id("getUserByNameApi")
.produces("application/xml, application/json")
.outType(User.class)
.param()
.name("username")
.type(RestParamType.path)
.required(true)
.description("The name that needs to be fetched. Use user1 for testing.")
.endParam()
.to("direct:validate-getUserByName");
/**
GET /user/login : Logs user into the system
**/
rest()
.get("/user/login")
.description("Logs user into the system")
.id("loginUserApi")
.produces("application/xml, application/json")
.outType(String.class)
.param()
.name("username")
.type(RestParamType.query)
.required(true)
.description("The user name for login")
.endParam()
.param()
.name("password")
.type(RestParamType.query)
.required(true)
.description("The password for login in clear text")
.endParam()
.to("direct:validate-loginUser");
/**
GET /user/logout : Logs out current logged in user session
**/
rest()
.securityDefinitions()
.apiKey("api_key")
.withHeader("api_key")
.endSecurityDefinition()
.get("/user/logout")
.description("Logs out current logged in user session")
.id("logoutUserApi")
.to("direct:validate-logoutUser");
/**
PUT /user/{username} : Updated user
**/
rest()
.securityDefinitions()
.apiKey("api_key")
.withHeader("api_key")
.endSecurityDefinition()
.put("/user/{username}")
.description("Updated user")
.id("updateUserApi")
.consumes("application/json")
.type(User.class)
.param()
.name("username")
.type(RestParamType.path)
.required(true)
.description("name that need to be deleted")
.endParam()
.param()
.name("user")
.type(RestParamType.body)
.required(true)
.description("Updated user object")
.endParam()
.to("direct:validate-updateUser");
}
}

View File

@@ -0,0 +1,102 @@
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (5.4.0-SNAPSHOT).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.api;
import org.apache.camel.builder.RouteBuilder;
import org.springframework.stereotype.Component;
import org.apache.camel.LoggingLevel;
import org.openapitools.model.*;
import org.apache.camel.model.dataformat.JsonLibrary;
@Component
public class UserApiRoutesImpl extends RouteBuilder {
@Override
public void configure() throws Exception {
/**
POST /user : Create user
**/
from("direct:createUser")
.id("createUser")
.choice()
.when(simple("${body} != null"))
.log(LoggingLevel.INFO, "BODY TYPE: ${body.getClass().getName()}")
.end()
.log(LoggingLevel.INFO, "HEADERS: ${headers}");
/**
POST /user/createWithArray : Creates list of users with given input array
**/
from("direct:createUsersWithArrayInput")
.id("createUsersWithArrayInput")
.choice()
.when(simple("${body} != null"))
.log(LoggingLevel.INFO, "BODY TYPE: ${body.getClass().getName()}")
.end()
.log(LoggingLevel.INFO, "HEADERS: ${headers}");
/**
POST /user/createWithList : Creates list of users with given input array
**/
from("direct:createUsersWithListInput")
.id("createUsersWithListInput")
.choice()
.when(simple("${body} != null"))
.log(LoggingLevel.INFO, "BODY TYPE: ${body.getClass().getName()}")
.end()
.log(LoggingLevel.INFO, "HEADERS: ${headers}");
/**
DELETE /user/{username} : Delete user
**/
from("direct:deleteUser")
.id("deleteUser")
.choice()
.when(simple("${body} != null"))
.log(LoggingLevel.INFO, "BODY TYPE: ${body.getClass().getName()}")
.end()
.log(LoggingLevel.INFO, "HEADERS: ${headers}");
/**
GET /user/{username} : Get user by user name
**/
from("direct:getUserByName")
.id("getUserByName")
.choice()
.when(simple("${body} != null"))
.log(LoggingLevel.INFO, "BODY TYPE: ${body.getClass().getName()}")
.end()
.log(LoggingLevel.INFO, "HEADERS: ${headers}")
.setBody(constant("{ \"firstName\" : \"firstName\", \"lastName\" : \"lastName\", \"password\" : \"password\", \"userStatus\" : 6, \"phone\" : \"phone\", \"id\" : 0, \"email\" : \"email\", \"username\" : \"username\" }"))
.unmarshal().json(JsonLibrary.Jackson, User.class);
/**
GET /user/login : Logs user into the system
**/
from("direct:loginUser")
.id("loginUser")
.choice()
.when(simple("${body} != null"))
.log(LoggingLevel.INFO, "BODY TYPE: ${body.getClass().getName()}")
.end()
.log(LoggingLevel.INFO, "HEADERS: ${headers}");
/**
GET /user/logout : Logs out current logged in user session
**/
from("direct:logoutUser")
.id("logoutUser")
.choice()
.when(simple("${body} != null"))
.log(LoggingLevel.INFO, "BODY TYPE: ${body.getClass().getName()}")
.end()
.log(LoggingLevel.INFO, "HEADERS: ${headers}");
/**
PUT /user/{username} : Updated user
**/
from("direct:updateUser")
.id("updateUser")
.choice()
.when(simple("${body} != null"))
.log(LoggingLevel.INFO, "BODY TYPE: ${body.getClass().getName()}")
.end()
.log(LoggingLevel.INFO, "HEADERS: ${headers}");
}
}

View File

@@ -0,0 +1,60 @@
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (5.4.0-SNAPSHOT).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.api;
import org.apache.camel.builder.RouteBuilder;
import org.springframework.stereotype.Component;
import org.apache.camel.LoggingLevel;
@Component
public class UserApiValidator extends RouteBuilder {
@Override
public void configure() throws Exception {
onException(Exception.class)
.log(LoggingLevel.ERROR, "${exception.message}: ${exception.stacktrace}")
.handled(true)
.process("validationErrorProcessor");
from("direct:validate-createUser")
.id("validate-createUser")
.to("bean-validator://validate-request")
.to("direct:createUser");
from("direct:validate-createUsersWithArrayInput")
.id("validate-createUsersWithArrayInput")
.to("bean-validator://validate-request")
.to("direct:createUsersWithArrayInput");
from("direct:validate-createUsersWithListInput")
.id("validate-createUsersWithListInput")
.to("bean-validator://validate-request")
.to("direct:createUsersWithListInput");
from("direct:validate-deleteUser")
.id("validate-deleteUser")
.to("direct:deleteUser");
from("direct:validate-getUserByName")
.id("validate-getUserByName")
.to("direct:getUserByName")
.to("bean-validator://validate-response");
from("direct:validate-loginUser")
.id("validate-loginUser")
.to("direct:loginUser")
.to("bean-validator://validate-response");
from("direct:validate-logoutUser")
.id("validate-logoutUser")
.to("direct:logoutUser");
from("direct:validate-updateUser")
.id("validate-updateUser")
.to("bean-validator://validate-request")
.to("direct:updateUser");
}
}

View File

@@ -0,0 +1,117 @@
package org.openapitools.model;
import java.net.URI;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import org.openapitools.jackson.nullable.JsonNullable;
import java.time.OffsetDateTime;
import javax.validation.Valid;
import javax.validation.constraints.*;
import org.hibernate.validator.constraints.*;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import javax.xml.bind.annotation.*;
import java.util.*;
/**
* A category for a pet
*/
@Schema(name = "Category",description = "A category for a pet")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaCamelServerCodegen")@JacksonXmlRootElement(localName = "Category")
@XmlRootElement(name = "Category")
@XmlAccessorType(XmlAccessType.FIELD)
public class Category {
@JsonProperty("id")
@JacksonXmlProperty(localName = "id")
private Long id;
@JsonProperty("name")
@JacksonXmlProperty(localName = "name")
private String name;
public Category id(Long id) {
this.id = id;
return this;
}
/**
* Get id
* @return id
*/
@Schema(name = "id", defaultValue = "")
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Category name(String name) {
this.name = name;
return this;
}
/**
* Get name
* @return name
*/
@Schema(name = "name", defaultValue = "")
@Pattern(regexp = "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$")
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Category category = (Category) o;
return Objects.equals(this.id, category.id) &&
Objects.equals(this.name, category.name);
}
@Override
public int hashCode() {
return Objects.hash(id, name);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Category {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -0,0 +1,143 @@
package org.openapitools.model;
import java.net.URI;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import org.openapitools.jackson.nullable.JsonNullable;
import java.time.OffsetDateTime;
import javax.validation.Valid;
import javax.validation.constraints.*;
import org.hibernate.validator.constraints.*;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import javax.xml.bind.annotation.*;
import java.util.*;
/**
* Describes the result of uploading an image resource
*/
@Schema(name = "ApiResponse",description = "Describes the result of uploading an image resource")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaCamelServerCodegen")@JacksonXmlRootElement(localName = "ModelApiResponse")
@XmlRootElement(name = "ModelApiResponse")
@XmlAccessorType(XmlAccessType.FIELD)
public class ModelApiResponse {
@JsonProperty("code")
@JacksonXmlProperty(localName = "code")
private Integer code;
@JsonProperty("type")
@JacksonXmlProperty(localName = "type")
private String type;
@JsonProperty("message")
@JacksonXmlProperty(localName = "message")
private String message;
public ModelApiResponse code(Integer code) {
this.code = code;
return this;
}
/**
* Get code
* @return code
*/
@Schema(name = "code", defaultValue = "")
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public ModelApiResponse type(String type) {
this.type = type;
return this;
}
/**
* Get type
* @return type
*/
@Schema(name = "type", defaultValue = "")
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public ModelApiResponse message(String message) {
this.message = message;
return this;
}
/**
* Get message
* @return message
*/
@Schema(name = "message", defaultValue = "")
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ModelApiResponse _apiResponse = (ModelApiResponse) o;
return Objects.equals(this.code, _apiResponse.code) &&
Objects.equals(this.type, _apiResponse.type) &&
Objects.equals(this.message, _apiResponse.message);
}
@Override
public int hashCode() {
return Objects.hash(code, type, message);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ModelApiResponse {\n");
sb.append(" code: ").append(toIndentedString(code)).append("\n");
sb.append(" type: ").append(toIndentedString(type)).append("\n");
sb.append(" message: ").append(toIndentedString(message)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -0,0 +1,262 @@
package org.openapitools.model;
import java.net.URI;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.Date;
import org.openapitools.jackson.nullable.JsonNullable;
import java.time.OffsetDateTime;
import javax.validation.Valid;
import javax.validation.constraints.*;
import org.hibernate.validator.constraints.*;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import javax.xml.bind.annotation.*;
import java.util.*;
/**
* An order for a pets from the pet store
*/
@Schema(name = "Order",description = "An order for a pets from the pet store")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaCamelServerCodegen")@JacksonXmlRootElement(localName = "Order")
@XmlRootElement(name = "Order")
@XmlAccessorType(XmlAccessType.FIELD)
public class Order {
@JsonProperty("id")
@JacksonXmlProperty(localName = "id")
private Long id;
@JsonProperty("petId")
@JacksonXmlProperty(localName = "petId")
private Long petId;
@JsonProperty("quantity")
@JacksonXmlProperty(localName = "quantity")
private Integer quantity;
@JsonProperty("shipDate")
@JacksonXmlProperty(localName = "shipDate")
@org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME)
private Date shipDate;
/**
* Order Status
*/
public enum StatusEnum {
PLACED("placed"),
APPROVED("approved"),
DELIVERED("delivered");
private String value;
StatusEnum(String value) {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
@JsonCreator
public static StatusEnum fromValue(String value) {
for (StatusEnum b : StatusEnum.values()) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
}
@JsonProperty("status")
@JacksonXmlProperty(localName = "status")
private StatusEnum status;
@JsonProperty("complete")
@JacksonXmlProperty(localName = "complete")
private Boolean complete = false;
public Order id(Long id) {
this.id = id;
return this;
}
/**
* Get id
* @return id
*/
@Schema(name = "id", defaultValue = "")
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Order petId(Long petId) {
this.petId = petId;
return this;
}
/**
* Get petId
* @return petId
*/
@Schema(name = "petId", defaultValue = "")
public Long getPetId() {
return petId;
}
public void setPetId(Long petId) {
this.petId = petId;
}
public Order quantity(Integer quantity) {
this.quantity = quantity;
return this;
}
/**
* Get quantity
* @return quantity
*/
@Schema(name = "quantity", defaultValue = "")
public Integer getQuantity() {
return quantity;
}
public void setQuantity(Integer quantity) {
this.quantity = quantity;
}
public Order shipDate(Date shipDate) {
this.shipDate = shipDate;
return this;
}
/**
* Get shipDate
* @return shipDate
*/
@Schema(name = "shipDate", defaultValue = "")
@Valid
public Date getShipDate() {
return shipDate;
}
public void setShipDate(Date shipDate) {
this.shipDate = shipDate;
}
public Order status(StatusEnum status) {
this.status = status;
return this;
}
/**
* Order Status
* @return status
*/
@Schema(name = "status", defaultValue = "Order Status")
public StatusEnum getStatus() {
return status;
}
public void setStatus(StatusEnum status) {
this.status = status;
}
public Order complete(Boolean complete) {
this.complete = complete;
return this;
}
/**
* Get complete
* @return complete
*/
@Schema(name = "complete", defaultValue = "")
public Boolean getComplete() {
return complete;
}
public void setComplete(Boolean complete) {
this.complete = complete;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Order order = (Order) o;
return Objects.equals(this.id, order.id) &&
Objects.equals(this.petId, order.petId) &&
Objects.equals(this.quantity, order.quantity) &&
Objects.equals(this.shipDate, order.shipDate) &&
Objects.equals(this.status, order.status) &&
Objects.equals(this.complete, order.complete);
}
@Override
public int hashCode() {
return Objects.hash(id, petId, quantity, shipDate, status, complete);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Order {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" petId: ").append(toIndentedString(petId)).append("\n");
sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n");
sb.append(" shipDate: ").append(toIndentedString(shipDate)).append("\n");
sb.append(" status: ").append(toIndentedString(status)).append("\n");
sb.append(" complete: ").append(toIndentedString(complete)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -0,0 +1,282 @@
package org.openapitools.model;
import java.net.URI;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.ArrayList;
import java.util.List;
import org.openapitools.model.Category;
import org.openapitools.model.Tag;
import org.openapitools.jackson.nullable.JsonNullable;
import java.time.OffsetDateTime;
import javax.validation.Valid;
import javax.validation.constraints.*;
import org.hibernate.validator.constraints.*;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import javax.xml.bind.annotation.*;
import java.util.*;
/**
* A pet for sale in the pet store
*/
@Schema(name = "Pet",description = "A pet for sale in the pet store")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaCamelServerCodegen")@JacksonXmlRootElement(localName = "Pet")
@XmlRootElement(name = "Pet")
@XmlAccessorType(XmlAccessType.FIELD)
public class Pet {
@JsonProperty("id")
@JacksonXmlProperty(localName = "id")
private Long id;
@JsonProperty("category")
@JacksonXmlProperty(localName = "category")
private Category category;
@JsonProperty("name")
@JacksonXmlProperty(localName = "name")
private String name;
@JsonProperty("photoUrls")
@JacksonXmlProperty(localName = "photoUrl")
@Valid
private List<String> photoUrls = new ArrayList<String>();
@JsonProperty("tags")
@JacksonXmlProperty(localName = "tag")
@Valid
private List<Tag> tags = null;
/**
* pet status in the store
*/
public enum StatusEnum {
AVAILABLE("available"),
PENDING("pending"),
SOLD("sold");
private String value;
StatusEnum(String value) {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
@JsonCreator
public static StatusEnum fromValue(String value) {
for (StatusEnum b : StatusEnum.values()) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
}
@JsonProperty("status")
@JacksonXmlProperty(localName = "status")
private StatusEnum status;
public Pet id(Long id) {
this.id = id;
return this;
}
/**
* Get id
* @return id
*/
@Schema(name = "id", defaultValue = "")
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Pet category(Category category) {
this.category = category;
return this;
}
/**
* Get category
* @return category
*/
@Schema(name = "category", defaultValue = "")
@Valid
public Category getCategory() {
return category;
}
public void setCategory(Category category) {
this.category = category;
}
public Pet name(String name) {
this.name = name;
return this;
}
/**
* Get name
* @return name
*/
@Schema(name = "name", example = "doggie", required = true, defaultValue = "")
@NotNull
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Pet photoUrls(List<String> photoUrls) {
this.photoUrls = photoUrls;
return this;
}
public Pet addPhotoUrlsItem(String photoUrlsItem) {
this.photoUrls.add(photoUrlsItem);
return this;
}
/**
* Get photoUrls
* @return photoUrls
*/
@Schema(name = "photoUrls", required = true, defaultValue = "")
@NotNull
public List<String> getPhotoUrls() {
return photoUrls;
}
public void setPhotoUrls(List<String> photoUrls) {
this.photoUrls = photoUrls;
}
public Pet tags(List<Tag> tags) {
this.tags = tags;
return this;
}
public Pet addTagsItem(Tag tagsItem) {
if (this.tags == null) {
this.tags = new ArrayList<Tag>();
}
this.tags.add(tagsItem);
return this;
}
/**
* Get tags
* @return tags
*/
@Schema(name = "tags", defaultValue = "")
@Valid
public List<Tag> getTags() {
return tags;
}
public void setTags(List<Tag> tags) {
this.tags = tags;
}
public Pet status(StatusEnum status) {
this.status = status;
return this;
}
/**
* pet status in the store
* @return status
*/
@Schema(name = "status", defaultValue = "pet status in the store")
public StatusEnum getStatus() {
return status;
}
public void setStatus(StatusEnum status) {
this.status = status;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Pet pet = (Pet) o;
return Objects.equals(this.id, pet.id) &&
Objects.equals(this.category, pet.category) &&
Objects.equals(this.name, pet.name) &&
Objects.equals(this.photoUrls, pet.photoUrls) &&
Objects.equals(this.tags, pet.tags) &&
Objects.equals(this.status, pet.status);
}
@Override
public int hashCode() {
return Objects.hash(id, category, name, photoUrls, tags, status);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Pet {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" category: ").append(toIndentedString(category)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n");
sb.append(" tags: ").append(toIndentedString(tags)).append("\n");
sb.append(" status: ").append(toIndentedString(status)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -0,0 +1,117 @@
package org.openapitools.model;
import java.net.URI;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import org.openapitools.jackson.nullable.JsonNullable;
import java.time.OffsetDateTime;
import javax.validation.Valid;
import javax.validation.constraints.*;
import org.hibernate.validator.constraints.*;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import javax.xml.bind.annotation.*;
import java.util.*;
/**
* A tag for a pet
*/
@Schema(name = "Tag",description = "A tag for a pet")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaCamelServerCodegen")@JacksonXmlRootElement(localName = "Tag")
@XmlRootElement(name = "Tag")
@XmlAccessorType(XmlAccessType.FIELD)
public class Tag {
@JsonProperty("id")
@JacksonXmlProperty(localName = "id")
private Long id;
@JsonProperty("name")
@JacksonXmlProperty(localName = "name")
private String name;
public Tag id(Long id) {
this.id = id;
return this;
}
/**
* Get id
* @return id
*/
@Schema(name = "id", defaultValue = "")
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Tag name(String name) {
this.name = name;
return this;
}
/**
* Get name
* @return name
*/
@Schema(name = "name", defaultValue = "")
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Tag tag = (Tag) o;
return Objects.equals(this.id, tag.id) &&
Objects.equals(this.name, tag.name);
}
@Override
public int hashCode() {
return Objects.hash(id, name);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Tag {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -0,0 +1,273 @@
package org.openapitools.model;
import java.net.URI;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import org.openapitools.jackson.nullable.JsonNullable;
import java.time.OffsetDateTime;
import javax.validation.Valid;
import javax.validation.constraints.*;
import org.hibernate.validator.constraints.*;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import javax.xml.bind.annotation.*;
import java.util.*;
/**
* A User who is purchasing from the pet store
*/
@Schema(name = "User",description = "A User who is purchasing from the pet store")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaCamelServerCodegen")@JacksonXmlRootElement(localName = "User")
@XmlRootElement(name = "User")
@XmlAccessorType(XmlAccessType.FIELD)
public class User {
@JsonProperty("id")
@JacksonXmlProperty(localName = "id")
private Long id;
@JsonProperty("username")
@JacksonXmlProperty(localName = "username")
private String username;
@JsonProperty("firstName")
@JacksonXmlProperty(localName = "firstName")
private String firstName;
@JsonProperty("lastName")
@JacksonXmlProperty(localName = "lastName")
private String lastName;
@JsonProperty("email")
@JacksonXmlProperty(localName = "email")
private String email;
@JsonProperty("password")
@JacksonXmlProperty(localName = "password")
private String password;
@JsonProperty("phone")
@JacksonXmlProperty(localName = "phone")
private String phone;
@JsonProperty("userStatus")
@JacksonXmlProperty(localName = "userStatus")
private Integer userStatus;
public User id(Long id) {
this.id = id;
return this;
}
/**
* Get id
* @return id
*/
@Schema(name = "id", defaultValue = "")
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public User username(String username) {
this.username = username;
return this;
}
/**
* Get username
* @return username
*/
@Schema(name = "username", defaultValue = "")
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public User firstName(String firstName) {
this.firstName = firstName;
return this;
}
/**
* Get firstName
* @return firstName
*/
@Schema(name = "firstName", defaultValue = "")
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public User lastName(String lastName) {
this.lastName = lastName;
return this;
}
/**
* Get lastName
* @return lastName
*/
@Schema(name = "lastName", defaultValue = "")
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public User email(String email) {
this.email = email;
return this;
}
/**
* Get email
* @return email
*/
@Schema(name = "email", defaultValue = "")
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public User password(String password) {
this.password = password;
return this;
}
/**
* Get password
* @return password
*/
@Schema(name = "password", defaultValue = "")
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public User phone(String phone) {
this.phone = phone;
return this;
}
/**
* Get phone
* @return phone
*/
@Schema(name = "phone", defaultValue = "")
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public User userStatus(Integer userStatus) {
this.userStatus = userStatus;
return this;
}
/**
* User Status
* @return userStatus
*/
@Schema(name = "userStatus", defaultValue = "User Status")
public Integer getUserStatus() {
return userStatus;
}
public void setUserStatus(Integer userStatus) {
this.userStatus = userStatus;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
User user = (User) o;
return Objects.equals(this.id, user.id) &&
Objects.equals(this.username, user.username) &&
Objects.equals(this.firstName, user.firstName) &&
Objects.equals(this.lastName, user.lastName) &&
Objects.equals(this.email, user.email) &&
Objects.equals(this.password, user.password) &&
Objects.equals(this.phone, user.phone) &&
Objects.equals(this.userStatus, user.userStatus);
}
@Override
public int hashCode() {
return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class User {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" username: ").append(toIndentedString(username)).append("\n");
sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n");
sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n");
sb.append(" email: ").append(toIndentedString(email)).append("\n");
sb.append(" password: ").append(toIndentedString(password)).append("\n");
sb.append(" phone: ").append(toIndentedString(phone)).append("\n");
sb.append(" userStatus: ").append(toIndentedString(userStatus)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -0,0 +1,8 @@
# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (5.4.0-SNAPSHOT).
# https://openapi-generator.tech
# Do not edit the class manually.
camel.springboot.name=camel-openapi-camel
camel.servlet.mapping.context-path=/api/v1/*
server.port=8080

View File

@@ -0,0 +1,145 @@
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (5.4.0-SNAPSHOT).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.api;
import org.junit.jupiter.api.Test;
import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
import org.springframework.boot.test.context.SpringBootTest;
import com.mashape.unirest.request.HttpRequest;
import com.mashape.unirest.request.HttpRequestWithBody;
import com.mashape.unirest.http.Unirest;
import com.mashape.unirest.http.JsonNode;
import com.mashape.unirest.http.HttpResponse;
import java.io.InputStream;
import org.junit.jupiter.api.Assertions;
@CamelSpringBootTest
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
public class PetApiTest {
private static final String API_URL = "http://127.0.0.1:8080/api/v1";
@Test
public void addPetTestJson() throws Exception {
String contentType = "application/json";
String accept = "application/json";
String url = API_URL + "/pet";
HttpRequest httpRequest = Unirest.post(url);
httpRequest = httpRequest.header("Content-Type", contentType);
httpRequest = httpRequest.header("Accept", accept);
String requestBody = "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\" }";
httpRequest = ((HttpRequestWithBody) httpRequest).body(requestBody).getHttpRequest();
HttpResponse<JsonNode> httpResponse = httpRequest.asJson();
Assertions.assertTrue(httpResponse.getStatus() < 400 || httpResponse.getStatus() == 415);
}
@Test
public void addPetTestXml() throws Exception {
String contentType = "application/xml";
String accept = "application/xml";
String url = API_URL + "/pet";
HttpRequest httpRequest = Unirest.post(url);
httpRequest = httpRequest.header("Content-Type", contentType);
httpRequest = httpRequest.header("Accept", accept);
String requestBody = "<Pet> <id>123456789</id> <name>doggie</name> <photoUrls> <photoUrls>aeiou</photoUrls> </photoUrls> <tags> </tags> <status>aeiou</status> </Pet>";
httpRequest = ((HttpRequestWithBody) httpRequest).body(requestBody).getHttpRequest();
HttpResponse<String> httpResponse = httpRequest.asString();
Assertions.assertTrue(httpResponse.getStatus() < 400 || httpResponse.getStatus() == 415);
}
@Test
public void findPetsByStatusTestJson() throws Exception {
String contentType = "application/json";
String accept = "application/json";
String url = API_URL + "/pet/findByStatus";
HttpRequest httpRequest = Unirest.get(url);
httpRequest = httpRequest.header("Accept", accept);
httpRequest = httpRequest.queryString("status", "1");
HttpResponse<JsonNode> httpResponse = httpRequest.asJson();
Assertions.assertTrue(httpResponse.getStatus() < 400 || httpResponse.getStatus() == 415);
}
@Test
public void findPetsByTagsTestJson() throws Exception {
String contentType = "application/json";
String accept = "application/json";
String url = API_URL + "/pet/findByTags";
HttpRequest httpRequest = Unirest.get(url);
httpRequest = httpRequest.header("Accept", accept);
httpRequest = httpRequest.queryString("tags", "1");
HttpResponse<JsonNode> httpResponse = httpRequest.asJson();
Assertions.assertTrue(httpResponse.getStatus() < 400 || httpResponse.getStatus() == 415);
}
@Test
public void getPetByIdTestJson() throws Exception {
String contentType = "application/json";
String accept = "application/json";
String url = API_URL + "/pet/{petId}";
HttpRequest httpRequest = Unirest.get(url);
httpRequest = httpRequest.header("Accept", accept);
httpRequest = httpRequest.routeParam("petId", "1");
HttpResponse<JsonNode> httpResponse = httpRequest.asJson();
Assertions.assertTrue(httpResponse.getStatus() < 400 || httpResponse.getStatus() == 415);
}
@Test
public void getPetByIdTestXml() throws Exception {
String contentType = "application/xml";
String accept = "application/xml";
String url = API_URL + "/pet/{petId}";
HttpRequest httpRequest = Unirest.get(url);
httpRequest = httpRequest.header("Accept", accept);
httpRequest = httpRequest.routeParam("petId", "1");
HttpResponse<String> httpResponse = httpRequest.asString();
Assertions.assertTrue(httpResponse.getStatus() < 400 || httpResponse.getStatus() == 415);
}
@Test
public void updatePetTestJson() throws Exception {
String contentType = "application/json";
String accept = "application/json";
String url = API_URL + "/pet";
HttpRequest httpRequest = Unirest.put(url);
httpRequest = httpRequest.header("Content-Type", contentType);
httpRequest = httpRequest.header("Accept", accept);
String requestBody = "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\" }";
httpRequest = ((HttpRequestWithBody) httpRequest).body(requestBody).getHttpRequest();
HttpResponse<JsonNode> httpResponse = httpRequest.asJson();
Assertions.assertTrue(httpResponse.getStatus() < 400 || httpResponse.getStatus() == 415);
}
@Test
public void updatePetTestXml() throws Exception {
String contentType = "application/xml";
String accept = "application/xml";
String url = API_URL + "/pet";
HttpRequest httpRequest = Unirest.put(url);
httpRequest = httpRequest.header("Content-Type", contentType);
httpRequest = httpRequest.header("Accept", accept);
String requestBody = "<Pet> <id>123456789</id> <name>doggie</name> <photoUrls> <photoUrls>aeiou</photoUrls> </photoUrls> <tags> </tags> <status>aeiou</status> </Pet>";
httpRequest = ((HttpRequestWithBody) httpRequest).body(requestBody).getHttpRequest();
HttpResponse<String> httpResponse = httpRequest.asString();
Assertions.assertTrue(httpResponse.getStatus() < 400 || httpResponse.getStatus() == 415);
}
}

View File

@@ -0,0 +1,84 @@
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (5.4.0-SNAPSHOT).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.api;
import org.junit.jupiter.api.Test;
import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
import org.springframework.boot.test.context.SpringBootTest;
import com.mashape.unirest.request.HttpRequest;
import com.mashape.unirest.request.HttpRequestWithBody;
import com.mashape.unirest.http.Unirest;
import com.mashape.unirest.http.JsonNode;
import com.mashape.unirest.http.HttpResponse;
import java.io.InputStream;
import org.junit.jupiter.api.Assertions;
@CamelSpringBootTest
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
public class StoreApiTest {
private static final String API_URL = "http://127.0.0.1:8080/api/v1";
@Test
public void getOrderByIdTestJson() throws Exception {
String contentType = "application/json";
String accept = "application/json";
String url = API_URL + "/store/order/{orderId}";
HttpRequest httpRequest = Unirest.get(url);
httpRequest = httpRequest.header("Accept", accept);
httpRequest = httpRequest.routeParam("orderId", "1");
HttpResponse<JsonNode> httpResponse = httpRequest.asJson();
Assertions.assertTrue(httpResponse.getStatus() < 400 || httpResponse.getStatus() == 415);
}
@Test
public void getOrderByIdTestXml() throws Exception {
String contentType = "application/xml";
String accept = "application/xml";
String url = API_URL + "/store/order/{orderId}";
HttpRequest httpRequest = Unirest.get(url);
httpRequest = httpRequest.header("Accept", accept);
httpRequest = httpRequest.routeParam("orderId", "1");
HttpResponse<String> httpResponse = httpRequest.asString();
Assertions.assertTrue(httpResponse.getStatus() < 400 || httpResponse.getStatus() == 415);
}
@Test
public void placeOrderTestJson() throws Exception {
String contentType = "application/json";
String accept = "application/json";
String url = API_URL + "/store/order";
HttpRequest httpRequest = Unirest.post(url);
httpRequest = httpRequest.header("Content-Type", contentType);
httpRequest = httpRequest.header("Accept", accept);
String requestBody = "{ \"petId\" : 6, \"quantity\" : 1, \"id\" : 0, \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\", \"complete\" : false, \"status\" : \"placed\" }";
httpRequest = ((HttpRequestWithBody) httpRequest).body(requestBody).getHttpRequest();
HttpResponse<JsonNode> httpResponse = httpRequest.asJson();
Assertions.assertTrue(httpResponse.getStatus() < 400 || httpResponse.getStatus() == 415);
}
@Test
public void placeOrderTestXml() throws Exception {
String contentType = "application/xml";
String accept = "application/xml";
String url = API_URL + "/store/order";
HttpRequest httpRequest = Unirest.post(url);
httpRequest = httpRequest.header("Content-Type", contentType);
httpRequest = httpRequest.header("Accept", accept);
String requestBody = "<Order> <id>123456789</id> <petId>123456789</petId> <quantity>123</quantity> <shipDate>2000-01-23T04:56:07.000Z</shipDate> <status>aeiou</status> <complete>true</complete> </Order>";
httpRequest = ((HttpRequestWithBody) httpRequest).body(requestBody).getHttpRequest();
HttpResponse<String> httpResponse = httpRequest.asString();
Assertions.assertTrue(httpResponse.getStatus() < 400 || httpResponse.getStatus() == 415);
}
}

View File

@@ -0,0 +1,51 @@
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (5.4.0-SNAPSHOT).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.api;
import org.junit.jupiter.api.Test;
import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
import org.springframework.boot.test.context.SpringBootTest;
import com.mashape.unirest.request.HttpRequest;
import com.mashape.unirest.request.HttpRequestWithBody;
import com.mashape.unirest.http.Unirest;
import com.mashape.unirest.http.JsonNode;
import com.mashape.unirest.http.HttpResponse;
import java.io.InputStream;
import org.junit.jupiter.api.Assertions;
@CamelSpringBootTest
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
public class UserApiTest {
private static final String API_URL = "http://127.0.0.1:8080/api/v1";
@Test
public void getUserByNameTestJson() throws Exception {
String contentType = "application/json";
String accept = "application/json";
String url = API_URL + "/user/{username}";
HttpRequest httpRequest = Unirest.get(url);
httpRequest = httpRequest.header("Accept", accept);
httpRequest = httpRequest.routeParam("username", "1");
HttpResponse<JsonNode> httpResponse = httpRequest.asJson();
Assertions.assertTrue(httpResponse.getStatus() < 400 || httpResponse.getStatus() == 415);
}
@Test
public void getUserByNameTestXml() throws Exception {
String contentType = "application/xml";
String accept = "application/xml";
String url = API_URL + "/user/{username}";
HttpRequest httpRequest = Unirest.get(url);
httpRequest = httpRequest.header("Accept", accept);
httpRequest = httpRequest.routeParam("username", "1");
HttpResponse<String> httpResponse = httpRequest.asString();
Assertions.assertTrue(httpResponse.getStatus() < 400 || httpResponse.getStatus() == 415);
}
}