forked from loafle/openapi-generator-original
JAX-RS/CXF 1158 Options to generate fully functional method bodies passing fully populated test data (#1879)
* add option to generate alias as model * [JAXRS/CXF] Emit method bodies, test data (#1158) New jaxrs-cxf-extended generator with options: - supportMultipleSpringServices Support generation of Spring services from multiple specifications - generateOperationBody (boolean) Enables generation of fully functional test/service method bodies that pass/return random but valid values & models. - loadTestDataFromFile (boolean) When true, generated method bodies load test data from a generated JSON file. When false, generated method bodies contain inline code to construct the test data. - testDataFile (string) The path of a JSON file to contain generated test data. The file is initially generated but editable; edits are preserved by subsequent generations. - testDataControlFile (string) The path of a JSON file to control test data generation - specifically, to control the number of items required in array properties, structured by API class / operation name / parameter name. The file is initially generated but editable; edits are preserved by subsequent generations. - tests for the jaxrs-cxf-extended generator, including the new options Bug fixes: - fix bug (DefaultGenerator): handle absolute paths in supporting file spec - fix bug (DefaultCodegen): process enums in allVars - fix bug (AbstractJavaCodegen): support multiple inheritance via allOf (inheritance code deleted, as a subsequent pull broke it) - fix bug (JavaCXFServerCodegen): use operationId instead of nickname (gets out of step with duplicate operationIds) - fix bug (JavaCXFServerCodegen): set appropriate default consumes/produces for operations with body parameters or non-void returns (CXF providers don't handle */*) - fix indentation (DefaultCodegen) - add support for a system property openapitools.implementation.version to specify the package implementation version when running non-JAR'd classes in an IDE (otherwise {{{generatorVersion}}} evaluates to 'unset'. * reformat code * make sh executable * fix template folder * fix template folder, update samples * run test data manually to avoid ci failure
This commit is contained in:
parent
37c890f755
commit
2985c0f0b8
@ -17,3 +17,5 @@
|
|||||||
./bin/jaxrs-spec-petstore-server-interface.sh
|
./bin/jaxrs-spec-petstore-server-interface.sh
|
||||||
./bin/jaxrs-spec-petstore-server.sh
|
./bin/jaxrs-spec-petstore-server.sh
|
||||||
./bin/jaxrs-usetags-petstore-server.sh
|
./bin/jaxrs-usetags-petstore-server.sh
|
||||||
|
|
||||||
|
echo " Please run ./bin/jaxrs-cxf-petstore-server-test-data.sh manually instead"
|
||||||
|
32
bin/jaxrs-cxf-petstore-server-test-data.sh
Executable file
32
bin/jaxrs-cxf-petstore-server-test-data.sh
Executable file
@ -0,0 +1,32 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
SCRIPT="$0"
|
||||||
|
echo "# START SCRIPT: $SCRIPT"
|
||||||
|
|
||||||
|
while [ -h "$SCRIPT" ] ; do
|
||||||
|
ls=`ls -ld "$SCRIPT"`
|
||||||
|
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||||
|
if expr "$link" : '/.*' > /dev/null; then
|
||||||
|
SCRIPT="$link"
|
||||||
|
else
|
||||||
|
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ ! -d "${APP_DIR}" ]; then
|
||||||
|
APP_DIR=`dirname "$SCRIPT"`/..
|
||||||
|
APP_DIR=`cd "${APP_DIR}"; pwd`
|
||||||
|
fi
|
||||||
|
|
||||||
|
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
||||||
|
|
||||||
|
if [ ! -f "$executable" ]
|
||||||
|
then
|
||||||
|
mvn -B clean package
|
||||||
|
fi
|
||||||
|
|
||||||
|
# if you've executed sbt assembly previously it will use that instead.
|
||||||
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
|
ags="generate --artifact-id cxf-test-data -t modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g jaxrs-cxf-extended -o samples/server/petstore/jaxrs-cxf-test-data -DhideGenerationTimestamp=true -DuseAnnotatedBasePath=true --generate-alias-as-model --additional-properties java8=true,generateSpringApplication=true,generateSpringBootApplication=true,generateOperationBody=true,loadTestDataFromFile=true $@"
|
||||||
|
|
||||||
|
java $JAVA_OPTS -jar $executable $ags
|
10
bin/windows/jaxrs-cxf-cdi-petstore-server.bat
Normal file
10
bin/windows/jaxrs-cxf-cdi-petstore-server.bat
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
set executable=.\modules\openapi-generator-cli\target\openapi-generator-cli.jar
|
||||||
|
|
||||||
|
If Not Exist %executable% (
|
||||||
|
mvn clean package
|
||||||
|
)
|
||||||
|
|
||||||
|
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf\log4j.properties
|
||||||
|
set ags=generate -t modules\openapi-generator\src\main\resources\JavaJaxRS\cxf-cdi -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g jaxrs-cxf-cdi -o samples\server\petstore\jaxrs-cxf-cdi -DhideGenerationTimestamp=true %*
|
||||||
|
|
||||||
|
java %JAVA_OPTS% -jar %executable% %ags%
|
@ -5,6 +5,6 @@ If Not Exist %executable% (
|
|||||||
)
|
)
|
||||||
|
|
||||||
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties
|
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties
|
||||||
set ags=generate --artifact-id "jaxrs-cxf-client-petstore-client" -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g jaxrs-cxf-client -o samples\client\petstore\jaxrs-cxf-client
|
set ags=generate --artifact-id "jaxrs-cxf-client-petstore-client" -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g jaxrs-cxf-client -o samples\client\petstore\jaxrs-cxf-client %*
|
||||||
|
|
||||||
java %JAVA_OPTS% -jar %executable% %ags%
|
java %JAVA_OPTS% -jar %executable% %ags%
|
||||||
|
@ -0,0 +1,10 @@
|
|||||||
|
set executable=.\modules\openapi-generator-cli\target\openapi-generator-cli.jar
|
||||||
|
|
||||||
|
If Not Exist %executable% (
|
||||||
|
mvn clean package
|
||||||
|
)
|
||||||
|
|
||||||
|
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties
|
||||||
|
set ags=generate --artifact-id cxf-annotated-basepath -t modules\openapi-generator\src\main\resources\JavaJaxRS\cxf -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g jaxrs-cxf -o samples\server\petstore\jaxrs-cxf-annotated-base-path -DhideGenerationTimestamp=true,useAnnotatedBasePath=true --additional-properties serverPort=8082 %*
|
||||||
|
|
||||||
|
java %JAVA_OPTS% -jar %executable% %ags%
|
@ -0,0 +1,10 @@
|
|||||||
|
set executable=.\modules\openapi-generator-cli\target\openapi-generator-cli.jar
|
||||||
|
|
||||||
|
If Not Exist %executable% (
|
||||||
|
mvn clean package
|
||||||
|
)
|
||||||
|
|
||||||
|
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties
|
||||||
|
set ags=generate --artifact-id cxf-server-non-spring -t modules\openapi-generator\src\main\resources\JavaJaxRS\cxf -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g jaxrs-cxf -o samples\server\petstore\jaxrs-cxf-non-spring-app -DhideGenerationTimestamp=true,generateNonSpringApplication=true --additional-properties serverPort=8082 %*
|
||||||
|
|
||||||
|
java %JAVA_OPTS% -jar %executable% %ags%
|
10
bin/windows/jaxrs-cxf-petstore-server-test-data.bat
Normal file
10
bin/windows/jaxrs-cxf-petstore-server-test-data.bat
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
set executable=.\modules\openapi-generator-cli\target\openapi-generator-cli.jar
|
||||||
|
|
||||||
|
If Not Exist %executable% (
|
||||||
|
mvn clean package
|
||||||
|
)
|
||||||
|
|
||||||
|
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties
|
||||||
|
set ags=generate --artifact-id cxf-test-data -t modules\openapi-generator\src\main\resources\JavaJaxRS\cxf-ext -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g jaxrs-cxf-extended -o samples\server\petstore\jaxrs-cxf-test-data -DhideGenerationTimestamp=true -DuseAnnotatedBasePath=true --generate-alias-as-model --additional-properties java8=true,generateSpringApplication=true,generateSpringBootApplication=true,generateOperationBody=true,loadTestDataFromFile=true %*
|
||||||
|
|
||||||
|
java %JAVA_OPTS% -jar %executable% %ags%
|
@ -5,6 +5,6 @@ If Not Exist %executable% (
|
|||||||
)
|
)
|
||||||
|
|
||||||
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties
|
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties
|
||||||
set ags=generate -t modules\openapi-generator\src\main\resources\JavaJaxRS\cxf -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g jaxrs-cxf -o samples\server\petstore\jaxrs-cxf -DhideGenerationTimestamp=true
|
set ags=generate -t modules\openapi-generator\src\main\resources\JavaJaxRS\cxf -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g jaxrs-cxf -o samples\server\petstore\jaxrs-cxf -DhideGenerationTimestamp=true %*
|
||||||
|
|
||||||
java %JAVA_OPTS% -jar %executable% %ags%
|
java %JAVA_OPTS% -jar %executable% %ags%
|
||||||
|
@ -83,6 +83,7 @@ The following generators are available:
|
|||||||
- [java-vertx](generators/java-vertx.md)
|
- [java-vertx](generators/java-vertx.md)
|
||||||
- [jaxrs-cxf](generators/jaxrs-cxf.md)
|
- [jaxrs-cxf](generators/jaxrs-cxf.md)
|
||||||
- [jaxrs-cxf-cdi](generators/jaxrs-cxf-cdi.md)
|
- [jaxrs-cxf-cdi](generators/jaxrs-cxf-cdi.md)
|
||||||
|
- [jaxrs-cxf-extended](generators/jaxrs-cxf-extended.md)
|
||||||
- [jaxrs-jersey](generators/jaxrs-jersey.md)
|
- [jaxrs-jersey](generators/jaxrs-jersey.md)
|
||||||
- [jaxrs-resteasy](generators/jaxrs-resteasy.md)
|
- [jaxrs-resteasy](generators/jaxrs-resteasy.md)
|
||||||
- [jaxrs-resteasy-eap](generators/jaxrs-resteasy-eap.md)
|
- [jaxrs-resteasy-eap](generators/jaxrs-resteasy-eap.md)
|
||||||
|
70
docs/generators/jaxrs-cxf-extended.md
Normal file
70
docs/generators/jaxrs-cxf-extended.md
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
|
||||||
|
---
|
||||||
|
id: generator-opts-server-jaxrs-cxf-extended
|
||||||
|
title: Config Options for jaxrs-cxf-extended
|
||||||
|
sidebar_label: jaxrs-cxf-extended
|
||||||
|
---
|
||||||
|
|
||||||
|
| Option | Description | Values | Default |
|
||||||
|
| ------ | ----------- | ------ | ------- |
|
||||||
|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|
||||||
|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|
||||||
|
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|
||||||
|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|
||||||
|
|modelPackage|package for generated models| |null|
|
||||||
|
|apiPackage|package for generated api classes| |null|
|
||||||
|
|invokerPackage|root package for generated code| |null|
|
||||||
|
|groupId|groupId in generated pom.xml| |null|
|
||||||
|
|artifactId|artifactId in generated pom.xml| |null|
|
||||||
|
|artifactVersion|artifact version in generated pom.xml| |null|
|
||||||
|
|artifactUrl|artifact URL in generated pom.xml| |null|
|
||||||
|
|artifactDescription|artifact description in generated pom.xml| |null|
|
||||||
|
|scmConnection|SCM connection in generated pom.xml| |null|
|
||||||
|
|scmDeveloperConnection|SCM developer connection in generated pom.xml| |null|
|
||||||
|
|scmUrl|SCM URL in generated pom.xml| |null|
|
||||||
|
|developerName|developer name in generated pom.xml| |null|
|
||||||
|
|developerEmail|developer email in generated pom.xml| |null|
|
||||||
|
|developerOrganization|developer organization in generated pom.xml| |null|
|
||||||
|
|developerOrganizationUrl|developer organization URL in generated pom.xml| |null|
|
||||||
|
|licenseName|The name of the license| |null|
|
||||||
|
|licenseUrl|The URL of the license| |null|
|
||||||
|
|sourceFolder|source folder for generated code| |null|
|
||||||
|
|serializableModel|boolean - toggle "implements Serializable" for generated models| |false|
|
||||||
|
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||||
|
|fullJavaUtil|whether to use fully qualified name for classes under java.util. This option only works for Java API client| |false|
|
||||||
|
|hideGenerationTimestamp|hides the timestamp when files were generated| |null|
|
||||||
|
|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|
|
||||||
|
|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 "java8" to true</dd><dt>**threetenbp**</dt><dd>Backport of JSR310 (preferred for jdk < 1.8)</dd><dl>|null|
|
||||||
|
|java8|Option. Use Java8 classes instead of third party equivalents|<dl><dt>**true**</dt><dd>Use Java 8 classes such as Base64</dd><dt>**false**</dt><dd>Various third party libraries as needed</dd><dl>|null|
|
||||||
|
|disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false|
|
||||||
|
|booleanGetterPrefix|Set booleanGetterPrefix (default value 'get')| |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|
|
||||||
|
|parentArtifactId|parent artifactId 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|
|
||||||
|
|snapshotVersion|Uses a SNAPSHOT version.| |null|
|
||||||
|
|implFolder|folder for generated implementation code| |null|
|
||||||
|
|title|a title describing the application| |null|
|
||||||
|
|useBeanValidation|Use BeanValidation API annotations| |true|
|
||||||
|
|serverPort|The port on which the server should be started| |null|
|
||||||
|
|generateSpringApplication|Generate Spring application| |false|
|
||||||
|
|useSpringAnnotationConfig|Use Spring Annotation Config| |false|
|
||||||
|
|useSwaggerFeature|Use Swagger Feature| |false|
|
||||||
|
|useSwaggerUI|Use Swagger UI| |false|
|
||||||
|
|useWadlFeature|Use WADL Feature| |false|
|
||||||
|
|useMultipartFeature|Use Multipart Feature| |false|
|
||||||
|
|useGzipFeature|Use Gzip Feature| |false|
|
||||||
|
|useGzipFeatureForTests|Use Gzip Feature for tests| |false|
|
||||||
|
|useBeanValidationFeature|Use BeanValidation Feature| |false|
|
||||||
|
|useLoggingFeature|Use Logging Feature| |false|
|
||||||
|
|useLoggingFeatureForTests|Use Logging Feature for tests| |false|
|
||||||
|
|generateSpringBootApplication|Generate Spring Boot application| |false|
|
||||||
|
|generateJbossDeploymentDescriptor|Generate Jboss Deployment Descriptor| |false|
|
||||||
|
|addConsumesProducesJson|Add @Consumes/@Produces Json to API interface| |false|
|
||||||
|
|useAnnotatedBasePath|Use @Path annotations for basePath| |false|
|
||||||
|
|generateNonSpringApplication|Generate non-Spring application| |false|
|
||||||
|
|useGenericResponse|Use generic response| |false|
|
||||||
|
|supportMultipleSpringServices|Support generation of Spring services from multiple specifications| |false|
|
||||||
|
|generateOperationBody|Generate fully functional operation bodies| |false|
|
||||||
|
|loadTestDataFromFile|Load test data from a generated JSON file| |false|
|
||||||
|
|testDataFile|JSON file to contain generated test data| |null|
|
||||||
|
|testDataControlFile|JSON file to control test data generation| |null|
|
@ -196,6 +196,9 @@
|
|||||||
<properties>
|
<properties>
|
||||||
<diffutils-version>1.3.0</diffutils-version>
|
<diffutils-version>1.3.0</diffutils-version>
|
||||||
<guava-version>26.0-jre</guava-version>
|
<guava-version>26.0-jre</guava-version>
|
||||||
|
<generex-version>1.0.2</generex-version>
|
||||||
|
<jackson-version>2.9.5</jackson-version>
|
||||||
|
<jackson-threetenbp-version>2.6.4</jackson-threetenbp-version>
|
||||||
</properties>
|
</properties>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -278,6 +281,26 @@
|
|||||||
<version>2.23.0</version>
|
<version>2.23.0</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.mifmif</groupId>
|
||||||
|
<artifactId>generex</artifactId>
|
||||||
|
<version>${generex-version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||||
|
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||||
|
<version>${jackson-version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||||
|
<artifactId>jackson-datatype-joda</artifactId>
|
||||||
|
<version>${jackson-version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.joschi.jackson</groupId>
|
||||||
|
<artifactId>jackson-datatype-threetenbp</artifactId>
|
||||||
|
<version>${jackson-threetenbp-version}</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
|
@ -1875,7 +1875,6 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
return camelize(toVarName(name));
|
return camelize(toVarName(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert OAS Property object to Codegen Property object
|
* Convert OAS Property object to Codegen Property object
|
||||||
*
|
*
|
||||||
@ -2217,7 +2216,6 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
return currentProperty == null ? new HashMap<String, Object>() : currentProperty.allowableValues;
|
return currentProperty == null ? new HashMap<String, Object>() : currentProperty.allowableValues;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update datatypeWithEnum for array container
|
* Update datatypeWithEnum for array container
|
||||||
*
|
*
|
||||||
@ -2881,7 +2879,6 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
codegenParameter.isContainer = true;
|
codegenParameter.isContainer = true;
|
||||||
codegenParameter.isListContainer = true;
|
codegenParameter.isListContainer = true;
|
||||||
|
|
||||||
|
|
||||||
// recursively add import
|
// recursively add import
|
||||||
while (codegenProperty != null) {
|
while (codegenProperty != null) {
|
||||||
imports.add(codegenProperty.baseType);
|
imports.add(codegenProperty.baseType);
|
||||||
@ -3095,7 +3092,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
codegenParameter.paramName = "UNKNOWN_PARAMETER_NAME";
|
codegenParameter.paramName = "UNKNOWN_PARAMETER_NAME";
|
||||||
}
|
}
|
||||||
|
|
||||||
// set the parameter excample value
|
// set the parameter example value
|
||||||
// should be overridden by lang codegen
|
// should be overridden by lang codegen
|
||||||
setParameterExampleValue(codegenParameter, parameter);
|
setParameterExampleValue(codegenParameter, parameter);
|
||||||
|
|
||||||
@ -3309,8 +3306,8 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
Header header = ModelUtils.getReferencedHeader(this.openAPI, headerEntry.getValue());
|
Header header = ModelUtils.getReferencedHeader(this.openAPI, headerEntry.getValue());
|
||||||
|
|
||||||
Schema schema;
|
Schema schema;
|
||||||
if(header.getSchema() == null) {
|
if (header.getSchema() == null) {
|
||||||
LOGGER.warn("No schema defined for Header '" + headerEntry.getKey() +"', using a String schema");
|
LOGGER.warn("No schema defined for Header '" + headerEntry.getKey() + "', using a String schema");
|
||||||
schema = new StringSchema();
|
schema = new StringSchema();
|
||||||
} else {
|
} else {
|
||||||
schema = header.getSchema();
|
schema = header.getSchema();
|
||||||
@ -3374,7 +3371,6 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
co.baseName = tag;
|
co.baseName = tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void addParentContainer(CodegenModel model, String name, Schema schema) {
|
private void addParentContainer(CodegenModel model, String name, Schema schema) {
|
||||||
final CodegenProperty property = fromProperty(name, schema);
|
final CodegenProperty property = fromProperty(name, schema);
|
||||||
addImport(model, property.complexType);
|
addImport(model, property.complexType);
|
||||||
@ -3770,7 +3766,6 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
this.docExtension = userDocExtension;
|
this.docExtension = userDocExtension;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set HTTP user agent.
|
* Set HTTP user agent.
|
||||||
*
|
*
|
||||||
@ -3976,7 +3971,6 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update codegen property's enum by adding "enumVars" (with name and value)
|
* Update codegen property's enum by adding "enumVars" (with name and value)
|
||||||
*
|
*
|
||||||
@ -4029,7 +4023,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
}
|
}
|
||||||
// if "x-enum-varnames" or "x-enum-descriptions" defined, update varnames
|
// if "x-enum-varnames" or "x-enum-descriptions" defined, update varnames
|
||||||
Map<String, Object> extensions = var.mostInnerItems != null ? var.mostInnerItems.getVendorExtensions() : var.getVendorExtensions();
|
Map<String, Object> extensions = var.mostInnerItems != null ? var.mostInnerItems.getVendorExtensions() : var.getVendorExtensions();
|
||||||
if(referencedSchema.isPresent()) {
|
if (referencedSchema.isPresent()) {
|
||||||
extensions = referencedSchema.get().getExtensions();
|
extensions = referencedSchema.get().getExtensions();
|
||||||
}
|
}
|
||||||
updateEnumVarsWithExtensions(enumVars, extensions);
|
updateEnumVarsWithExtensions(enumVars, extensions);
|
||||||
@ -4039,7 +4033,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
if (var.defaultValue != null) {
|
if (var.defaultValue != null) {
|
||||||
String enumName = null;
|
String enumName = null;
|
||||||
final String enumDefaultValue;
|
final String enumDefaultValue;
|
||||||
if("string".equalsIgnoreCase(dataType)) {
|
if ("string".equalsIgnoreCase(dataType)) {
|
||||||
enumDefaultValue = toEnumValue(var.defaultValue, dataType);
|
enumDefaultValue = toEnumValue(var.defaultValue, dataType);
|
||||||
} else {
|
} else {
|
||||||
enumDefaultValue = var.defaultValue;
|
enumDefaultValue = var.defaultValue;
|
||||||
|
@ -153,7 +153,6 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
|||||||
generateApiTests = GeneratorProperties.getProperty(CodegenConstants.API_TESTS) != null ? Boolean.valueOf(GeneratorProperties.getProperty(CodegenConstants.API_TESTS)) : getGeneratorPropertyDefaultSwitch(CodegenConstants.API_TESTS, true);
|
generateApiTests = GeneratorProperties.getProperty(CodegenConstants.API_TESTS) != null ? Boolean.valueOf(GeneratorProperties.getProperty(CodegenConstants.API_TESTS)) : getGeneratorPropertyDefaultSwitch(CodegenConstants.API_TESTS, true);
|
||||||
generateApiDocumentation = GeneratorProperties.getProperty(CodegenConstants.API_DOCS) != null ? Boolean.valueOf(GeneratorProperties.getProperty(CodegenConstants.API_DOCS)) : getGeneratorPropertyDefaultSwitch(CodegenConstants.API_DOCS, true);
|
generateApiDocumentation = GeneratorProperties.getProperty(CodegenConstants.API_DOCS) != null ? Boolean.valueOf(GeneratorProperties.getProperty(CodegenConstants.API_DOCS)) : getGeneratorPropertyDefaultSwitch(CodegenConstants.API_DOCS, true);
|
||||||
|
|
||||||
|
|
||||||
// Additional properties added for tests to exclude references in project related files
|
// Additional properties added for tests to exclude references in project related files
|
||||||
config.additionalProperties().put(CodegenConstants.GENERATE_API_TESTS, generateApiTests);
|
config.additionalProperties().put(CodegenConstants.GENERATE_API_TESTS, generateApiTests);
|
||||||
config.additionalProperties().put(CodegenConstants.GENERATE_MODEL_TESTS, generateModelTests);
|
config.additionalProperties().put(CodegenConstants.GENERATE_MODEL_TESTS, generateModelTests);
|
||||||
@ -627,7 +626,6 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (generateApiDocumentation) {
|
if (generateApiDocumentation) {
|
||||||
// to generate api documentation files
|
// to generate api documentation files
|
||||||
for (String templateName : config.apiDocTemplateFiles().keySet()) {
|
for (String templateName : config.apiDocTemplateFiles().keySet()) {
|
||||||
@ -678,7 +676,9 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
|||||||
if (!of.isDirectory()) {
|
if (!of.isDirectory()) {
|
||||||
of.mkdirs();
|
of.mkdirs();
|
||||||
}
|
}
|
||||||
String outputFilename = outputFolder + File.separator + support.destinationFilename.replace('/', File.separatorChar);
|
String outputFilename = new File(support.destinationFilename).isAbsolute() // split
|
||||||
|
? support.destinationFilename
|
||||||
|
: outputFolder + File.separator + support.destinationFilename.replace('/', File.separatorChar);
|
||||||
if (!config.shouldOverwrite(outputFilename)) {
|
if (!config.shouldOverwrite(outputFilename)) {
|
||||||
LOGGER.info("Skipped overwriting " + outputFilename);
|
LOGGER.info("Skipped overwriting " + outputFilename);
|
||||||
continue;
|
continue;
|
||||||
@ -910,7 +910,6 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
|||||||
return files;
|
return files;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected File processTemplateToFile(Map<String, Object> templateData, String templateName, String outputFilename) throws IOException {
|
protected File processTemplateToFile(Map<String, Object> templateData, String templateName, String outputFilename) throws IOException {
|
||||||
String adjustedOutputFilename = outputFilename.replaceAll("//", "/").replace('/', File.separatorChar);
|
String adjustedOutputFilename = outputFilename.replaceAll("//", "/").replace('/', File.separatorChar);
|
||||||
if (ignoreProcessor.allowsFile(new File(adjustedOutputFilename))) {
|
if (ignoreProcessor.allowsFile(new File(adjustedOutputFilename))) {
|
||||||
@ -1059,7 +1058,6 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
|||||||
return parameter.getName() + ":" + parameter.getIn();
|
return parameter.getName() + ":" + parameter.getIn();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private Map<String, Object> processOperations(CodegenConfig config, String tag, List<CodegenOperation> ops, List<Object> allModels) {
|
private Map<String, Object> processOperations(CodegenConfig config, String tag, List<CodegenOperation> ops, List<Object> allModels) {
|
||||||
Map<String, Object> operations = new HashMap<String, Object>();
|
Map<String, Object> operations = new HashMap<String, Object>();
|
||||||
Map<String, Object> objs = new HashMap<String, Object>();
|
Map<String, Object> objs = new HashMap<String, Object>();
|
||||||
@ -1125,7 +1123,6 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
|||||||
return operations;
|
return operations;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private Map<String, Object> processModels(CodegenConfig config, Map<String, Schema> definitions) {
|
private Map<String, Object> processModels(CodegenConfig config, Map<String, Schema> definitions) {
|
||||||
Map<String, Object> objs = new HashMap<String, Object>();
|
Map<String, Object> objs = new HashMap<String, Object>();
|
||||||
objs.put("package", config.modelPackage());
|
objs.put("package", config.modelPackage());
|
||||||
|
@ -85,7 +85,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
|||||||
protected boolean serializeBigDecimalAsString = false;
|
protected boolean serializeBigDecimalAsString = false;
|
||||||
protected String apiDocPath = "docs/";
|
protected String apiDocPath = "docs/";
|
||||||
protected String modelDocPath = "docs/";
|
protected String modelDocPath = "docs/";
|
||||||
protected boolean supportJava6= false;
|
protected boolean supportJava6 = false;
|
||||||
protected boolean disableHtmlEscaping = false;
|
protected boolean disableHtmlEscaping = false;
|
||||||
protected String booleanGetterPrefix = BOOLEAN_GETTER_PREFIX_DEFAULT;
|
protected String booleanGetterPrefix = BOOLEAN_GETTER_PREFIX_DEFAULT;
|
||||||
protected boolean useNullForUnknownEnumValue = false;
|
protected boolean useNullForUnknownEnumValue = false;
|
||||||
@ -187,7 +187,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
|||||||
|
|
||||||
cliOptions.add(CliOption.newBoolean(DISABLE_HTML_ESCAPING, "Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)"));
|
cliOptions.add(CliOption.newBoolean(DISABLE_HTML_ESCAPING, "Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)"));
|
||||||
cliOptions.add(CliOption.newString(BOOLEAN_GETTER_PREFIX, "Set booleanGetterPrefix (default value '" + BOOLEAN_GETTER_PREFIX_DEFAULT + "')"));
|
cliOptions.add(CliOption.newString(BOOLEAN_GETTER_PREFIX, "Set booleanGetterPrefix (default value '" + BOOLEAN_GETTER_PREFIX_DEFAULT + "')"));
|
||||||
|
|
||||||
cliOptions.add(CliOption.newString(CodegenConstants.PARENT_GROUP_ID, CodegenConstants.PARENT_GROUP_ID_DESC));
|
cliOptions.add(CliOption.newString(CodegenConstants.PARENT_GROUP_ID, CodegenConstants.PARENT_GROUP_ID_DESC));
|
||||||
cliOptions.add(CliOption.newString(CodegenConstants.PARENT_ARTIFACT_ID, CodegenConstants.PARENT_ARTIFACT_ID_DESC));
|
cliOptions.add(CliOption.newString(CodegenConstants.PARENT_ARTIFACT_ID, CodegenConstants.PARENT_ARTIFACT_ID_DESC));
|
||||||
cliOptions.add(CliOption.newString(CodegenConstants.PARENT_VERSION, CodegenConstants.PARENT_VERSION_DESC));
|
cliOptions.add(CliOption.newString(CodegenConstants.PARENT_VERSION, CodegenConstants.PARENT_VERSION_DESC));
|
||||||
@ -226,16 +226,16 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
|||||||
this.setInvokerPackage((String) additionalProperties.get(CodegenConstants.INVOKER_PACKAGE));
|
this.setInvokerPackage((String) additionalProperties.get(CodegenConstants.INVOKER_PACKAGE));
|
||||||
} else if (additionalProperties.containsKey(CodegenConstants.API_PACKAGE)) {
|
} else if (additionalProperties.containsKey(CodegenConstants.API_PACKAGE)) {
|
||||||
// guess from api package
|
// guess from api package
|
||||||
String derviedInvokerPackage = deriveInvokerPackageName((String) additionalProperties.get(CodegenConstants.API_PACKAGE));
|
String derivedInvokerPackage = deriveInvokerPackageName((String) additionalProperties.get(CodegenConstants.API_PACKAGE));
|
||||||
this.additionalProperties.put(CodegenConstants.INVOKER_PACKAGE, derviedInvokerPackage);
|
this.additionalProperties.put(CodegenConstants.INVOKER_PACKAGE, derivedInvokerPackage);
|
||||||
this.setInvokerPackage((String) additionalProperties.get(CodegenConstants.INVOKER_PACKAGE));
|
this.setInvokerPackage((String) additionalProperties.get(CodegenConstants.INVOKER_PACKAGE));
|
||||||
LOGGER.info("Invoker Package Name, originally not set, is now dervied from api package name: " + derviedInvokerPackage);
|
LOGGER.info("Invoker Package Name, originally not set, is now derived from api package name: " + derivedInvokerPackage);
|
||||||
} else if (additionalProperties.containsKey(CodegenConstants.MODEL_PACKAGE)) {
|
} else if (additionalProperties.containsKey(CodegenConstants.MODEL_PACKAGE)) {
|
||||||
// guess from model package
|
// guess from model package
|
||||||
String derviedInvokerPackage = deriveInvokerPackageName((String) additionalProperties.get(CodegenConstants.MODEL_PACKAGE));
|
String derivedInvokerPackage = deriveInvokerPackageName((String) additionalProperties.get(CodegenConstants.MODEL_PACKAGE));
|
||||||
this.additionalProperties.put(CodegenConstants.INVOKER_PACKAGE, derviedInvokerPackage);
|
this.additionalProperties.put(CodegenConstants.INVOKER_PACKAGE, derivedInvokerPackage);
|
||||||
this.setInvokerPackage((String) additionalProperties.get(CodegenConstants.INVOKER_PACKAGE));
|
this.setInvokerPackage((String) additionalProperties.get(CodegenConstants.INVOKER_PACKAGE));
|
||||||
LOGGER.info("Invoker Package Name, originally not set, is now dervied from model package name: " + derviedInvokerPackage);
|
LOGGER.info("Invoker Package Name, originally not set, is now derived from model package name: " + derivedInvokerPackage);
|
||||||
} else {
|
} else {
|
||||||
//not set, use default to be passed to template
|
//not set, use default to be passed to template
|
||||||
additionalProperties.put(CodegenConstants.INVOKER_PACKAGE, invokerPackage);
|
additionalProperties.put(CodegenConstants.INVOKER_PACKAGE, invokerPackage);
|
||||||
@ -380,19 +380,19 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
|||||||
this.setWithXml(Boolean.valueOf(additionalProperties.get(WITH_XML).toString()));
|
this.setWithXml(Boolean.valueOf(additionalProperties.get(WITH_XML).toString()));
|
||||||
}
|
}
|
||||||
additionalProperties.put(WITH_XML, withXml);
|
additionalProperties.put(WITH_XML, withXml);
|
||||||
|
|
||||||
if (additionalProperties.containsKey(CodegenConstants.PARENT_GROUP_ID)) {
|
if (additionalProperties.containsKey(CodegenConstants.PARENT_GROUP_ID)) {
|
||||||
this.setParentGroupId((String) additionalProperties.get(CodegenConstants.PARENT_GROUP_ID));
|
this.setParentGroupId((String) additionalProperties.get(CodegenConstants.PARENT_GROUP_ID));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (additionalProperties.containsKey(CodegenConstants.PARENT_ARTIFACT_ID)) {
|
if (additionalProperties.containsKey(CodegenConstants.PARENT_ARTIFACT_ID)) {
|
||||||
this.setParentArtifactId((String) additionalProperties.get(CodegenConstants.PARENT_ARTIFACT_ID));
|
this.setParentArtifactId((String) additionalProperties.get(CodegenConstants.PARENT_ARTIFACT_ID));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (additionalProperties.containsKey(CodegenConstants.PARENT_VERSION)) {
|
if (additionalProperties.containsKey(CodegenConstants.PARENT_VERSION)) {
|
||||||
this.setParentVersion((String) additionalProperties.get(CodegenConstants.PARENT_VERSION));
|
this.setParentVersion((String) additionalProperties.get(CodegenConstants.PARENT_VERSION));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!StringUtils.isEmpty(parentGroupId) && !StringUtils.isEmpty(parentArtifactId) && !StringUtils.isEmpty(parentVersion)) {
|
if (!StringUtils.isEmpty(parentGroupId) && !StringUtils.isEmpty(parentArtifactId) && !StringUtils.isEmpty(parentVersion)) {
|
||||||
additionalProperties.put("parentOverridden", true);
|
additionalProperties.put("parentOverridden", true);
|
||||||
}
|
}
|
||||||
@ -617,7 +617,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If name contains special chars -> replace them.
|
// If name contains special chars -> replace them.
|
||||||
if ((((CharSequence) name).chars().anyMatch(character -> specialCharReplacements.keySet().contains( "" + ((char) character))))) {
|
if ((((CharSequence) name).chars().anyMatch(character -> specialCharReplacements.keySet().contains("" + ((char) character))))) {
|
||||||
List<String> allowedCharacters = new ArrayList<>();
|
List<String> allowedCharacters = new ArrayList<>();
|
||||||
allowedCharacters.add("_");
|
allowedCharacters.add("_");
|
||||||
allowedCharacters.add("$");
|
allowedCharacters.add("$");
|
||||||
@ -1356,7 +1356,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
|||||||
*
|
*
|
||||||
* @return API version
|
* @return API version
|
||||||
*/
|
*/
|
||||||
private String getVersionFromSpecification () {
|
private String getVersionFromSpecification() {
|
||||||
if (this.openAPI != null && this.openAPI.getInfo() != null) {
|
if (this.openAPI != null && this.openAPI.getInfo() != null) {
|
||||||
return this.openAPI.getInfo().getVersion();
|
return this.openAPI.getInfo().getVersion();
|
||||||
} else {
|
} else {
|
||||||
@ -1370,7 +1370,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
|||||||
* @param version
|
* @param version
|
||||||
* @return SNAPSHOT version
|
* @return SNAPSHOT version
|
||||||
*/
|
*/
|
||||||
private String buildSnapshotVersion (String version) {
|
private String buildSnapshotVersion(String version) {
|
||||||
return version + "-" + "SNAPSHOT";
|
return version + "-" + "SNAPSHOT";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1445,7 +1445,6 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void postProcessFile(File file, String fileType) {
|
public void postProcessFile(File file, String fileType) {
|
||||||
if (file == null) {
|
if (file == null) {
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,20 @@
|
|||||||
|
package org.openapitools.codegen.languages.features;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
public interface CXFExtServerFeatures extends CXFServerFeatures {
|
||||||
|
|
||||||
|
String GENERATE_OPERATION_BODY = "generateOperationBody";
|
||||||
|
String SUPPORT_MULTIPLE_SPRING_SERVICES = "supportMultipleSpringServices";
|
||||||
|
String TEST_DATA_FILE = "testDataFile";
|
||||||
|
String TEST_DATA_CONTROL_FILE = "testDataControlFile";
|
||||||
|
|
||||||
|
void setGenerateOperationBody(boolean generateOperationBody);
|
||||||
|
|
||||||
|
void setLoadTestDataFromFile(boolean loadTestDataFromFile);
|
||||||
|
|
||||||
|
void setTestDataFile(File testDataFile);
|
||||||
|
|
||||||
|
void setTestDataControlFile(File testDataControlFile);
|
||||||
|
|
||||||
|
}
|
@ -33,6 +33,8 @@ public interface CXFServerFeatures
|
|||||||
|
|
||||||
public static final String GENERATE_NON_SPRING_APPLICATION = "generateNonSpringApplication";
|
public static final String GENERATE_NON_SPRING_APPLICATION = "generateNonSpringApplication";
|
||||||
|
|
||||||
|
public static final String LOAD_TEST_DATA_FROM_FILE = "loadTestDataFromFile";
|
||||||
|
|
||||||
public void setUseWadlFeature(boolean useWadlFeature);
|
public void setUseWadlFeature(boolean useWadlFeature);
|
||||||
|
|
||||||
public void setUseMultipartFeature(boolean useMultipartFeature);
|
public void setUseMultipartFeature(boolean useMultipartFeature);
|
||||||
@ -42,5 +44,4 @@ public interface CXFServerFeatures
|
|||||||
public void setUseAnnotatedBasePath(boolean useAnnotatedBasePath);
|
public void setUseAnnotatedBasePath(boolean useAnnotatedBasePath);
|
||||||
|
|
||||||
public void setGenerateNonSpringApplication(boolean generateNonSpringApplication);
|
public void setGenerateNonSpringApplication(boolean generateNonSpringApplication);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -21,10 +21,12 @@ public class ImplementationVersion {
|
|||||||
public static String read() {
|
public static String read() {
|
||||||
// Assumes this version is required at runtime. This could be modified to use a properties file like the CLI.
|
// Assumes this version is required at runtime. This could be modified to use a properties file like the CLI.
|
||||||
String compiledVersion = ImplementationVersion.class.getPackage().getImplementationVersion();
|
String compiledVersion = ImplementationVersion.class.getPackage().getImplementationVersion();
|
||||||
if(compiledVersion != null) {
|
if (compiledVersion != null) {
|
||||||
return compiledVersion;
|
return compiledVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
return "unset";
|
// When running non-JARed class within an IDE the implementation version is not available, so we provide a means
|
||||||
|
// to set it externally via a system property so that generated artefacts contain the correct version.
|
||||||
|
return System.getProperty("openapitools.implementation.version", "unset");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
120
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/CXF2InterfaceComparator.mustache
vendored
Normal file
120
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/CXF2InterfaceComparator.mustache
vendored
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
package {{package}};
|
||||||
|
|
||||||
|
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import javax.ws.rs.HttpMethod;
|
||||||
|
import javax.ws.rs.Path;
|
||||||
|
|
||||||
|
import org.apache.cxf.jaxrs.ext.ResourceComparator;
|
||||||
|
import org.apache.cxf.jaxrs.model.ClassResourceInfo;
|
||||||
|
import org.apache.cxf.jaxrs.model.OperationResourceInfo;
|
||||||
|
import org.apache.cxf.message.Message;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class only help CXF to decide which resource interface is more suitable. It used Java reflexion to iterate over Java methods but it *DO NOT* select the target method.
|
||||||
|
*/
|
||||||
|
public class CXFInterfaceComparator implements ResourceComparator {
|
||||||
|
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(CXFInterfaceComparator.class);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compare(ClassResourceInfo cri1, ClassResourceInfo cri2, Message message) {
|
||||||
|
String requestVerb = (String) message.get(Message.HTTP_REQUEST_METHOD);
|
||||||
|
String requestURI = (String) message.get(Message.REQUEST_URI);
|
||||||
|
String requestPath = requestURI.replace((String) message.get(Message.BASE_PATH), "");
|
||||||
|
|
||||||
|
// remove "/"at the end of requestPath if present
|
||||||
|
if (requestPath.endsWith("/")){
|
||||||
|
requestPath = requestPath.substring(0, requestPath.length()-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (analyseInterface(cri1, requestPath, requestVerb)) {
|
||||||
|
return -1; // Indicate that 'cri1' interface should be preferred
|
||||||
|
} else if (analyseInterface(cri2, requestPath, requestVerb)) {
|
||||||
|
return 1; // Indicate that 'cri2' interface should be preferred
|
||||||
|
} else {
|
||||||
|
return 0; // Nothing match, leave CXF decision
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Analyse each methods provided to check if there is a match with the
|
||||||
|
* message request path and request HTTP verb.
|
||||||
|
*
|
||||||
|
* @param cri
|
||||||
|
* the interface to be analysed
|
||||||
|
* @param requestPath
|
||||||
|
* the path of the request. Do not contains the host and base
|
||||||
|
* path
|
||||||
|
* @return true if a method match the request, false otherwise
|
||||||
|
*/
|
||||||
|
private static boolean analyseInterface(ClassResourceInfo cri, String requestPath, String requestVerb) {
|
||||||
|
assert cri.getServiceClass() != null;
|
||||||
|
assert cri.getServiceClass().getInterfaces() != null;
|
||||||
|
assert cri.getServiceClass().getInterfaces()[0] != null;
|
||||||
|
assert cri.getServiceClass().getInterfaces()[0].getMethods().length > 0;
|
||||||
|
|
||||||
|
Method[] methods = cri.getServiceClass().getInterfaces()[0].getMethods();
|
||||||
|
// Java reflexion. Check all the methods of an interface.
|
||||||
|
for (Method method : methods) {
|
||||||
|
Path pathAnnotation = method.getAnnotation(javax.ws.rs.Path.class);
|
||||||
|
if (pathAnnotation != null && pathAnnotation.value() != null) {
|
||||||
|
String pathValue = pathAnnotation.value();
|
||||||
|
String methodHttpVerb = getMethodHttpVerb(method);
|
||||||
|
|
||||||
|
// Always authorize OPTIONS request if the path is matching a method declaration
|
||||||
|
if (requestVerb.equals(HttpMethod.OPTIONS) && match(pathValue,requestPath)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// Also check the HTTP verb since a single path can be match do multiple request, depending of the HTTP request verb.
|
||||||
|
if (requestVerb.equals(methodHttpVerb) && match(pathValue, requestPath)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String getMethodHttpVerb(Method method) {
|
||||||
|
if (method.getAnnotation(javax.ws.rs.POST.class) != null) {
|
||||||
|
return HttpMethod.POST;
|
||||||
|
} else if (method.getAnnotation(javax.ws.rs.GET.class) != null) {
|
||||||
|
return HttpMethod.GET;
|
||||||
|
} else if (method.getAnnotation(javax.ws.rs.PUT.class) != null) {
|
||||||
|
return HttpMethod.PUT;
|
||||||
|
} else if (method.getAnnotation(javax.ws.rs.OPTIONS.class) != null) {
|
||||||
|
return HttpMethod.OPTIONS;
|
||||||
|
} else if (method.getAnnotation(javax.ws.rs.DELETE.class) != null) {
|
||||||
|
return HttpMethod.DELETE;
|
||||||
|
} else if (method.getAnnotation(javax.ws.rs.HEAD.class) != null) {
|
||||||
|
return HttpMethod.HEAD;
|
||||||
|
}
|
||||||
|
assert false;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check whether if the pathValue match with the requestPath parameter.
|
||||||
|
* Every path params are considered to be declared as '{param}'. The tokens to start and close path params declaration are '{' and '}'.
|
||||||
|
*
|
||||||
|
* @param valueFromAnnotation
|
||||||
|
* @param valueFromRequest
|
||||||
|
* @return true if there is a match, false otherwise
|
||||||
|
*/
|
||||||
|
private static boolean match(String valueFromAnnotation, String valueFromRequest) {
|
||||||
|
String patternFinal = valueFromAnnotation.replaceAll("\\{(.*?)\\}", "([^/]*)").replace("/", "\\/");
|
||||||
|
Matcher matcher = Pattern.compile(patternFinal).matcher(valueFromRequest);
|
||||||
|
if (matcher.matches()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compare(OperationResourceInfo ori1, OperationResourceInfo ori2, Message message) {
|
||||||
|
return 0; // Leave CXF decision
|
||||||
|
}
|
||||||
|
}
|
1
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/allowableValues.mustache
vendored
Normal file
1
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/allowableValues.mustache
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{{#allowableValues}}allowableValues="{{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}{{^values}}range=[{{#min}}{{.}}{{/min}}{{^min}}-infinity{{/min}}, {{#max}}{{.}}{{/max}}{{^max}}infinity{{/max}}]{{/values}}"{{/allowableValues}}
|
70
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/api.mustache
vendored
Normal file
70
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/api.mustache
vendored
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
package {{package}};
|
||||||
|
|
||||||
|
{{#imports}}import {{import}};
|
||||||
|
{{/imports}}
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import javax.ws.rs.*;
|
||||||
|
import javax.ws.rs.core.Response;
|
||||||
|
import javax.ws.rs.core.MediaType;
|
||||||
|
import org.apache.cxf.jaxrs.ext.multipart.*;
|
||||||
|
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import io.swagger.annotations.ApiResponses;
|
||||||
|
import io.swagger.annotations.ApiResponse;
|
||||||
|
import io.swagger.jaxrs.PATCH;
|
||||||
|
{{#useBeanValidation}}
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
{{/useBeanValidation}}
|
||||||
|
|
||||||
|
{{#appName}}
|
||||||
|
/**
|
||||||
|
* {{{appName}}}
|
||||||
|
*
|
||||||
|
{{#appDescription}}
|
||||||
|
* <p>{{{appDescription}}}
|
||||||
|
*
|
||||||
|
{{/appDescription}}
|
||||||
|
*/
|
||||||
|
{{/appName}}
|
||||||
|
@Path("{{^useAnnotatedBasePath}}/{{/useAnnotatedBasePath}}{{#useAnnotatedBasePath}}{{contextPath}}{{/useAnnotatedBasePath}}")
|
||||||
|
@Api(value = "/", description = "{{description}}")
|
||||||
|
{{#addConsumesProducesJson}}
|
||||||
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
{{/addConsumesProducesJson}}
|
||||||
|
public interface {{classname}} {
|
||||||
|
{{#operations}}
|
||||||
|
{{#operation}}
|
||||||
|
|
||||||
|
{{#summary}}
|
||||||
|
/**
|
||||||
|
* {{summary}}
|
||||||
|
*
|
||||||
|
{{#notes}}
|
||||||
|
* {{notes}}
|
||||||
|
*
|
||||||
|
{{/notes}}
|
||||||
|
*/
|
||||||
|
{{/summary}}
|
||||||
|
@{{httpMethod}}
|
||||||
|
{{#subresourceOperation}}@Path("{{{path}}}"){{/subresourceOperation}}
|
||||||
|
{{#hasConsumes}}
|
||||||
|
@Consumes({ {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} })
|
||||||
|
{{/hasConsumes}}
|
||||||
|
{{#hasProduces}}
|
||||||
|
@Produces({ {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} })
|
||||||
|
{{/hasProduces}}
|
||||||
|
@ApiOperation(value = "{{{summary}}}", tags={ {{#vendorExtensions.x-tags}}"{{tag}}"{{#hasMore}}, {{/hasMore}}{{/vendorExtensions.x-tags}} })
|
||||||
|
@ApiResponses(value = { {{#responses}}
|
||||||
|
@ApiResponse(code = {{{code}}}, message = "{{{message}}}"{{^vendorExtensions.x-java-is-response-void}}, response = {{{baseType}}}.class{{#containerType}}, responseContainer = "{{{containerType}}}"{{/containerType}}{{/vendorExtensions.x-java-is-response-void}}){{#hasMore}},{{/hasMore}}{{/responses}} })
|
||||||
|
public {{>returnTypes}} {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
|
||||||
|
{{/operation}}
|
||||||
|
}
|
||||||
|
{{/operations}}
|
||||||
|
|
93
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/apiServiceImpl.mustache
vendored
Normal file
93
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/apiServiceImpl.mustache
vendored
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
package {{package}}.impl;
|
||||||
|
|
||||||
|
import {{package}}.*;
|
||||||
|
{{#imports}}import {{import}};
|
||||||
|
{{/imports}}
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
{{#generateOperationBody}}
|
||||||
|
import java.io.File;
|
||||||
|
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
|
||||||
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||||
|
{{#loadTestDataFromFile}}
|
||||||
|
import org.openapitools.codegen.utils.JsonCache;
|
||||||
|
import org.openapitools.codegen.utils.JsonCache.CacheException;
|
||||||
|
{{/loadTestDataFromFile}}
|
||||||
|
{{/generateOperationBody}}
|
||||||
|
import javax.ws.rs.*;
|
||||||
|
import javax.ws.rs.core.Response;
|
||||||
|
import org.apache.cxf.jaxrs.model.wadl.Description;
|
||||||
|
import org.apache.cxf.jaxrs.model.wadl.DocTarget;
|
||||||
|
|
||||||
|
import org.apache.cxf.jaxrs.ext.multipart.*;
|
||||||
|
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
{{#useSpringAnnotationConfig}}
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
{{/useSpringAnnotationConfig}}
|
||||||
|
|
||||||
|
{{#useSpringAnnotationConfig}}
|
||||||
|
@Service("{{classname}}")
|
||||||
|
{{/useSpringAnnotationConfig}}
|
||||||
|
{{#description}}
|
||||||
|
{{/description}}
|
||||||
|
{{#appName}}
|
||||||
|
/**
|
||||||
|
* {{{appName}}}
|
||||||
|
*
|
||||||
|
{{#appDescription}}
|
||||||
|
* <p>{{{appDescription}}}
|
||||||
|
{{/appDescription}}
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
{{/appName}}
|
||||||
|
public class {{classname}}ServiceImpl implements {{classname}} {
|
||||||
|
{{#generateOperationBody}}
|
||||||
|
{{#loadTestDataFromFile}}
|
||||||
|
private JsonCache cache;
|
||||||
|
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
File cacheFile = new File(System.getProperty("jaxrs.test.server.json",
|
||||||
|
"{{testDataFile}}"));
|
||||||
|
cache = JsonCache.Factory.instance.get("test-data").load(cacheFile).child("/{{invokerPackage}}/{{classname}}");
|
||||||
|
} catch (CacheException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{{/loadTestDataFromFile}}
|
||||||
|
{{/generateOperationBody}}
|
||||||
|
{{#operations}}
|
||||||
|
{{#operation}}
|
||||||
|
{{#summary}}
|
||||||
|
/**
|
||||||
|
* {{summary}}
|
||||||
|
*
|
||||||
|
{{#notes}}
|
||||||
|
* {{notes}}
|
||||||
|
*
|
||||||
|
{{/notes}}
|
||||||
|
*/
|
||||||
|
{{/summary}}
|
||||||
|
@Override
|
||||||
|
public {{>returnTypes}} {{operationId}}({{#allParams}}{{>queryParamsImpl}}{{>pathParamsImpl}}{{>headerParamsImpl}}{{>bodyParamsImpl}}{{>formParamsImpl}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) {
|
||||||
|
{{^loadTestDataFromFile}}
|
||||||
|
// TODO: Implement...
|
||||||
|
{{/loadTestDataFromFile}}
|
||||||
|
{{! generic response:
|
||||||
|
}}{{#useGenericResponse}}return Response.ok().entity("magic!").build();{{/useGenericResponse}}{{!
|
||||||
|
non-generic response: }}{{^useGenericResponse}}{{!
|
||||||
|
non-void response: }}{{^vendorExtensions.x-java-is-response-void}}{{!
|
||||||
|
pre-populated operation body: }}{{#generateOperationBody}}{{{vendorExtensions.x-java-operation-body}}}{{/generateOperationBody}}{{!
|
||||||
|
null response: }}{{^generateOperationBody}} return null;{{/generateOperationBody}}{{!
|
||||||
|
}}{{/vendorExtensions.x-java-is-response-void}}{{!
|
||||||
|
}}{{/useGenericResponse}}
|
||||||
|
}
|
||||||
|
|
||||||
|
{{/operation}}
|
||||||
|
}
|
||||||
|
{{/operations}}
|
197
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/api_test.mustache
vendored
Normal file
197
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/api_test.mustache
vendored
Normal file
@ -0,0 +1,197 @@
|
|||||||
|
{{>licenseInfo}}
|
||||||
|
|
||||||
|
package {{package}};
|
||||||
|
|
||||||
|
{{#imports}}import {{import}};
|
||||||
|
{{/imports}}
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.Before;
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
import javax.ws.rs.core.MediaType;
|
||||||
|
import javax.ws.rs.core.Response;
|
||||||
|
import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
|
||||||
|
import org.apache.cxf.jaxrs.client.ClientConfiguration;
|
||||||
|
import org.apache.cxf.jaxrs.client.WebClient;
|
||||||
|
import org.apache.cxf.jaxrs.ext.multipart.Attachment;
|
||||||
|
{{#useGzipFeature}}
|
||||||
|
import org.apache.cxf.transport.common.gzip.GZIPInInterceptor;
|
||||||
|
import org.apache.cxf.transport.common.gzip.GZIPOutInterceptor;
|
||||||
|
{{/useGzipFeature}}
|
||||||
|
|
||||||
|
{{#useLoggingFeature}}
|
||||||
|
import org.apache.cxf.interceptor.LoggingOutInterceptor;
|
||||||
|
{{/useLoggingFeature}}
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
|
||||||
|
import com.fasterxml.jackson.jaxrs.xml.JacksonXMLProvider;
|
||||||
|
import org.apache.cxf.jaxrs.provider.MultipartProvider;
|
||||||
|
|
||||||
|
{{^fullJavaUtil}}
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
{{/fullJavaUtil}}
|
||||||
|
|
||||||
|
{{#generateSpringBootApplication}}
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
|
||||||
|
import org.springframework.boot.web.server.LocalServerPort;
|
||||||
|
{{/generateSpringBootApplication}}
|
||||||
|
{{#generateOperationBody}}
|
||||||
|
import java.io.File;
|
||||||
|
{{^fullJavaUtil}}
|
||||||
|
import java.util.Set;
|
||||||
|
{{/fullJavaUtil}}
|
||||||
|
import javax.validation.ConstraintViolation;
|
||||||
|
import javax.validation.Validation;
|
||||||
|
import javax.validation.Validator;
|
||||||
|
import javax.validation.ValidatorFactory;
|
||||||
|
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
|
||||||
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||||
|
import org.junit.BeforeClass;
|
||||||
|
{{#loadTestDataFromFile}}
|
||||||
|
import org.openapitools.codegen.utils.JsonCache;
|
||||||
|
{{/loadTestDataFromFile}}
|
||||||
|
{{/generateOperationBody}}
|
||||||
|
|
||||||
|
/**
|
||||||
|
{{#appName}}
|
||||||
|
* {{{appName}}}
|
||||||
|
*
|
||||||
|
{{/appName}}
|
||||||
|
{{#appDescription}}
|
||||||
|
* <p>{{{appDescription}}}
|
||||||
|
*
|
||||||
|
{{/appDescription}}
|
||||||
|
* API tests for {{classname}}.
|
||||||
|
*/
|
||||||
|
{{#generateSpringBootApplication}}
|
||||||
|
@RunWith(SpringRunner.class)
|
||||||
|
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
|
||||||
|
{{/generateSpringBootApplication}}
|
||||||
|
public class {{classname}}Test {
|
||||||
|
{{#generateOperationBody}}
|
||||||
|
private static Validator validator;
|
||||||
|
{{#loadTestDataFromFile}}
|
||||||
|
private static JsonCache cache;
|
||||||
|
{{/loadTestDataFromFile}}
|
||||||
|
|
||||||
|
@BeforeClass
|
||||||
|
public static void beforeClass() throws Exception {
|
||||||
|
{{#loadTestDataFromFile}}
|
||||||
|
File cacheFile = new File(System.getProperty("jaxrs.test.client.json",
|
||||||
|
"{{testDataFile}}"));
|
||||||
|
cache = JsonCache.Factory.instance.get("test-data").load(cacheFile).child("/{{invokerPackage}}/{{classname}}");
|
||||||
|
|
||||||
|
{{/loadTestDataFromFile}}
|
||||||
|
validator = Validation.buildDefaultValidatorFactory().getValidator();
|
||||||
|
}
|
||||||
|
|
||||||
|
{{/generateOperationBody}}
|
||||||
|
{{#generateSpringBootApplication}}
|
||||||
|
@LocalServerPort
|
||||||
|
private int serverPort;
|
||||||
|
{{/generateSpringBootApplication}}
|
||||||
|
|
||||||
|
private {{classname}} api;
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void setup() {
|
||||||
|
List<?> providers = Arrays.asList(new JacksonJsonProvider(), new JacksonXMLProvider(), new MultipartProvider());
|
||||||
|
|
||||||
|
{{#generateSpringBootApplication}}
|
||||||
|
api = JAXRSClientFactory.create("http://localhost:" + serverPort + "/services", {{classname}}.class, providers);
|
||||||
|
{{/generateSpringBootApplication}}
|
||||||
|
{{^generateSpringBootApplication}}
|
||||||
|
api = JAXRSClientFactory.create("{{{basePath}}}", {{classname}}.class, providers);
|
||||||
|
{{/generateSpringBootApplication}}
|
||||||
|
org.apache.cxf.jaxrs.client.Client client = WebClient.client(api);
|
||||||
|
|
||||||
|
ClientConfiguration config = WebClient.getConfig(client);
|
||||||
|
{{#useGzipFeatureForTests}}
|
||||||
|
// Example for using Gzipping
|
||||||
|
GZIPOutInterceptor gzipOutInterceptor = new GZIPOutInterceptor();
|
||||||
|
// use Gzipping for first request sent to server
|
||||||
|
//gzipOutInterceptor.setForce(true);
|
||||||
|
config.getOutInterceptors().add(gzipOutInterceptor);
|
||||||
|
|
||||||
|
config.getInInterceptors().add(new GZIPInInterceptor());
|
||||||
|
{{/useGzipFeatureForTests}}
|
||||||
|
{{#useLoggingFeatureForTests}}
|
||||||
|
LoggingOutInterceptor loggingOutInterceptor = new LoggingOutInterceptor();
|
||||||
|
config.getOutInterceptors().add(loggingOutInterceptor);
|
||||||
|
{{/useLoggingFeatureForTests}}
|
||||||
|
}
|
||||||
|
|
||||||
|
{{#generateOperationBody}}
|
||||||
|
private void validate(Object o) {
|
||||||
|
assertNotNull(o);
|
||||||
|
Set<ConstraintViolation<Object>> violations = validator.validate(o);
|
||||||
|
if (!violations.isEmpty()) {
|
||||||
|
StringBuilder message = new StringBuilder("Validation failed");
|
||||||
|
for (ConstraintViolation<Object> violation : violations)
|
||||||
|
message.append("; ").append(violation.getPropertyPath()).append(": ").append(violation.getMessage());
|
||||||
|
fail(message.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{{/generateOperationBody}}
|
||||||
|
{{#operations}}{{#operation}}
|
||||||
|
/**
|
||||||
|
{{#summary}}
|
||||||
|
* {{summary}}
|
||||||
|
*
|
||||||
|
{{#notes}}
|
||||||
|
* {{notes}}
|
||||||
|
*
|
||||||
|
{{/notes}}
|
||||||
|
{{/summary}}
|
||||||
|
* @throws ApiException if the API call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void {{operationId}}Test() throws Exception {
|
||||||
|
{{#hasParams}}
|
||||||
|
{{^loadTestDataFromFile}}
|
||||||
|
// TODO: assign appropriate parameter values
|
||||||
|
{{/loadTestDataFromFile}}
|
||||||
|
{{/hasParams}}
|
||||||
|
{{#allParams}}
|
||||||
|
{{^isFile}}
|
||||||
|
{{#generateOperationBody}}
|
||||||
|
{{{vendorExtensions.x-java-param-decl}}}{{!
|
||||||
|
}}{{/generateOperationBody}}{{!
|
||||||
|
}}{{^generateOperationBody}}{{!
|
||||||
|
}} {{{dataType}}} {{paramName}} = null;
|
||||||
|
{{/generateOperationBody}}
|
||||||
|
{{/isFile}}
|
||||||
|
{{#isFile}}
|
||||||
|
{{#generateOperationBody}}
|
||||||
|
|
||||||
|
{{/generateOperationBody}}
|
||||||
|
Attachment {{paramName}} = new Attachment("{{paramName}}", MediaType.TEXT_PLAIN, "Dummy attachment content");{{!
|
||||||
|
}}{{^generateOperationBody}}
|
||||||
|
{{/generateOperationBody}}
|
||||||
|
{{/isFile}}
|
||||||
|
{{/allParams}}
|
||||||
|
{{^loadTestDataFromFile}}
|
||||||
|
|
||||||
|
// TODO: delete this line and uncomment the next
|
||||||
|
{{/loadTestDataFromFile}}
|
||||||
|
{{#loadTestDataFromFile}}
|
||||||
|
|
||||||
|
{{/loadTestDataFromFile}}
|
||||||
|
{{^loadTestDataFromFile}}// {{/loadTestDataFromFile}}{{^vendorExtensions.x-java-is-response-void}}{{>returnTypes}} response = {{/vendorExtensions.x-java-is-response-void}}api.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
|
||||||
|
{{^vendorExtensions.x-java-is-response-void}}
|
||||||
|
// TODO: complete test assertions
|
||||||
|
{{#generateOperationBody}}
|
||||||
|
{{^loadTestDataFromFile}}// {{/loadTestDataFromFile}}validate(response);
|
||||||
|
{{/generateOperationBody}}
|
||||||
|
{{/vendorExtensions.x-java-is-response-void}}
|
||||||
|
}
|
||||||
|
{{/operation}}{{/operations}}
|
||||||
|
}
|
4
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/beanValidation.mustache
vendored
Normal file
4
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/beanValidation.mustache
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{{#required}}
|
||||||
|
@NotNull
|
||||||
|
{{/required}}
|
||||||
|
{{>beanValidationCore}}
|
20
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/beanValidationCore.mustache
vendored
Normal file
20
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/beanValidationCore.mustache
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
{{#pattern}} @Pattern(regexp="{{{pattern}}}"){{/pattern}}{{!
|
||||||
|
minLength && maxLength set
|
||||||
|
}}{{#minLength}}{{#maxLength}} @Size(min={{minLength}},max={{maxLength}}){{/maxLength}}{{/minLength}}{{!
|
||||||
|
minLength set, maxLength not
|
||||||
|
}}{{#minLength}}{{^maxLength}} @Size(min={{minLength}}){{/maxLength}}{{/minLength}}{{!
|
||||||
|
minLength not set, maxLength set
|
||||||
|
}}{{^minLength}}{{#maxLength}} @Size(max={{maxLength}}){{/maxLength}}{{/minLength}}{{!
|
||||||
|
@Size: minItems && maxItems set
|
||||||
|
}}{{#minItems}}{{#maxItems}} @Size(min={{minItems}},max={{maxItems}}){{/maxItems}}{{/minItems}}{{!
|
||||||
|
@Size: minItems set, maxItems not
|
||||||
|
}}{{#minItems}}{{^maxItems}} @Size(min={{minItems}}){{/maxItems}}{{/minItems}}{{!
|
||||||
|
@Size: minItems not set && maxItems set
|
||||||
|
}}{{^minItems}}{{#maxItems}} @Size(max={{maxItems}}){{/maxItems}}{{/minItems}}{{!
|
||||||
|
check for integer or long / all others=decimal type with @Decimal*
|
||||||
|
isInteger set
|
||||||
|
}}{{#isInteger}}{{#minimum}} @Min({{minimum}}){{/minimum}}{{#maximum}} @Max({{maximum}}){{/maximum}}{{/isInteger}}{{!
|
||||||
|
isLong set
|
||||||
|
}}{{#isLong}}{{#minimum}} @Min({{minimum}}L){{/minimum}}{{#maximum}} @Max({{maximum}}L){{/maximum}}{{/isLong}}{{!
|
||||||
|
Not Integer, not Long => we have a decimal value!
|
||||||
|
}}{{^isInteger}}{{^isLong}}{{#minimum}} @DecimalMin("{{minimum}}"){{/minimum}}{{#maximum}} @DecimalMax("{{maximum}}"){{/maximum}}{{/isLong}}{{/isInteger}}
|
@ -0,0 +1 @@
|
|||||||
|
{{#required}} @NotNull{{/required}}{{>beanValidationCore}}
|
@ -0,0 +1 @@
|
|||||||
|
{{! PathParam is always required, no @NotNull necessary }}{{>beanValidationCore}}
|
@ -0,0 +1 @@
|
|||||||
|
{{#required}} @NotNull{{/required}}{{>beanValidationCore}}
|
1
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/bodyParams.mustache
vendored
Normal file
1
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/bodyParams.mustache
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{{#isBodyParam}}{{#useBeanValidation}}@Valid {{/useBeanValidation}}{{{dataType}}} {{paramName}}{{/isBodyParam}}
|
1
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/bodyParamsImpl.mustache
vendored
Normal file
1
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/bodyParamsImpl.mustache
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{{#isBodyParam}}{{{dataType}}} {{paramName}}{{/isBodyParam}}
|
33
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/enumClass.mustache
vendored
Normal file
33
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/enumClass.mustache
vendored
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
@XmlType(name="{{datatypeWithEnum}}")
|
||||||
|
@XmlEnum({{dataType}}.class)
|
||||||
|
public enum {{datatypeWithEnum}} {
|
||||||
|
|
||||||
|
{{#allowableValues}}
|
||||||
|
{{#enumVars}}@XmlEnumValue({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}) @JsonProperty({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}) {{name}}({{dataType}}.valueOf({{{value}}})){{^-last}},
|
||||||
|
{{/-last}}{{#-last}};{{/-last}}{{/enumVars}}
|
||||||
|
{{/allowableValues}}
|
||||||
|
|
||||||
|
private {{dataType}} value;
|
||||||
|
|
||||||
|
{{datatypeWithEnum}} ({{dataType}} v) {
|
||||||
|
value = v;
|
||||||
|
}
|
||||||
|
|
||||||
|
public {{dataType}} value() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return String.valueOf(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static {{datatypeWithEnum}} fromValue(String v) {
|
||||||
|
for ({{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) {
|
||||||
|
if (String.valueOf(b.value).equals(v)) {
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{{#useNullForUnknownEnumValue}}return null;{{/useNullForUnknownEnumValue}}{{^useNullForUnknownEnumValue}}throw new IllegalArgumentException("Unexpected value '" + v + "'");{{/useNullForUnknownEnumValue}}
|
||||||
|
}
|
||||||
|
}
|
48
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/enumOuterClass.mustache
vendored
Normal file
48
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/enumOuterClass.mustache
vendored
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
{{#jackson}}
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonValue;
|
||||||
|
{{/jackson}}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}}
|
||||||
|
*/
|
||||||
|
public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} {
|
||||||
|
{{#gson}}
|
||||||
|
{{#allowableValues}}{{#enumVars}}
|
||||||
|
@SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}})
|
||||||
|
{{{name}}}({{{value}}}){{^-last}},
|
||||||
|
{{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}}
|
||||||
|
{{/gson}}
|
||||||
|
{{^gson}}
|
||||||
|
{{#allowableValues}}{{#enumVars}}
|
||||||
|
{{{name}}}({{{value}}}){{^-last}},
|
||||||
|
{{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}}
|
||||||
|
{{/gson}}
|
||||||
|
|
||||||
|
private {{{dataType}}} value;
|
||||||
|
|
||||||
|
{{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}({{{dataType}}} value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
{{#jackson}}
|
||||||
|
@JsonValue
|
||||||
|
{{/jackson}}
|
||||||
|
public String toString() {
|
||||||
|
return String.valueOf(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
{{#jackson}}
|
||||||
|
@JsonCreator
|
||||||
|
{{/jackson}}
|
||||||
|
public static {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} fromValue(String text) {
|
||||||
|
for ({{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) {
|
||||||
|
if (String.valueOf(b.value).equals(text)) {
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{{#useNullForUnknownEnumValue}}return null;{{/useNullForUnknownEnumValue}}{{^useNullForUnknownEnumValue}}throw new IllegalArgumentException("Unexpected value '" + text + "'");{{/useNullForUnknownEnumValue}}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
1
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/formParams.mustache
vendored
Normal file
1
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/formParams.mustache
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{{#isFormParam}}{{^isFile}}@Multipart(value = "{{baseName}}"{{^required}}, required = false{{/required}}) {{{dataType}}} {{paramName}}{{/isFile}}{{#isFile}} @Multipart(value = "{{baseName}}" {{^required}}, required = false{{/required}}) Attachment {{paramName}}Detail{{/isFile}}{{/isFormParam}}
|
1
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/formParamsImpl.mustache
vendored
Normal file
1
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/formParamsImpl.mustache
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{{#isFormParam}}{{^isFile}}{{{dataType}}} {{paramName}}{{/isFile}}{{#isFile}} Attachment {{paramName}}Detail{{/isFile}}{{/isFormParam}}
|
1
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/generatedAnnotation.mustache
vendored
Normal file
1
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/generatedAnnotation.mustache
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
@javax.annotation.Generated(value = "{{generatorClass}}", date = "{{generatedDate}}")
|
1
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/headerParams.mustache
vendored
Normal file
1
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/headerParams.mustache
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{{#isHeaderParam}}@HeaderParam("{{baseName}}") {{#useBeanValidation}}{{>beanValidationHeaderParams}}{{/useBeanValidation}} {{{dataType}}} {{paramName}}{{/isHeaderParam}}
|
1
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/headerParamsImpl.mustache
vendored
Normal file
1
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/headerParamsImpl.mustache
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{{#isHeaderParam}}{{{dataType}}} {{paramName}}{{/isHeaderParam}}
|
23
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/licenseInfo.mustache
vendored
Normal file
23
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/licenseInfo.mustache
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
/**
|
||||||
|
* {{{appName}}}
|
||||||
|
* {{{appDescription}}}
|
||||||
|
*
|
||||||
|
* {{#version}}OpenAPI spec version: {{{version}}}{{/version}}
|
||||||
|
* {{#infoEmail}}Contact: {{{infoEmail}}}{{/infoEmail}}
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
22
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/model.mustache
vendored
Normal file
22
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/model.mustache
vendored
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
package {{package}};
|
||||||
|
|
||||||
|
{{#imports}}import {{import}};
|
||||||
|
{{/imports}}
|
||||||
|
{{#serializableModel}}
|
||||||
|
import java.io.Serializable;
|
||||||
|
{{/serializableModel}}
|
||||||
|
{{#useBeanValidation}}
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
{{/useBeanValidation}}
|
||||||
|
|
||||||
|
{{#models}}
|
||||||
|
{{#model}}
|
||||||
|
{{#isEnum}}
|
||||||
|
{{>enumOuterClass}}
|
||||||
|
{{/isEnum}}
|
||||||
|
{{^isEnum}}
|
||||||
|
{{>pojo}}
|
||||||
|
{{/isEnum}}
|
||||||
|
{{/model}}
|
||||||
|
{{/models}}
|
1
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/pathParams.mustache
vendored
Normal file
1
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/pathParams.mustache
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{{#isPathParam}}@PathParam("{{baseName}}"){{#useBeanValidation}}{{>beanValidationPathParams}}{{/useBeanValidation}} {{{dataType}}} {{paramName}}{{/isPathParam}}
|
1
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/pathParamsImpl.mustache
vendored
Normal file
1
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/pathParamsImpl.mustache
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{{#isPathParam}}{{{dataType}}} {{paramName}}{{/isPathParam}}
|
152
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/pojo.mustache
vendored
Normal file
152
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/pojo.mustache
vendored
Normal file
@ -0,0 +1,152 @@
|
|||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
|
import javax.xml.bind.annotation.XmlType;
|
||||||
|
import javax.xml.bind.annotation.XmlEnum;
|
||||||
|
import javax.xml.bind.annotation.XmlEnumValue;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
|
{{#withXml}}
|
||||||
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
|
{{#hasVars}} @XmlType(name = "{{classname}}", propOrder =
|
||||||
|
{ {{#vars}}"{{name}}"{{^-last}}, {{/-last}}{{/vars}}
|
||||||
|
}){{/hasVars}}
|
||||||
|
{{^hasVars}}@XmlType(name = "{{classname}}"){{/hasVars}}
|
||||||
|
{{^parent}}@XmlRootElement(name="{{classname}}"){{/parent}}
|
||||||
|
{{/withXml}}
|
||||||
|
{{#description}}
|
||||||
|
/**
|
||||||
|
* {{{description}}}
|
||||||
|
*/
|
||||||
|
@ApiModel(description="{{{description}}}")
|
||||||
|
{{/description}}
|
||||||
|
public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}}{{#serializableModel}} implements Serializable{{/serializableModel}} {
|
||||||
|
{{#vars}}{{#isEnum}}{{^isContainer}}
|
||||||
|
{{>enumClass}}{{/isContainer}}{{#isContainer}}{{#mostInnerItems}}
|
||||||
|
{{>enumClass}}{{/mostInnerItems}}{{/isContainer}}{{/isEnum}}
|
||||||
|
{{#description}}
|
||||||
|
/**
|
||||||
|
* {{{description}}}
|
||||||
|
*/
|
||||||
|
{{/description}}
|
||||||
|
{{#withXml}}
|
||||||
|
@XmlElement(name="{{baseName}}"{{#required}}, required = {{required}}{{/required}})
|
||||||
|
{{/withXml}}
|
||||||
|
@ApiModelProperty({{#example}}example = "{{{example}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}"){{^isPrimitiveType}}{{^isDate}}{{^isDateTime}}{{^isString}}{{^isFile}}{{#useBeanValidation}}
|
||||||
|
@Valid{{/useBeanValidation}}{{/isFile}}{{/isString}}{{/isDateTime}}{{/isDate}}{{/isPrimitiveType}}
|
||||||
|
{{#isDate}}
|
||||||
|
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")
|
||||||
|
{{/isDate}}
|
||||||
|
{{#isDateTime}}
|
||||||
|
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'hh:mm:ss.SSSX")
|
||||||
|
{{/isDateTime}}
|
||||||
|
{{#isContainer}}
|
||||||
|
private {{{datatypeWithEnum}}} {{name}}{{#required}} = {{{defaultValue}}}{{/required}}{{^required}} = null{{/required}};
|
||||||
|
{{/isContainer}}
|
||||||
|
{{^isContainer}}
|
||||||
|
private {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};
|
||||||
|
{{/isContainer}}
|
||||||
|
{{/vars}}
|
||||||
|
{{#vars}}
|
||||||
|
/**
|
||||||
|
{{#description}}
|
||||||
|
* {{description}}
|
||||||
|
{{/description}}
|
||||||
|
{{^description}}
|
||||||
|
* Get {{name}}
|
||||||
|
{{/description}}
|
||||||
|
{{#minimum}}
|
||||||
|
* minimum: {{minimum}}
|
||||||
|
{{/minimum}}
|
||||||
|
{{#maximum}}
|
||||||
|
* maximum: {{maximum}}
|
||||||
|
{{/maximum}}
|
||||||
|
* @return {{name}}
|
||||||
|
*/
|
||||||
|
@JsonProperty("{{baseName}}")
|
||||||
|
{{#vendorExtensions.extraAnnotation}}
|
||||||
|
{{{vendorExtensions.extraAnnotation}}}
|
||||||
|
{{/vendorExtensions.extraAnnotation}}
|
||||||
|
{{#useBeanValidation}}{{>beanValidation}}{{/useBeanValidation}} {{#isEnum}}{{^isListContainer}}{{^isMapContainer}}public {{dataType}} {{getter}}() {
|
||||||
|
return {{name}} == null ? null : {{name}}.value();
|
||||||
|
}{{/isMapContainer}}{{/isListContainer}}{{/isEnum}}{{#isEnum}}{{#isListContainer}}public {{{datatypeWithEnum}}} {{getter}}() {
|
||||||
|
return {{name}};
|
||||||
|
}{{/isListContainer}}{{/isEnum}}{{#isEnum}}{{#isMapContainer}}public {{{datatypeWithEnum}}} {{getter}}() {
|
||||||
|
return {{name}};
|
||||||
|
}{{/isMapContainer}}{{/isEnum}}{{^isEnum}}public {{{datatypeWithEnum}}} {{getter}}() {
|
||||||
|
return {{name}};
|
||||||
|
}{{/isEnum}}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the <code>{{name}}</code> property.
|
||||||
|
{{#isReadOnly}}
|
||||||
|
* <br><em>N.B. <code>{{name}}</code> is <b>read only</b>; client code should not call this method</em>.
|
||||||
|
{{/isReadOnly}}
|
||||||
|
*/
|
||||||
|
public void {{setter}}({{{datatypeWithEnum}}} {{name}}) {
|
||||||
|
this.{{name}} = {{name}};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the <code>{{name}}</code> property.
|
||||||
|
{{#isReadOnly}}
|
||||||
|
* <br><em>N.B. <code>{{name}}</code> is <b>read only</b>; client code should not call this method</em>.
|
||||||
|
{{/isReadOnly}}
|
||||||
|
*/
|
||||||
|
public {{classname}} {{name}}({{{datatypeWithEnum}}} {{name}}) {
|
||||||
|
this.{{name}} = {{name}};
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
{{#isListContainer}}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a new item to the <code>{{name}}</code> list.
|
||||||
|
{{#isReadOnly}}
|
||||||
|
* <br><em>N.B. <code>{{name}}</code> is <b>read only</b>; client code should not call this method</em>.
|
||||||
|
{{/isReadOnly}}
|
||||||
|
*/
|
||||||
|
public {{classname}} add{{nameInCamelCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) {
|
||||||
|
this.{{name}}.add({{name}}Item);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
{{/isListContainer}}
|
||||||
|
{{#isMapContainer}}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Puts a new item into the <code>{{name}}</code> map.
|
||||||
|
{{#isReadOnly}}
|
||||||
|
* <br><em>N.B. <code>{{name}}</code> is <b>read only</b>; client code should not call this method</em>.
|
||||||
|
{{/isReadOnly}}
|
||||||
|
*/
|
||||||
|
public {{classname}} put{{nameInCamelCase}}Item(String key, {{{items.datatypeWithEnum}}} {{name}}Item) {
|
||||||
|
this.{{name}}.put(key, {{name}}Item);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
{{/isMapContainer}}
|
||||||
|
|
||||||
|
{{/vars}}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("class {{classname}} {\n");
|
||||||
|
{{#parent}}sb.append(" ").append(toIndentedString(super.toString())).append("\n");{{/parent}}
|
||||||
|
{{#vars}}sb.append(" {{name}}: ").append(toIndentedString({{name}})).append("\n");
|
||||||
|
{{/vars}}sb.append("}");
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert the given object to string with each line indented by 4 spaces
|
||||||
|
* (except the first line).
|
||||||
|
*/
|
||||||
|
private static String toIndentedString(java.lang.Object o) {
|
||||||
|
if (o == null) {
|
||||||
|
return "null";
|
||||||
|
}
|
||||||
|
return o.toString().replace("\n", "\n ");
|
||||||
|
}
|
||||||
|
}
|
219
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/pom.mustache
vendored
Normal file
219
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/pom.mustache
vendored
Normal file
@ -0,0 +1,219 @@
|
|||||||
|
<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>{{groupId}}</groupId>
|
||||||
|
<artifactId>{{artifactId}}</artifactId>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
<name>{{artifactId}}</name>
|
||||||
|
{{#appDescription}}
|
||||||
|
<description>{{appDescription}}</description>
|
||||||
|
{{/appDescription}}
|
||||||
|
<version>{{artifactVersion}}</version>
|
||||||
|
<build>
|
||||||
|
<sourceDirectory>src/main/java</sourceDirectory>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-failsafe-plugin</artifactId>
|
||||||
|
<version>2.6</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>integration-test</goal>
|
||||||
|
<goal>verify</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<!--plugin>
|
||||||
|
<groupId>org.eclipse.jetty</groupId>
|
||||||
|
<artifactId>jetty-maven-plugin</artifactId>
|
||||||
|
<version>${jetty-version}</version>
|
||||||
|
<configuration>
|
||||||
|
<webApp>
|
||||||
|
<contextPath>/</contextPath>
|
||||||
|
</webApp>
|
||||||
|
<webAppSourceDirectory>target/${project.artifactId}-${project.version}</webAppSourceDirectory>
|
||||||
|
<stopPort>8079</stopPort>
|
||||||
|
<stopKey>stopit</stopKey>
|
||||||
|
<httpConnector>
|
||||||
|
<port>{{serverPort}}</port>
|
||||||
|
<idleTimeout>60000</idleTimeout>
|
||||||
|
</httpConnector>
|
||||||
|
</configuration>
|
||||||
|
{{#useBeanValidation}}
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.validation</groupId>
|
||||||
|
<artifactId>validation-api</artifactId>
|
||||||
|
<version>${beanvalidation-version}</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
{{/useBeanValidation}}
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>start-jetty</id>
|
||||||
|
<phase>pre-integration-test</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>start</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<scanIntervalSeconds>0</scanIntervalSeconds>
|
||||||
|
<daemon>true</daemon>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>stop-jetty</id>
|
||||||
|
<phase>post-integration-test</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>stop</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin-->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
<artifactId>build-helper-maven-plugin</artifactId>
|
||||||
|
<version>1.9.1</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>add-source</id>
|
||||||
|
<phase>generate-sources</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>add-source</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<sources>
|
||||||
|
<source>src/gen/java</source>
|
||||||
|
</sources>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.swagger</groupId>
|
||||||
|
<artifactId>swagger-jaxrs</artifactId>
|
||||||
|
<scope>compile</scope>
|
||||||
|
<version>${swagger-core-version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>ch.qos.logback</groupId>
|
||||||
|
<artifactId>logback-classic</artifactId>
|
||||||
|
<version>${logback-version}</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>ch.qos.logback</groupId>
|
||||||
|
<artifactId>logback-core</artifactId>
|
||||||
|
<version>${logback-version}</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<version>${junit-version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
{{#useBeanValidation}}
|
||||||
|
<!-- Bean Validation API support -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.validation</groupId>
|
||||||
|
<artifactId>validation-api</artifactId>
|
||||||
|
<version>${beanvalidation-version}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
{{/useBeanValidation}}
|
||||||
|
<!-- CXF Client -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.cxf</groupId>
|
||||||
|
<artifactId>cxf-rt-rs-client</artifactId>
|
||||||
|
<version>${cxf-version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- CXF server -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.cxf</groupId>
|
||||||
|
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
|
||||||
|
<version>${cxf-version}</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.cxf</groupId>
|
||||||
|
<artifactId>cxf-rt-rs-service-description</artifactId>
|
||||||
|
<version>${cxf-version}</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.cxf</groupId>
|
||||||
|
<artifactId>cxf-rt-ws-policy</artifactId>
|
||||||
|
<version>${cxf-version}</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.cxf</groupId>
|
||||||
|
<artifactId>cxf-rt-wsdl</artifactId>
|
||||||
|
<version>${cxf-version}</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.jaxrs</groupId>
|
||||||
|
<artifactId>jackson-jaxrs-json-provider</artifactId>
|
||||||
|
<version>${jackson-jaxrs-version}</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.jaxrs</groupId>
|
||||||
|
<artifactId>jackson-jaxrs-xml-provider</artifactId>
|
||||||
|
<version>${jackson-jaxrs-version}</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
{{#java8}}
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||||
|
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||||
|
<version>${jackson-jaxrs-version}</version>
|
||||||
|
</dependency>
|
||||||
|
{{/java8}}
|
||||||
|
{{^java8}}
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||||
|
<artifactId>jackson-datatype-joda</artifactId>
|
||||||
|
<version>${jackson-jaxrs-version}</version>
|
||||||
|
</dependency>
|
||||||
|
{{/java8}}
|
||||||
|
{{#useBeanValidationFeature}}
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.hibernate</groupId>
|
||||||
|
<artifactId>hibernate-validator</artifactId>
|
||||||
|
<version>5.2.2.Final</version>
|
||||||
|
</dependency>
|
||||||
|
{{/useBeanValidationFeature}}
|
||||||
|
</dependencies>
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>sonatype-snapshots</id>
|
||||||
|
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||||
|
<snapshots>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
</snapshots>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
<properties>
|
||||||
|
<java.version>{{#java8}}1.8{{/java8}}{{^java8}}1.7{{/java8}}</java.version>
|
||||||
|
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||||
|
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||||
|
<swagger-core-version>1.5.18</swagger-core-version>
|
||||||
|
<jetty-version>9.2.9.v20150224</jetty-version>
|
||||||
|
<junit-version>4.12</junit-version>
|
||||||
|
<logback-version>1.1.7</logback-version>
|
||||||
|
<servlet-api-version>2.5</servlet-api-version>
|
||||||
|
{{#useBeanValidation}}
|
||||||
|
<beanvalidation-version>1.1.0.Final</beanvalidation-version>
|
||||||
|
{{/useBeanValidation}}
|
||||||
|
<cxf-version>3.3.0</cxf-version>
|
||||||
|
<jackson-jaxrs-version>2.9.8</jackson-jaxrs-version>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
</project>
|
1
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/queryParams.mustache
vendored
Normal file
1
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/queryParams.mustache
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{{#isQueryParam}}@QueryParam("{{baseName}}"){{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}} {{^isContainer}}{{#defaultValue}}@DefaultValue({{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}) {{/defaultValue}}{{/isContainer}}{{{dataType}}} {{paramName}}{{/isQueryParam}}
|
1
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/queryParamsImpl.mustache
vendored
Normal file
1
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/queryParamsImpl.mustache
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{{#isQueryParam}}{{{dataType}}} {{paramName}}{{/isQueryParam}}
|
4
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/returnTypes.mustache
vendored
Normal file
4
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/returnTypes.mustache
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{{#useGenericResponse}}Response{{/useGenericResponse}}{{! non-generic response:
|
||||||
|
}}{{^useGenericResponse}}{{!
|
||||||
|
}}{{{returnType}}}{{!
|
||||||
|
}}{{/useGenericResponse}}
|
@ -0,0 +1,148 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xmlns:cxf="http://cxf.apache.org/core"
|
||||||
|
xmlns:jaxrs="http://cxf.apache.org/jaxrs"
|
||||||
|
xmlns:jee="http://www.springframework.org/schema/jee"
|
||||||
|
xmlns:context="http://www.springframework.org/schema/context"
|
||||||
|
xsi:schemaLocation="http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
|
||||||
|
http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
|
||||||
|
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||||
|
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
|
||||||
|
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd">
|
||||||
|
|
||||||
|
<import resource="classpath:META-INF/cxf/cxf.xml" />
|
||||||
|
|
||||||
|
<!-- JAXRS providers -->
|
||||||
|
<bean id="jsonProvider" class="com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider" />
|
||||||
|
<bean id="xmlProvider" class="com.fasterxml.jackson.jaxrs.xml.JacksonXMLProvider" />
|
||||||
|
<bean id="multipartProvider" class="org.apache.cxf.jaxrs.provider.MultipartProvider" />
|
||||||
|
<bean id="formEncodingProvider" class="org.apache.cxf.jaxrs.provider.FormEncodingProvider" />
|
||||||
|
|
||||||
|
<!-- Controller -->
|
||||||
|
{{#useSpringAnnotationConfig}}
|
||||||
|
<context:annotation-config/>
|
||||||
|
<context:component-scan base-package="{{apiPackage}}.impl" />
|
||||||
|
{{/useSpringAnnotationConfig}}
|
||||||
|
{{^useSpringAnnotationConfig}}
|
||||||
|
{{#apiInfo}}
|
||||||
|
{{#apis}}
|
||||||
|
<bean id="{{classname}}" class="{{package}}.impl.{{classname}}ServiceImpl" />
|
||||||
|
{{/apis}}
|
||||||
|
{{/apiInfo}}
|
||||||
|
|
||||||
|
{{/useSpringAnnotationConfig}}
|
||||||
|
{{#useSwaggerFeature}}
|
||||||
|
<!-- CXF Swagger2Feature -->
|
||||||
|
{{! http://cxf.apache.org/docs/swagger2feature.html }}
|
||||||
|
<bean id="swagger2Feature" class="org.apache.cxf.jaxrs.swagger.Swagger2Feature">
|
||||||
|
<!--property name="basePath" value="/services"/-->
|
||||||
|
{{#useSwaggerUI}}
|
||||||
|
<property name="supportSwaggerUi" value="true" />
|
||||||
|
{{/useSwaggerUI}}
|
||||||
|
<!--property name="contact" value="${swagger.contact}" />
|
||||||
|
<property name="title" value="${swagger.title}" />
|
||||||
|
<property name="version" value="${swagger.version}" />
|
||||||
|
<property name="description" value="${swagger.description}" />
|
||||||
|
<property name="license" value="${swagger.license}" />
|
||||||
|
<property name="licenseUrl" value="${swagger.licenseUrl}" /-->
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
{{/useSwaggerFeature}}
|
||||||
|
<cxf:bus>
|
||||||
|
<cxf:inInterceptors>
|
||||||
|
{{#useGzipFeature}}
|
||||||
|
<ref bean="GZIPInInterceptor"/>
|
||||||
|
{{/useGzipFeature}}
|
||||||
|
{{#useBeanValidationFeature}}
|
||||||
|
<!-- BeanValidation 1.1 for CXF -->
|
||||||
|
<ref bean="validationInInterceptor" />
|
||||||
|
{{/useBeanValidationFeature}}
|
||||||
|
</cxf:inInterceptors>
|
||||||
|
<cxf:outInterceptors>
|
||||||
|
{{#useGzipFeature}}
|
||||||
|
<ref bean="GZIPOutInterceptor"/>
|
||||||
|
{{/useGzipFeature}}
|
||||||
|
{{#useBeanValidationFeature}}
|
||||||
|
<!-- BeanValidation 1.1 for CXF -->
|
||||||
|
<ref bean="validationOutInterceptor" />
|
||||||
|
{{/useBeanValidationFeature}}
|
||||||
|
</cxf:outInterceptors>
|
||||||
|
<cxf:features>
|
||||||
|
{{#useLoggingFeature}}
|
||||||
|
<cxf:logging />
|
||||||
|
{{/useLoggingFeature}}
|
||||||
|
{{#useGzipFeature}}
|
||||||
|
<ref bean="compressGZIPFeature"/>
|
||||||
|
{{/useGzipFeature}}
|
||||||
|
</cxf:features>
|
||||||
|
<cxf:properties>
|
||||||
|
<entry key="javax.ws.rs.ext.ExceptionMapper" value-ref="exceptionMapper"/>
|
||||||
|
</cxf:properties>
|
||||||
|
</cxf:bus>
|
||||||
|
|
||||||
|
{{#useWadlFeature}}
|
||||||
|
<bean id="wadlGenerator"
|
||||||
|
class="org.apache.cxf.jaxrs.model.wadl.WadlGenerator">
|
||||||
|
<property name="linkJsonToXmlSchema" value="true" />
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
{{/useWadlFeature}}
|
||||||
|
{{#useGzipFeature}}
|
||||||
|
<bean id="GZIPInInterceptor" class="org.apache.cxf.transport.common.gzip.GZIPInInterceptor"/>
|
||||||
|
<bean id="GZIPOutInterceptor" class="org.apache.cxf.transport.common.gzip.GZIPOutInterceptor" >
|
||||||
|
<!--property name="force" value="true" /-->
|
||||||
|
<!--property name="threshold" value="0" /-->
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean id="compressGZIPFeature" class="org.apache.cxf.transport.common.gzip.GZIPFeature"/>
|
||||||
|
|
||||||
|
{{/useGzipFeature}}
|
||||||
|
{{#useBeanValidationFeature}}
|
||||||
|
<bean id="commonValidationFeature" class="org.apache.cxf.validation.BeanValidationFeature"/>
|
||||||
|
<bean id="exceptionMapper" class="org.apache.cxf.jaxrs.validation.ValidationExceptionMapper"/>
|
||||||
|
<bean id="validationProvider" class="org.apache.cxf.validation.BeanValidationProvider" />
|
||||||
|
|
||||||
|
<bean id="validationInInterceptor" class="org.apache.cxf.jaxrs.validation.JAXRSBeanValidationInInterceptor">
|
||||||
|
<property name="provider" ref="validationProvider" />
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean id="validationOutInterceptor" class="org.apache.cxf.jaxrs.validation.JAXRSBeanValidationOutInterceptor">
|
||||||
|
<property name="provider" ref="validationProvider" />
|
||||||
|
</bean>
|
||||||
|
{{/useBeanValidationFeature}}
|
||||||
|
{{^useBeanValidationFeature}}
|
||||||
|
<bean id="exceptionMapper" class="org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper">
|
||||||
|
<property name="addMessageToResponse" value="true" />
|
||||||
|
</bean>
|
||||||
|
{{/useBeanValidationFeature}}
|
||||||
|
|
||||||
|
<!-- REST server -->
|
||||||
|
<jaxrs:server id="restServer" address="/services">
|
||||||
|
<jaxrs:serviceBeans>
|
||||||
|
{{#apiInfo}}
|
||||||
|
{{#apis}}
|
||||||
|
<ref bean="{{classname}}" />
|
||||||
|
{{/apis}}
|
||||||
|
{{/apiInfo}}
|
||||||
|
</jaxrs:serviceBeans>
|
||||||
|
<jaxrs:providers>
|
||||||
|
<ref bean="jsonProvider" />
|
||||||
|
<ref bean="xmlProvider" />
|
||||||
|
<ref bean="multipartProvider" />
|
||||||
|
<ref bean="formEncodingProvider" />
|
||||||
|
{{#useWadlFeature}}
|
||||||
|
<ref bean="wadlGenerator" />
|
||||||
|
{{/useWadlFeature}}
|
||||||
|
</jaxrs:providers>
|
||||||
|
<jaxrs:features>
|
||||||
|
{{#useSwaggerFeature}}
|
||||||
|
<ref bean="swagger2Feature" />
|
||||||
|
{{/useSwaggerFeature}}
|
||||||
|
{{#useBeanValidationFeature}}
|
||||||
|
<ref bean="commonValidationFeature" />
|
||||||
|
{{/useBeanValidationFeature}}
|
||||||
|
</jaxrs:features>
|
||||||
|
</jaxrs:server>
|
||||||
|
|
||||||
|
</beans>
|
@ -0,0 +1,25 @@
|
|||||||
|
package {{apiPackage}};
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.SpringBootConfiguration;
|
||||||
|
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||||
|
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||||
|
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||||
|
import org.springframework.context.annotation.ImportResource;
|
||||||
|
|
||||||
|
@ImportResource({"classpath:/ApplicationContext{{#supportMultipleSpringServices}}-{{invokerPackage}}{{/supportMultipleSpringServices}}.xml"})
|
||||||
|
@EnableAutoConfiguration
|
||||||
|
@SpringBootConfiguration
|
||||||
|
public class SpringBootApplication extends SpringBootServletInitializer {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
|
||||||
|
return application.sources(SpringBootApplication.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(SpringBootApplication.class, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
cxf.path=/
|
18
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/server/context.xml.mustache
vendored
Normal file
18
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/server/context.xml.mustache
vendored
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xmlns:cxf="http://cxf.apache.org/core"
|
||||||
|
xmlns:jaxrs="http://cxf.apache.org/jaxrs"
|
||||||
|
xmlns:jee="http://www.springframework.org/schema/jee"
|
||||||
|
xmlns:context="http://www.springframework.org/schema/context"
|
||||||
|
xsi:schemaLocation="http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
|
||||||
|
http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
|
||||||
|
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||||
|
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
|
||||||
|
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<import resource="classpath:/ApplicationContext.xml" />
|
||||||
|
|
||||||
|
</beans>
|
7
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/server/jboss-web.xml.mustache
vendored
Normal file
7
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/server/jboss-web.xml.mustache
vendored
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 2.3//EN" "http://www.jboss.org/j2ee/dtd/jboss-web_3_2.dtd">
|
||||||
|
<jboss-web>
|
||||||
|
|
||||||
|
<context-root>swagger-cxf-server</context-root>
|
||||||
|
|
||||||
|
</jboss-web>
|
26
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/server/nonspring-web.mustache
vendored
Normal file
26
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/server/nonspring-web.mustache
vendored
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||||
|
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" version="3.0"
|
||||||
|
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
|
||||||
|
|
||||||
|
<servlet>
|
||||||
|
<display-name>CXF Non-Spring Jaxrs Servlet</display-name>
|
||||||
|
<servlet-name>CXFNonSpringJaxrsServlet</servlet-name>
|
||||||
|
<servlet-class>org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet</servlet-class>
|
||||||
|
{{#apiInfo}}
|
||||||
|
<init-param>
|
||||||
|
<param-name>jaxrs.serviceClasses</param-name>
|
||||||
|
<param-value>{{#apis}}{{package}}.impl.{{classname}}ServiceImpl{{^-last}},{{/-last}}{{/apis}}</param-value>
|
||||||
|
</init-param>
|
||||||
|
{{/apiInfo}}
|
||||||
|
<init-param>
|
||||||
|
<param-name>jaxrs.providers</param-name>
|
||||||
|
<param-value>com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider</param-value>
|
||||||
|
</init-param>
|
||||||
|
</servlet>
|
||||||
|
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>CXFNonSpringJaxrsServlet</servlet-name>
|
||||||
|
<url-pattern>/rest/*</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
|
||||||
|
</web-app>
|
@ -0,0 +1,25 @@
|
|||||||
|
# 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
|
||||||
|
|
||||||
|
{{#loadTestDataFromFile}}#{{/loadTestDataFromFile}}**/impl/*
|
347
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/server/pom.mustache
vendored
Normal file
347
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/server/pom.mustache
vendored
Normal file
@ -0,0 +1,347 @@
|
|||||||
|
<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>{{groupId}}</groupId>
|
||||||
|
<artifactId>{{artifactId}}</artifactId>
|
||||||
|
<packaging>war</packaging>
|
||||||
|
<name>{{artifactId}}</name>
|
||||||
|
{{#appDescription}}
|
||||||
|
<description>{{appDescription}}</description>
|
||||||
|
{{/appDescription}}
|
||||||
|
<version>{{artifactVersion}}</version>
|
||||||
|
{{#generateSpringBootApplication}}
|
||||||
|
<parent>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
|
<version>2.0.4.RELEASE</version>
|
||||||
|
</parent>
|
||||||
|
{{/generateSpringBootApplication}}
|
||||||
|
<build>
|
||||||
|
<sourceDirectory>src/main/java</sourceDirectory>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-failsafe-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>integration-test</goal>
|
||||||
|
<goal>verify</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<!--plugin>
|
||||||
|
<groupId>org.eclipse.jetty</groupId>
|
||||||
|
<artifactId>jetty-maven-plugin</artifactId>
|
||||||
|
<version>${jetty-version}</version>
|
||||||
|
<configuration>
|
||||||
|
<webApp>
|
||||||
|
<contextPath>/</contextPath>
|
||||||
|
</webApp>
|
||||||
|
<webAppSourceDirectory>target/${project.artifactId}-${project.version}</webAppSourceDirectory>
|
||||||
|
<stopPort>8079</stopPort>
|
||||||
|
<stopKey>stopit</stopKey>
|
||||||
|
<httpConnector>
|
||||||
|
<port>{{serverPort}}</port>
|
||||||
|
<idleTimeout>60000</idleTimeout>
|
||||||
|
</httpConnector>
|
||||||
|
</configuration>
|
||||||
|
{{#useBeanValidation}}
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.validation</groupId>
|
||||||
|
<artifactId>validation-api</artifactId>
|
||||||
|
<version>${beanvalidation-version}</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
{{/useBeanValidation}}
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>start-jetty</id>
|
||||||
|
<phase>pre-integration-test</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>start</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<scanIntervalSeconds>0</scanIntervalSeconds>
|
||||||
|
<daemon>true</daemon>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>stop-jetty</id>
|
||||||
|
<phase>post-integration-test</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>stop</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin-->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
<artifactId>build-helper-maven-plugin</artifactId>
|
||||||
|
{{^generateSpringBootApplication}}
|
||||||
|
<version>1.9.1</version>
|
||||||
|
{{/generateSpringBootApplication}}
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>add-source</id>
|
||||||
|
<phase>generate-sources</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>add-source</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<sources>
|
||||||
|
<source>src/gen/java</source>
|
||||||
|
</sources>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<!-- build WAR file -->
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-war-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.swagger</groupId>
|
||||||
|
<artifactId>swagger-jaxrs</artifactId>
|
||||||
|
<scope>compile</scope>
|
||||||
|
<version>${swagger-core-version}</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>javax.ws.rs</groupId>
|
||||||
|
<artifactId>jsr311-api</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>ch.qos.logback</groupId>
|
||||||
|
<artifactId>logback-classic</artifactId>
|
||||||
|
{{^generateSpringBootApplication}}
|
||||||
|
<version>${logback-version}</version>
|
||||||
|
{{/generateSpringBootApplication}}
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>ch.qos.logback</groupId>
|
||||||
|
<artifactId>logback-core</artifactId>
|
||||||
|
{{^generateSpringBootApplication}}
|
||||||
|
<version>${logback-version}</version>
|
||||||
|
{{/generateSpringBootApplication}}
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
{{^generateSpringBootApplication}}
|
||||||
|
<version>${junit-version}</version>
|
||||||
|
{{/generateSpringBootApplication}}
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
{{#useBeanValidation}}
|
||||||
|
<!-- Bean Validation API support -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.validation</groupId>
|
||||||
|
<artifactId>validation-api</artifactId>
|
||||||
|
{{^generateSpringBootApplication}}
|
||||||
|
<version>${beanvalidation-version}</version>
|
||||||
|
{{/generateSpringBootApplication}}
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
{{/useBeanValidation}}
|
||||||
|
<!-- CXF Client -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.cxf</groupId>
|
||||||
|
<artifactId>cxf-rt-rs-client</artifactId>
|
||||||
|
<version>${cxf-version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<!-- CXF Server -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.cxf</groupId>
|
||||||
|
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
|
||||||
|
<version>${cxf-version}</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.cxf</groupId>
|
||||||
|
<artifactId>cxf-rt-rs-service-description</artifactId>
|
||||||
|
<version>${cxf-version}</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.cxf</groupId>
|
||||||
|
<artifactId>cxf-rt-rs-service-description-swagger</artifactId>
|
||||||
|
<version>${cxf-version}</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.cxf</groupId>
|
||||||
|
<artifactId>cxf-rt-ws-policy</artifactId>
|
||||||
|
<version>${cxf-version}</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.cxf</groupId>
|
||||||
|
<artifactId>cxf-rt-wsdl</artifactId>
|
||||||
|
<version>${cxf-version}</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<!-- Jackson -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.jaxrs</groupId>
|
||||||
|
<artifactId>jackson-jaxrs-json-provider</artifactId>
|
||||||
|
{{^generateSpringBootApplication}}
|
||||||
|
<version>${jackson-jaxrs-version}</version>
|
||||||
|
{{/generateSpringBootApplication}}
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.jaxrs</groupId>
|
||||||
|
<artifactId>jackson-jaxrs-xml-provider</artifactId>
|
||||||
|
{{^generateSpringBootApplication}}
|
||||||
|
<version>${jackson-jaxrs-version}</version>
|
||||||
|
{{/generateSpringBootApplication}}
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
{{#java8}}
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||||
|
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||||
|
{{^generateSpringBootApplication}}
|
||||||
|
<version>${jackson-jaxrs-version}</version>
|
||||||
|
{{/generateSpringBootApplication}}
|
||||||
|
</dependency>
|
||||||
|
{{/java8}}
|
||||||
|
{{^java8}}
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||||
|
<artifactId>jackson-datatype-joda</artifactId>
|
||||||
|
{{^generateSpringBootApplication}}
|
||||||
|
<version>${jackson-jaxrs-version}</version>
|
||||||
|
{{/generateSpringBootApplication}}
|
||||||
|
</dependency>
|
||||||
|
{{/java8}}
|
||||||
|
{{#generateSpringApplication}}
|
||||||
|
<!-- Spring Framework -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-core</artifactId>
|
||||||
|
{{^generateSpringBootApplication}}
|
||||||
|
<version>${spring-version}</version>
|
||||||
|
{{/generateSpringBootApplication}}
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-aop</artifactId>
|
||||||
|
{{^generateSpringBootApplication}}
|
||||||
|
<version>${spring-version}</version>
|
||||||
|
{{/generateSpringBootApplication}}
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-context</artifactId>
|
||||||
|
{{^generateSpringBootApplication}}
|
||||||
|
<version>${spring-version}</version>
|
||||||
|
{{/generateSpringBootApplication}}
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-web</artifactId>
|
||||||
|
{{^generateSpringBootApplication}}
|
||||||
|
<version>${spring-version}</version>
|
||||||
|
{{/generateSpringBootApplication}}
|
||||||
|
</dependency>
|
||||||
|
{{/generateSpringApplication}}
|
||||||
|
{{#generateSpringBootApplication}}
|
||||||
|
<!-- Spring Boot dependencies for integration tests -->
|
||||||
|
<!--dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-tomcat</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-autoconfigure</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.cxf</groupId>
|
||||||
|
<artifactId>cxf-spring-boot-starter-jaxrs</artifactId>
|
||||||
|
<version>${cxf-version}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
{{/generateSpringBootApplication}}
|
||||||
|
{{#useSwaggerUI}}
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.webjars</groupId>
|
||||||
|
<artifactId>swagger-ui</artifactId>
|
||||||
|
<version>3.6.1</version>
|
||||||
|
</dependency>
|
||||||
|
{{/useSwaggerUI}}
|
||||||
|
{{#generateOperationBody}}
|
||||||
|
{{#loadTestDataFromFile}}
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.openapitools</groupId>
|
||||||
|
<artifactId>openapi-generator</artifactId>
|
||||||
|
<version>{{{generatorVersion}}}</version>
|
||||||
|
</dependency>
|
||||||
|
{{/loadTestDataFromFile}}
|
||||||
|
{{/generateOperationBody}}
|
||||||
|
</dependencies>
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>sonatype-snapshots</id>
|
||||||
|
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||||
|
<snapshots>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
</snapshots>
|
||||||
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>sonatype-releases</id>
|
||||||
|
<url>https://oss.sonatype.org/content/repositories/releases</url>
|
||||||
|
<snapshots>
|
||||||
|
<enabled>false</enabled>
|
||||||
|
</snapshots>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
<properties>
|
||||||
|
<java.version>{{#supportJava6}}1.6{{/supportJava6}}{{^supportJava6}}{{^java8}}1.7{{/java8}}{{#java8}}1.8{{/java8}}{{/supportJava6}}</java.version>
|
||||||
|
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||||
|
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||||
|
<swagger-core-version>1.5.18</swagger-core-version>
|
||||||
|
<jetty-version>9.2.9.v20150224</jetty-version>
|
||||||
|
{{#useBeanValidation}}
|
||||||
|
<beanvalidation-version>1.1.0.Final</beanvalidation-version>
|
||||||
|
{{/useBeanValidation}}
|
||||||
|
{{#generateSpringApplication}}
|
||||||
|
{{^generateSpringBootApplication}}
|
||||||
|
<spring-version>5.0.8.RELEASE</spring-version>
|
||||||
|
{{/generateSpringBootApplication}}
|
||||||
|
{{/generateSpringApplication}}
|
||||||
|
{{^generateSpringBootApplication}}
|
||||||
|
<junit-version>4.12</junit-version>
|
||||||
|
<logback-version>1.1.7</logback-version>
|
||||||
|
{{/generateSpringBootApplication}}
|
||||||
|
<cxf-version>3.3.0</cxf-version>
|
||||||
|
<jackson-jaxrs-version>2.9.8</jackson-jaxrs-version>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
</project>
|
@ -0,0 +1,33 @@
|
|||||||
|
# JAX-RS CXF 3 server application
|
||||||
|
|
||||||
|
## Supported features
|
||||||
|
* Bean-Validation-API support
|
||||||
|
* Spring-configuration of Swagger, WADL and Endpoints
|
||||||
|
* Swagger-API is accessible (CXF3 Swagger2Feature)
|
||||||
|
* Swagger-UI can be included as Web-Jar automatically
|
||||||
|
* WADL is accessible (CXF WADL-Generator)
|
||||||
|
* Unit-tests include Gzip-Interceptors for demonstration
|
||||||
|
* Options for generating a functional mock server returning static responses
|
||||||
|
|
||||||
|
## URLs to access the REST API
|
||||||
|
### URLs for Spring Boot
|
||||||
|
|
||||||
|
* Available services listing
|
||||||
|
http://localhost:8080/
|
||||||
|
|
||||||
|
* OpenAPI
|
||||||
|
http://localhost:8080/services/openapi.json
|
||||||
|
|
||||||
|
* CXF WADL
|
||||||
|
http://localhost:8080/services?_wadl
|
||||||
|
|
||||||
|
|
||||||
|
### URLs if deployed to an Application Server
|
||||||
|
* Available services listing
|
||||||
|
http://localhost:8080/swagger-cxf-server/rest/services/
|
||||||
|
|
||||||
|
* OpenAPI
|
||||||
|
http://localhost:8080/swagger-cxf-server/rest/services/swagger.json
|
||||||
|
|
||||||
|
* CXF WADL
|
||||||
|
http://localhost:8080/swagger-cxf-server/rest/services?_wadl
|
23
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/server/web.mustache
vendored
Normal file
23
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/server/web.mustache
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||||
|
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" version="3.0"
|
||||||
|
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
|
||||||
|
|
||||||
|
<context-param>
|
||||||
|
<param-name>contextConfigLocation</param-name>
|
||||||
|
<param-value>WEB-INF/context.xml</param-value>
|
||||||
|
</context-param>
|
||||||
|
<listener>
|
||||||
|
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
|
||||||
|
</listener>
|
||||||
|
<servlet>
|
||||||
|
<display-name>CXF Service Servlet</display-name>
|
||||||
|
<servlet-name>CXFServiceServlet</servlet-name>
|
||||||
|
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
|
||||||
|
<load-on-startup>1</load-on-startup>
|
||||||
|
</servlet>
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>CXFServiceServlet</servlet-name>
|
||||||
|
<url-pattern>/rest/*</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
|
||||||
|
</web-app>
|
1
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/testData.mustache
vendored
Normal file
1
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/testData.mustache
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{{{test-data.json}}}
|
1
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/testDataControl.mustache
vendored
Normal file
1
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/testDataControl.mustache
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{{{test-data-control.json}}}
|
@ -48,6 +48,7 @@ org.openapitools.codegen.languages.JavaPlayFrameworkCodegen
|
|||||||
org.openapitools.codegen.languages.JavaUndertowServerCodegen
|
org.openapitools.codegen.languages.JavaUndertowServerCodegen
|
||||||
org.openapitools.codegen.languages.JavaVertXServerCodegen
|
org.openapitools.codegen.languages.JavaVertXServerCodegen
|
||||||
org.openapitools.codegen.languages.JavaCXFServerCodegen
|
org.openapitools.codegen.languages.JavaCXFServerCodegen
|
||||||
|
org.openapitools.codegen.languages.JavaCXFExtServerCodegen
|
||||||
org.openapitools.codegen.languages.JavaJAXRSCXFCDIServerCodegen
|
org.openapitools.codegen.languages.JavaJAXRSCXFCDIServerCodegen
|
||||||
org.openapitools.codegen.languages.JavaJerseyServerCodegen
|
org.openapitools.codegen.languages.JavaJerseyServerCodegen
|
||||||
org.openapitools.codegen.languages.JavaResteasyServerCodegen
|
org.openapitools.codegen.languages.JavaResteasyServerCodegen
|
||||||
|
@ -0,0 +1,837 @@
|
|||||||
|
package org.openapitools.codegen.java.jaxrs;
|
||||||
|
|
||||||
|
import static org.testng.Assert.assertEquals;
|
||||||
|
import static org.testng.Assert.assertNotNull;
|
||||||
|
import static org.testng.Assert.assertNull;
|
||||||
|
import static org.testng.Assert.assertTrue;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import org.openapitools.codegen.ClientOptInput;
|
||||||
|
import org.openapitools.codegen.ClientOpts;
|
||||||
|
import org.openapitools.codegen.CodegenConstants;
|
||||||
|
import org.openapitools.codegen.CodegenOperation;
|
||||||
|
import org.openapitools.codegen.MockDefaultGenerator;
|
||||||
|
import org.openapitools.codegen.MockDefaultGenerator.WrittenTemplateBasedFile;
|
||||||
|
import org.openapitools.codegen.TestUtils;
|
||||||
|
import org.openapitools.codegen.languages.AbstractJavaCodegen;
|
||||||
|
import org.openapitools.codegen.languages.AbstractJavaJAXRSServerCodegen;
|
||||||
|
import org.openapitools.codegen.languages.JavaCXFExtServerCodegen;
|
||||||
|
import org.openapitools.codegen.languages.features.BeanValidationExtendedFeatures;
|
||||||
|
import org.openapitools.codegen.languages.features.BeanValidationFeatures;
|
||||||
|
import org.openapitools.codegen.languages.features.CXFExtServerFeatures;
|
||||||
|
import org.openapitools.codegen.languages.features.CXFServerFeatures;
|
||||||
|
import org.openapitools.codegen.languages.features.GzipFeatures;
|
||||||
|
import org.openapitools.codegen.languages.features.GzipTestFeatures;
|
||||||
|
import org.openapitools.codegen.languages.features.JbossFeature;
|
||||||
|
import org.openapitools.codegen.languages.features.LoggingFeatures;
|
||||||
|
import org.openapitools.codegen.languages.features.LoggingTestFeatures;
|
||||||
|
import org.openapitools.codegen.languages.features.SpringFeatures;
|
||||||
|
import org.openapitools.codegen.languages.features.SwaggerFeatures;
|
||||||
|
import org.openapitools.codegen.languages.features.SwaggerUIFeatures;
|
||||||
|
import org.openapitools.codegen.languages.features.UseGenericResponseFeatures;
|
||||||
|
import org.testng.annotations.BeforeMethod;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
import io.swagger.parser.OpenAPIParser;
|
||||||
|
import io.swagger.v3.oas.models.OpenAPI;
|
||||||
|
import io.swagger.v3.oas.models.servers.Server;
|
||||||
|
import io.swagger.v3.parser.core.models.ParseOptions;
|
||||||
|
|
||||||
|
public class JavaJAXRSCXFExtServerCodegenTest {
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
private static class JavaCXFExtServerCodegenTester extends JavaCXFExtServerCodegen {
|
||||||
|
/* Options processed by DefaultCodegen */
|
||||||
|
|
||||||
|
// CodegenConstants.ALLOW_UNICODE_IDENTIFIERS
|
||||||
|
public Boolean getAllowUnicodeIdentifiers() {
|
||||||
|
return allowUnicodeIdentifiers;
|
||||||
|
}
|
||||||
|
|
||||||
|
// CodegenConstants.API_PACKAGE
|
||||||
|
public String getApiPackage() {
|
||||||
|
return apiPackage;
|
||||||
|
}
|
||||||
|
|
||||||
|
// CodegenConstants.DOCEXTENSION
|
||||||
|
// String getDocExtension();
|
||||||
|
|
||||||
|
// CodegenConstants.ARTIFACT_DESCRIPTION
|
||||||
|
public String getArtifactDescription() {
|
||||||
|
return artifactDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
// CodegenConstants.ARTIFACT_ID
|
||||||
|
public String getArtifactId() {
|
||||||
|
return artifactId;
|
||||||
|
}
|
||||||
|
|
||||||
|
// CodegenConstants.ARTIFACT_URL
|
||||||
|
public String getArtifactUrl() {
|
||||||
|
return artifactUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// CodegenConstants.ARTIFACT_VERSION
|
||||||
|
public String getArtifactVersion() {
|
||||||
|
return artifactVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
// AbstractJavaCodegen.BOOLEAN_GETTER_PREFIX
|
||||||
|
public String getBooleanGetterPrefix() {
|
||||||
|
return booleanGetterPrefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
// AbstractJavaCodegen.DATE_LIBRARY
|
||||||
|
public String getDateLibrary() {
|
||||||
|
return dateLibrary;
|
||||||
|
}
|
||||||
|
|
||||||
|
// CodegenConstants.DEVELOPER_EMAIL
|
||||||
|
public String getDeveloperEmail() {
|
||||||
|
return developerEmail;
|
||||||
|
}
|
||||||
|
|
||||||
|
// CodegenConstants.DEVELOPER_NAME
|
||||||
|
public String getDeveloperName() {
|
||||||
|
return developerName;
|
||||||
|
}
|
||||||
|
|
||||||
|
// CodegenConstants.DEVELOPER_ORGANIZATION
|
||||||
|
public String getDeveloperOrganization() {
|
||||||
|
return developerOrganization;
|
||||||
|
}
|
||||||
|
|
||||||
|
// CodegenConstants.DEVELOPER_ORGANIZATION_URL
|
||||||
|
public String getDeveloperOrganizationUrl() {
|
||||||
|
return developerOrganizationUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Options processed by AbstractJavaCodegen */
|
||||||
|
|
||||||
|
// CodegenConstants.ENSURE_UNIQUE_PARAMS
|
||||||
|
public Boolean getEnsureUniqueParams() {
|
||||||
|
return ensureUniqueParams;
|
||||||
|
}
|
||||||
|
|
||||||
|
// CodegenConstants.GROUP_ID
|
||||||
|
public String getGroupId() {
|
||||||
|
return groupId;
|
||||||
|
}
|
||||||
|
|
||||||
|
// CodegenConstants.HIDE_GENERATION_TIMESTAMP
|
||||||
|
public Boolean getHideGenerationTimestamp() {
|
||||||
|
return hideGenerationTimestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
// CodegenConstants.IMPL_FOLDER
|
||||||
|
public String getImplFolder() {
|
||||||
|
return implFolder;
|
||||||
|
}
|
||||||
|
|
||||||
|
// CodegenConstants.INVOKER_PACKAGE
|
||||||
|
public String getInvokerPackage() {
|
||||||
|
return invokerPackage;
|
||||||
|
}
|
||||||
|
|
||||||
|
// CodegenConstants.LICENSE_NAME
|
||||||
|
public String getLicenseName() {
|
||||||
|
return licenseName;
|
||||||
|
}
|
||||||
|
|
||||||
|
// CodegenConstants.LICENSE_URL
|
||||||
|
public String getLicenseUrl() {
|
||||||
|
return licenseUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// CodegenConstants.LOCAL_VARIABLE_PREFIX
|
||||||
|
public String getLocalVariablePrefix() {
|
||||||
|
return localVariablePrefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
// CodegenConstants.MODEL_NAME_PREFIX
|
||||||
|
public String getModelNamePrefix() {
|
||||||
|
return modelNamePrefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
// CodegenConstants.MODEL_NAME_SUFFIX
|
||||||
|
public String getModelNameSuffix() {
|
||||||
|
return modelNameSuffix;
|
||||||
|
}
|
||||||
|
|
||||||
|
// CodegenConstants.MODEL_PACKAGE
|
||||||
|
public String getModelPackage() {
|
||||||
|
return modelPackage;
|
||||||
|
}
|
||||||
|
|
||||||
|
// CodegenConstants.PREPEND_FORM_OR_BODY_PARAMETERS
|
||||||
|
public Boolean getPrependFormOrBodyParameters() {
|
||||||
|
return prependFormOrBodyParameters;
|
||||||
|
}
|
||||||
|
|
||||||
|
// CodegenConstants.REMOVE_OPERATION_ID_PREFIX
|
||||||
|
boolean getRemoveOperationIdPrefix() {
|
||||||
|
return removeOperationIdPrefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
// CodegenConstants.SCM_CONNECTION
|
||||||
|
public String getScmConnection() {
|
||||||
|
return scmConnection;
|
||||||
|
}
|
||||||
|
|
||||||
|
// CodegenConstants.SCM_DEVELOPER_CONNECTION
|
||||||
|
public String getScmDeveloperConnection() {
|
||||||
|
return scmDeveloperConnection;
|
||||||
|
}
|
||||||
|
|
||||||
|
// CodegenConstants.SCM_URL
|
||||||
|
public String getScmUrl() {
|
||||||
|
return scmUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// CodegenConstants.SERIALIZABLE_MODEL
|
||||||
|
public Boolean getSerializableModel() {
|
||||||
|
return serializableModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
// CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG
|
||||||
|
public Boolean getSortParamsByRequiredFlag() {
|
||||||
|
return sortParamsByRequiredFlag;
|
||||||
|
}
|
||||||
|
|
||||||
|
// CodegenConstants.SOURCE_FOLDER
|
||||||
|
public String getSourceFolder() {
|
||||||
|
return sourceFolder;
|
||||||
|
}
|
||||||
|
|
||||||
|
// AbstractJavaCodegen.BOOLEAN_GETTER_PREFIX_DEFAULT (UNUSED)
|
||||||
|
|
||||||
|
// CodegenConstants.TEMPLATE_DIR
|
||||||
|
public String getTemplateDir() {
|
||||||
|
return templateDir;
|
||||||
|
}
|
||||||
|
|
||||||
|
// AbstractJavaCodegen.DEFAULT_LIBRARY (UNUSED)
|
||||||
|
|
||||||
|
// CXFServerFeatures.TEST_DATA_CONTROL_FILE
|
||||||
|
public File getTestDataControlFile() {
|
||||||
|
return testDataControlFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
// CXFServerFeatures.ADD_CONSUMES_PRODUCES_JSON
|
||||||
|
public boolean isAddConsumesProducesJson() {
|
||||||
|
return addConsumesProducesJson;
|
||||||
|
}
|
||||||
|
|
||||||
|
// AbstractJavaCodegen.DISABLE_HTML_ESCAPING
|
||||||
|
public boolean isDisableHtmlEscaping() {
|
||||||
|
return disableHtmlEscaping;
|
||||||
|
}
|
||||||
|
|
||||||
|
// AbstractJavaCodegen.FULL_JAVA_UTIL
|
||||||
|
public boolean isFullJavaUtil() {
|
||||||
|
return fullJavaUtil;
|
||||||
|
}
|
||||||
|
|
||||||
|
// JbossFeature.GENERATE_JBOSS_DEPLOYMENT_DESCRIPTOR
|
||||||
|
public boolean isGenerateJbossDeploymentDescriptor() {
|
||||||
|
return generateJbossDeploymentDescriptor;
|
||||||
|
}
|
||||||
|
|
||||||
|
// CXFServerFeatures.GENERATE_NON_SPRING_APPLICATION
|
||||||
|
public boolean isGenerateNonSpringApplication() {
|
||||||
|
return generateNonSpringApplication;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Options processed by AbstractJavaJAXRSServerCodegen */
|
||||||
|
|
||||||
|
// SpringFeatures.GENERATE_SPRING_APPLICATION
|
||||||
|
public boolean isGenerateSpringApplication() {
|
||||||
|
return generateSpringApplication;
|
||||||
|
}
|
||||||
|
|
||||||
|
// AbstractJavaJAXRSServerCodegen.SERVER_PORT (no corresponding field)
|
||||||
|
|
||||||
|
/* Options processed by JavaCXFServerCodegen */
|
||||||
|
|
||||||
|
// SpringFeatures.GENERATE_SPRING_BOOT_APPLICATION
|
||||||
|
public boolean isGenerateSpringBootApplication() {
|
||||||
|
return generateSpringBootApplication;
|
||||||
|
}
|
||||||
|
|
||||||
|
// AbstractJavaCodegen.JAVA8_MODE
|
||||||
|
public boolean isJava8Mode() {
|
||||||
|
return java8Mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
// CodegenConstants.SERIALIZE_BIG_DECIMAL_AS_STRING
|
||||||
|
public boolean isSerializeBigDecimalAsString() {
|
||||||
|
return serializeBigDecimalAsString;
|
||||||
|
}
|
||||||
|
|
||||||
|
// AbstractJavaCodegen.SUPPORT_ASYNC
|
||||||
|
public boolean isSupportAsync() {
|
||||||
|
return supportAsync;
|
||||||
|
}
|
||||||
|
|
||||||
|
// AbstractJavaCodegen.SUPPORT_JAVA6
|
||||||
|
public boolean isSupportJava6() {
|
||||||
|
return supportJava6;
|
||||||
|
}
|
||||||
|
|
||||||
|
// CXFServerFeatures.USE_ANNOTATED_BASE_PATH
|
||||||
|
public boolean isUseAnnotatedBasePath() {
|
||||||
|
return useAnnotatedBasePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
// BeanValidationFeatures.USE_BEANVALIDATION
|
||||||
|
public boolean isUseBeanValidation() {
|
||||||
|
return useBeanValidation;
|
||||||
|
}
|
||||||
|
|
||||||
|
// BeanValidationExtendedFeatures.USE_BEANVALIDATION_FEATURE
|
||||||
|
public boolean isUseBeanValidationFeature() {
|
||||||
|
return useBeanValidationFeature;
|
||||||
|
}
|
||||||
|
|
||||||
|
// UseGenericResponseFeatures.USE_GENERIC_RESPONSE
|
||||||
|
public boolean isUseGenericResponse() {
|
||||||
|
return useGenericResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
// GzipFeatures.USE_GZIP_FEATURE
|
||||||
|
public boolean isUseGzipFeature() {
|
||||||
|
return useGzipFeature;
|
||||||
|
}
|
||||||
|
|
||||||
|
// GzipTestFeatures.USE_GZIP_FEATURE_FOR_TESTS
|
||||||
|
public boolean isUseGzipFeatureForTests() {
|
||||||
|
return useGzipFeatureForTests;
|
||||||
|
}
|
||||||
|
|
||||||
|
// LoggingFeatures.USE_LOGGING_FEATURE
|
||||||
|
public boolean isUseLoggingFeature() {
|
||||||
|
return useLoggingFeature;
|
||||||
|
}
|
||||||
|
|
||||||
|
// LoggingTestFeatures.USE_LOGGING_FEATURE_FOR_TESTS
|
||||||
|
public boolean isUseLoggingFeatureForTests() {
|
||||||
|
return useLoggingFeatureForTests;
|
||||||
|
}
|
||||||
|
|
||||||
|
// CXFServerFeatures.USE_MULTIPART_FEATURE
|
||||||
|
public boolean isUseMultipartFeature() {
|
||||||
|
return useMultipartFeature;
|
||||||
|
}
|
||||||
|
|
||||||
|
// AbstractJavaCodegen.USE_NULL_FOR_UNKNOWN_ENUM_VALUE
|
||||||
|
public boolean isUseNullForUnknownEnumValue() {
|
||||||
|
return useNullForUnknownEnumValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// SpringFeatures.USE_SPRING_ANNOTATION_CONFIG
|
||||||
|
public boolean isUseSpringAnnotationConfig() {
|
||||||
|
return useSpringAnnotationConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
// SwaggerFeatures.USE_SWAGGER_FEATURE
|
||||||
|
public boolean isUseSwaggerFeature() {
|
||||||
|
return useSwaggerFeature;
|
||||||
|
}
|
||||||
|
|
||||||
|
// SwaggerUIFeatures.USE_SWAGGER_UI
|
||||||
|
public boolean isUseSwaggerUI() {
|
||||||
|
return useSwaggerUI;
|
||||||
|
}
|
||||||
|
|
||||||
|
// CXFServerFeatures.USE_WADL_FEATURE
|
||||||
|
public boolean isUseWadlFeature() {
|
||||||
|
return useWadlFeature;
|
||||||
|
}
|
||||||
|
|
||||||
|
// AbstractJavaCodegen.WITH_XML
|
||||||
|
public boolean isWithXml() {
|
||||||
|
return withXml;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Options processed by JavaCXFExtServerCodegen */
|
||||||
|
|
||||||
|
// CXFExtServerFeatures.GENERATE_OPERATION_BODY
|
||||||
|
public boolean isGenerateOperationBody() {
|
||||||
|
return generateOperationBody;
|
||||||
|
}
|
||||||
|
|
||||||
|
// CXFExtServerFeatures.TEST_DATA_FILE
|
||||||
|
public File getTestDataFile() {
|
||||||
|
return testDataFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
// CXFExtServerFeatures.LOAD_TEST_DATA_FROM_FILE
|
||||||
|
public boolean isLoadTestDataFromFile() {
|
||||||
|
return loadTestDataFromFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
// CXFExtServerFeatures.SUPPORT_MULTIPLE_SPRING_SERVICES
|
||||||
|
public boolean isSupportMultipleSpringServices() {
|
||||||
|
return supportMultipleSpringServices;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private JavaCXFExtServerCodegenTester codegen;
|
||||||
|
|
||||||
|
@BeforeMethod
|
||||||
|
public void beforeMethod() {
|
||||||
|
codegen = new JavaCXFExtServerCodegenTester();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkFile(MockDefaultGenerator generator, String path, boolean fileShouldExist, String... regexes) {
|
||||||
|
String file = generator.getFiles().get(path);
|
||||||
|
if (fileShouldExist)
|
||||||
|
assertNotNull(file);
|
||||||
|
else
|
||||||
|
assertNull(file);
|
||||||
|
for (String regex : regexes)
|
||||||
|
assertTrue(Pattern.compile(regex).matcher(file).find());
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
private List<CodegenOperation> getOperationsList(Map<String, Object> templateData) {
|
||||||
|
assertTrue(templateData.get("operations") instanceof Map);
|
||||||
|
Map<String, Object> operations = (Map<String, Object>) templateData.get("operations");
|
||||||
|
assertTrue(operations.get("operation") instanceof List);
|
||||||
|
return (List<CodegenOperation>) operations.get("operation");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testAdditionalPropertiesPutForConfigValues() throws Exception {
|
||||||
|
Map<String, Object> additionalProperties = codegen.additionalProperties();
|
||||||
|
|
||||||
|
// Options processed by DefaultCodegen
|
||||||
|
additionalProperties.put(CodegenConstants.ALLOW_UNICODE_IDENTIFIERS, "true");
|
||||||
|
additionalProperties.put(CodegenConstants.API_PACKAGE, "xyz.yyyyy.aaaaa.api");
|
||||||
|
additionalProperties.put(CodegenConstants.DOCEXTENSION, "doc");
|
||||||
|
additionalProperties.put(CodegenConstants.ENSURE_UNIQUE_PARAMS, "true");
|
||||||
|
additionalProperties.put(CodegenConstants.HIDE_GENERATION_TIMESTAMP, "true");
|
||||||
|
additionalProperties.put(CodegenConstants.INVOKER_PACKAGE, "xyz.yyyyy.iiii.invoker");
|
||||||
|
additionalProperties.put(CodegenConstants.MODEL_NAME_PREFIX, "MyPrefix");
|
||||||
|
additionalProperties.put(CodegenConstants.MODEL_NAME_SUFFIX, "MySuffix");
|
||||||
|
additionalProperties.put(CodegenConstants.MODEL_PACKAGE, "xyz.yyyyy.mmmmm.model");
|
||||||
|
additionalProperties.put(CodegenConstants.PREPEND_FORM_OR_BODY_PARAMETERS, "true");
|
||||||
|
additionalProperties.put(CodegenConstants.REMOVE_OPERATION_ID_PREFIX, "true");
|
||||||
|
additionalProperties.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, "true");
|
||||||
|
additionalProperties.put(CodegenConstants.TEMPLATE_DIR, "MyTemplates");
|
||||||
|
// Options processed by AbstractJavaCodegen
|
||||||
|
additionalProperties.put(CodegenConstants.ARTIFACT_DESCRIPTION, "My description");
|
||||||
|
additionalProperties.put(CodegenConstants.ARTIFACT_ID, "my-artifact");
|
||||||
|
additionalProperties.put(CodegenConstants.ARTIFACT_VERSION, "9.9.9");
|
||||||
|
additionalProperties.put(CodegenConstants.ARTIFACT_URL, "http://organisation.org/group/artifact");
|
||||||
|
additionalProperties.put(CodegenConstants.DEVELOPER_EMAIL, "dchappie@organisation.org");
|
||||||
|
additionalProperties.put(CodegenConstants.DEVELOPER_NAME, "Developer Chappie");
|
||||||
|
additionalProperties.put(CodegenConstants.DEVELOPER_ORGANIZATION, "My Organisation");
|
||||||
|
additionalProperties.put(CodegenConstants.DEVELOPER_ORGANIZATION_URL, "http://www.organisation.org/");
|
||||||
|
additionalProperties.put(CodegenConstants.GROUP_ID, "org.organisation.group.id");
|
||||||
|
additionalProperties.put(CodegenConstants.LICENSE_NAME, "Apache 2.0");
|
||||||
|
additionalProperties.put(CodegenConstants.LICENSE_URL, "https://www.apache.org/licenses/LICENSE-2.0");
|
||||||
|
additionalProperties.put(CodegenConstants.SCM_CONNECTION, "http://svn.organisation.org/group/");
|
||||||
|
additionalProperties.put(CodegenConstants.SCM_DEVELOPER_CONNECTION, "http://svn.organisation.org/dev/group/");
|
||||||
|
additionalProperties.put(CodegenConstants.SCM_URL, "http://svn.organisation.org/group/");
|
||||||
|
additionalProperties.put(CodegenConstants.SERIALIZE_BIG_DECIMAL_AS_STRING, "true");
|
||||||
|
additionalProperties.put(CodegenConstants.SERIALIZABLE_MODEL, "true");
|
||||||
|
additionalProperties.put(CodegenConstants.SOURCE_FOLDER, "src/main/java");
|
||||||
|
additionalProperties.put(AbstractJavaCodegen.BOOLEAN_GETTER_PREFIX, "isIt");
|
||||||
|
additionalProperties.put(AbstractJavaCodegen.DATE_LIBRARY, "MyDateLibrary");
|
||||||
|
additionalProperties.put(AbstractJavaCodegen.DISABLE_HTML_ESCAPING, "true");
|
||||||
|
additionalProperties.put(AbstractJavaCodegen.FULL_JAVA_UTIL, "true");
|
||||||
|
additionalProperties.put(AbstractJavaCodegen.JAVA8_MODE, "true");
|
||||||
|
additionalProperties.put(AbstractJavaCodegen.SUPPORT_ASYNC, "true");
|
||||||
|
additionalProperties.put(AbstractJavaCodegen.SUPPORT_JAVA6, "false");
|
||||||
|
additionalProperties.put(AbstractJavaCodegen.USE_NULL_FOR_UNKNOWN_ENUM_VALUE, "true");
|
||||||
|
additionalProperties.put(AbstractJavaCodegen.WITH_XML, "true");
|
||||||
|
// Options processed by AbstractJavaJAXRSServerCodegen
|
||||||
|
additionalProperties.put(CodegenConstants.IMPL_FOLDER, "myimpl");
|
||||||
|
additionalProperties.put(BeanValidationFeatures.USE_BEANVALIDATION, "true");
|
||||||
|
additionalProperties.put(AbstractJavaJAXRSServerCodegen.SERVER_PORT, "8088");
|
||||||
|
// Options processed by JavaCXFServerCodegen
|
||||||
|
additionalProperties.put(BeanValidationExtendedFeatures.USE_BEANVALIDATION_FEATURE, Boolean.TRUE);
|
||||||
|
additionalProperties.put(GzipFeatures.USE_GZIP_FEATURE, Boolean.TRUE);
|
||||||
|
additionalProperties.put(GzipTestFeatures.USE_GZIP_FEATURE_FOR_TESTS, "true");
|
||||||
|
additionalProperties.put(JbossFeature.GENERATE_JBOSS_DEPLOYMENT_DESCRIPTOR, Boolean.TRUE);
|
||||||
|
additionalProperties.put(LoggingFeatures.USE_LOGGING_FEATURE, Boolean.TRUE);
|
||||||
|
additionalProperties.put(LoggingTestFeatures.USE_LOGGING_FEATURE_FOR_TESTS, "true");
|
||||||
|
additionalProperties.put(SpringFeatures.GENERATE_SPRING_APPLICATION, Boolean.TRUE);
|
||||||
|
additionalProperties.put(SpringFeatures.GENERATE_SPRING_BOOT_APPLICATION, Boolean.TRUE);
|
||||||
|
additionalProperties.put(SpringFeatures.USE_SPRING_ANNOTATION_CONFIG, Boolean.TRUE);
|
||||||
|
additionalProperties.put(SwaggerFeatures.USE_SWAGGER_FEATURE, Boolean.TRUE);
|
||||||
|
additionalProperties.put(SwaggerUIFeatures.USE_SWAGGER_UI, Boolean.TRUE);
|
||||||
|
additionalProperties.put(UseGenericResponseFeatures.USE_GENERIC_RESPONSE, "true");
|
||||||
|
additionalProperties.put(CXFServerFeatures.ADD_CONSUMES_PRODUCES_JSON, Boolean.TRUE);
|
||||||
|
additionalProperties.put(CXFServerFeatures.GENERATE_NON_SPRING_APPLICATION, Boolean.FALSE);
|
||||||
|
additionalProperties.put(CXFServerFeatures.LOAD_TEST_DATA_FROM_FILE, Boolean.TRUE);
|
||||||
|
additionalProperties.put(CXFServerFeatures.USE_ANNOTATED_BASE_PATH, Boolean.TRUE);
|
||||||
|
additionalProperties.put(CXFServerFeatures.USE_MULTIPART_FEATURE, Boolean.TRUE);
|
||||||
|
additionalProperties.put(CXFServerFeatures.USE_WADL_FEATURE, Boolean.TRUE);
|
||||||
|
// Options processed by JavaCXFExtServerCodegen
|
||||||
|
additionalProperties.put(CXFExtServerFeatures.GENERATE_OPERATION_BODY, Boolean.TRUE);
|
||||||
|
additionalProperties.put(CXFExtServerFeatures.SUPPORT_MULTIPLE_SPRING_SERVICES, Boolean.TRUE);
|
||||||
|
additionalProperties.put(CXFExtServerFeatures.TEST_DATA_FILE, "my/test-data.json");
|
||||||
|
additionalProperties.put(CXFExtServerFeatures.TEST_DATA_CONTROL_FILE, "my/test-data-control.json");
|
||||||
|
|
||||||
|
codegen.processOpts();
|
||||||
|
|
||||||
|
OpenAPI openAPI = new OpenAPI();
|
||||||
|
openAPI.addServersItem(new Server().url("https://api.abcde.xy:8082/v2"));
|
||||||
|
codegen.preprocessOpenAPI(openAPI);
|
||||||
|
|
||||||
|
// Options processed by DefaultCodegen
|
||||||
|
assertEquals(codegen.getAllowUnicodeIdentifiers(), Boolean.TRUE);
|
||||||
|
assertEquals(codegen.apiPackage(), "xyz.yyyyy.aaaaa.api");
|
||||||
|
assertEquals(codegen.getDocExtension(), "doc");
|
||||||
|
assertEquals(codegen.getEnsureUniqueParams(), Boolean.TRUE);
|
||||||
|
assertEquals(codegen.isHideGenerationTimestamp(), true);
|
||||||
|
assertEquals(codegen.getInvokerPackage(), "xyz.yyyyy.iiii.invoker");
|
||||||
|
assertEquals(codegen.getModelNamePrefix(), "MyPrefix");
|
||||||
|
assertEquals(codegen.getModelNameSuffix(), "MySuffix");
|
||||||
|
assertEquals(codegen.getModelPackage(), "xyz.yyyyy.mmmmm.model");
|
||||||
|
assertEquals(codegen.getPrependFormOrBodyParameters(), Boolean.TRUE);
|
||||||
|
assertEquals(codegen.getRemoveOperationIdPrefix(), true);
|
||||||
|
assertEquals(codegen.getSortParamsByRequiredFlag(), Boolean.TRUE);
|
||||||
|
assertEquals(codegen.getTemplateDir(), "MyTemplates");
|
||||||
|
assertEquals(codegen.getArtifactDescription(), "My description");
|
||||||
|
// Options processed by AbstractJavaCodegen
|
||||||
|
assertEquals(codegen.getArtifactId(), "my-artifact");
|
||||||
|
assertEquals(codegen.getArtifactVersion(), "9.9.9");
|
||||||
|
assertEquals(codegen.getArtifactUrl(), "http://organisation.org/group/artifact");
|
||||||
|
assertEquals(codegen.getDeveloperEmail(), "dchappie@organisation.org");
|
||||||
|
assertEquals(codegen.getDeveloperName(), "Developer Chappie");
|
||||||
|
assertEquals(codegen.getDeveloperOrganization(), "My Organisation");
|
||||||
|
assertEquals(codegen.getDeveloperOrganizationUrl(), "http://www.organisation.org/");
|
||||||
|
assertEquals(codegen.getGroupId(), "org.organisation.group.id");
|
||||||
|
assertEquals(codegen.getLicenseName(), "Apache 2.0");
|
||||||
|
assertEquals(codegen.getLicenseUrl(), "https://www.apache.org/licenses/LICENSE-2.0");
|
||||||
|
assertEquals(codegen.getScmConnection(), "http://svn.organisation.org/group/");
|
||||||
|
assertEquals(codegen.getScmDeveloperConnection(), "http://svn.organisation.org/dev/group/");
|
||||||
|
assertEquals(codegen.getScmUrl(), "http://svn.organisation.org/group/");
|
||||||
|
assertEquals(codegen.isSerializeBigDecimalAsString(), true);
|
||||||
|
assertEquals(codegen.getSerializableModel(), Boolean.TRUE);
|
||||||
|
assertEquals(codegen.getSourceFolder(), "src/main/java");
|
||||||
|
assertEquals(codegen.getBooleanGetterPrefix(), "isIt");
|
||||||
|
assertEquals(codegen.getDateLibrary(), "MyDateLibrary");
|
||||||
|
assertEquals(codegen.isDisableHtmlEscaping(), true);
|
||||||
|
assertEquals(codegen.isFullJavaUtil(), true);
|
||||||
|
assertEquals(codegen.isJava8Mode(), true);
|
||||||
|
assertEquals(codegen.isSupportAsync(), true);
|
||||||
|
assertEquals(codegen.isUseNullForUnknownEnumValue(), true);
|
||||||
|
assertEquals(codegen.isWithXml(), true);
|
||||||
|
// Options processed by AbstractJavaJAXRSServerCodegen
|
||||||
|
assertEquals(codegen.getImplFolder(), "myimpl");
|
||||||
|
assertEquals(codegen.isUseBeanValidation(), true);
|
||||||
|
// assertEquals(codegen.getServerPort(), 8088);
|
||||||
|
// Options processed by JavaCXFServerCodegen
|
||||||
|
File curdir = new File(System.getProperty("user.dir"));
|
||||||
|
assertEquals(codegen.isUseBeanValidationFeature(), true);
|
||||||
|
assertEquals(codegen.isUseGzipFeature(), true);
|
||||||
|
assertEquals(codegen.isUseGzipFeatureForTests(), true);
|
||||||
|
assertEquals(codegen.isGenerateJbossDeploymentDescriptor(), true);
|
||||||
|
assertEquals(codegen.isUseLoggingFeature(), true);
|
||||||
|
assertEquals(codegen.isUseLoggingFeatureForTests(), true);
|
||||||
|
assertEquals(codegen.isGenerateSpringApplication(), true);
|
||||||
|
assertEquals(codegen.isGenerateSpringBootApplication(), true);
|
||||||
|
assertEquals(codegen.isUseSpringAnnotationConfig(), true);
|
||||||
|
assertEquals(codegen.isUseSwaggerFeature(), true);
|
||||||
|
assertEquals(codegen.isUseSwaggerUI(), true);
|
||||||
|
assertEquals(codegen.isUseGenericResponse(), true);
|
||||||
|
assertEquals(codegen.isAddConsumesProducesJson(), true);
|
||||||
|
assertEquals(codegen.isGenerateNonSpringApplication(), false);
|
||||||
|
assertEquals(codegen.isUseAnnotatedBasePath(), true);
|
||||||
|
assertEquals(codegen.isUseMultipartFeature(), true);
|
||||||
|
assertEquals(codegen.isUseWadlFeature(), true);
|
||||||
|
// Options processed by JavaCXFExtServerCodegen
|
||||||
|
assertEquals(codegen.isGenerateOperationBody(), true);
|
||||||
|
assertEquals(codegen.isLoadTestDataFromFile(), true);
|
||||||
|
assertEquals(codegen.isSupportMultipleSpringServices(), true);
|
||||||
|
assertEquals(codegen.getTestDataFile(), new File(curdir, "my/test-data.json"));
|
||||||
|
assertEquals(codegen.getTestDataControlFile(), new File(curdir, "my/test-data-control.json"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testAddOperationToGroup() throws Exception {
|
||||||
|
File output = Files.createTempDirectory("test").toFile();
|
||||||
|
output.deleteOnExit();
|
||||||
|
|
||||||
|
OpenAPI openAPI = new OpenAPIParser().readLocation("src/test/resources/3_0/tags.yaml", null, new ParseOptions())
|
||||||
|
.getOpenAPI();
|
||||||
|
codegen.setOutputDir(output.getAbsolutePath());
|
||||||
|
|
||||||
|
ClientOpts opts = new ClientOpts();
|
||||||
|
ClientOptInput input = new ClientOptInput();
|
||||||
|
input.setOpenAPI(openAPI);
|
||||||
|
input.setConfig(codegen);
|
||||||
|
input.setOpts(opts);
|
||||||
|
|
||||||
|
MockDefaultGenerator generator = new MockDefaultGenerator();
|
||||||
|
generator.opts(input).generate();
|
||||||
|
|
||||||
|
WrittenTemplateBasedFile tag1File = TestUtils.getTemplateBasedFile(generator, output,
|
||||||
|
"src/gen/java/org/openapitools/api/Tag1Api.java");
|
||||||
|
assertEquals(tag1File.getTemplateData().get("baseName"), "Tag1");
|
||||||
|
assertEquals(tag1File.getTemplateData().get("commonPath"), "Tag1");
|
||||||
|
List<CodegenOperation> tag1List = getOperationsList(tag1File.getTemplateData());
|
||||||
|
assertEquals(tag1List.size(), 1);
|
||||||
|
assertEquals(tag1List.get(0).path, "/group1/op1");
|
||||||
|
assertEquals(tag1List.get(0).baseName, "Tag1");
|
||||||
|
assertEquals(tag1List.get(0).subresourceOperation, true);
|
||||||
|
|
||||||
|
WrittenTemplateBasedFile tag2File = TestUtils.getTemplateBasedFile(generator, output,
|
||||||
|
"src/gen/java/org/openapitools/api/Tag2Api.java");
|
||||||
|
assertEquals(tag2File.getTemplateData().get("baseName"), "Tag2");
|
||||||
|
assertEquals(tag2File.getTemplateData().get("commonPath"), "Tag2");
|
||||||
|
List<CodegenOperation> tag2List = getOperationsList(tag2File.getTemplateData());
|
||||||
|
assertEquals(tag2List.size(), 2);
|
||||||
|
assertEquals(tag2List.get(0).path, "/group1/op2");
|
||||||
|
assertEquals(tag2List.get(0).baseName, "Tag2");
|
||||||
|
assertEquals(tag2List.get(0).subresourceOperation, true);
|
||||||
|
assertEquals(tag2List.get(1).path, "/group2/op3");
|
||||||
|
assertEquals(tag2List.get(1).baseName, "Tag2");
|
||||||
|
assertEquals(tag2List.get(1).subresourceOperation, true);
|
||||||
|
|
||||||
|
WrittenTemplateBasedFile defaultFile = TestUtils.getTemplateBasedFile(generator, output,
|
||||||
|
"src/gen/java/org/openapitools/api/DefaultApi.java");
|
||||||
|
assertEquals(defaultFile.getTemplateData().get("baseName"), "Default");
|
||||||
|
assertEquals(defaultFile.getTemplateData().get("commonPath"), "Default");
|
||||||
|
List<CodegenOperation> defaultList = getOperationsList(defaultFile.getTemplateData());
|
||||||
|
assertEquals(defaultList.size(), 1);
|
||||||
|
assertEquals(defaultList.get(0).path, "/group3/op4");
|
||||||
|
assertEquals(defaultList.get(0).baseName, "Default");
|
||||||
|
assertEquals(defaultList.get(0).subresourceOperation, true);
|
||||||
|
|
||||||
|
WrittenTemplateBasedFile group4File = TestUtils.getTemplateBasedFile(generator, output,
|
||||||
|
"src/gen/java/org/openapitools/api/Group4Api.java");
|
||||||
|
assertEquals(group4File.getTemplateData().get("baseName"), "Group4");
|
||||||
|
assertEquals(group4File.getTemplateData().get("commonPath"), "Group4");
|
||||||
|
List<CodegenOperation> group4List = getOperationsList(group4File.getTemplateData());
|
||||||
|
assertEquals(group4List.size(), 2);
|
||||||
|
assertEquals(group4List.get(0).path, "/group4/op5");
|
||||||
|
assertEquals(group4List.get(0).baseName, "Group4");
|
||||||
|
assertEquals(group4List.get(0).subresourceOperation, true);
|
||||||
|
assertEquals(group4List.get(1).path, "/group4/op6");
|
||||||
|
assertEquals(group4List.get(1).baseName, "Group4");
|
||||||
|
assertEquals(group4List.get(1).subresourceOperation, true);
|
||||||
|
|
||||||
|
WrittenTemplateBasedFile group5File = TestUtils.getTemplateBasedFile(generator, output,
|
||||||
|
"src/gen/java/org/openapitools/api/Group5Api.java");
|
||||||
|
assertEquals(group5File.getTemplateData().get("baseName"), "Group5");
|
||||||
|
assertEquals(group5File.getTemplateData().get("commonPath"), "Group5");
|
||||||
|
List<CodegenOperation> group5List = getOperationsList(group5File.getTemplateData());
|
||||||
|
assertEquals(group5List.size(), 2);
|
||||||
|
assertEquals(group5List.get(0).path, "/group5/op7");
|
||||||
|
assertEquals(group5List.get(0).baseName, "Group5");
|
||||||
|
assertEquals(group5List.get(0).subresourceOperation, true);
|
||||||
|
assertEquals(group5List.get(1).path, "/group6/op8");
|
||||||
|
assertEquals(group5List.get(1).baseName, "Group5");
|
||||||
|
assertEquals(group5List.get(1).subresourceOperation, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGenerateOperationBodyWithCodedTestData() throws Exception {
|
||||||
|
File output = Files.createTempDirectory("test").toFile();
|
||||||
|
output.deleteOnExit();
|
||||||
|
String outputPath = output.getCanonicalPath().replace('\\', '/');
|
||||||
|
|
||||||
|
OpenAPI openAPI = new OpenAPIParser()
|
||||||
|
.readLocation("src/test/resources/3_0/petstore.yaml", null, new ParseOptions()).getOpenAPI();
|
||||||
|
codegen.setOutputDir(output.getAbsolutePath());
|
||||||
|
|
||||||
|
ClientOpts opts = new ClientOpts();
|
||||||
|
opts.getProperties().put(CXFExtServerFeatures.GENERATE_OPERATION_BODY, "true");
|
||||||
|
|
||||||
|
ClientOptInput input = new ClientOptInput();
|
||||||
|
input.setOpenAPI(openAPI);
|
||||||
|
input.setConfig(codegen);
|
||||||
|
input.setOpts(opts);
|
||||||
|
|
||||||
|
MockDefaultGenerator generator = new MockDefaultGenerator();
|
||||||
|
generator.opts(input).generate();
|
||||||
|
|
||||||
|
String reGetPetById = "(?s)(?m)public Pet getPetById\\(Long petId\\) \\{" // split
|
||||||
|
+ ".*" // split
|
||||||
|
+ "Pet response = new Pet\\(\\);" // split
|
||||||
|
+ ".*" // split
|
||||||
|
+ "return response;\\s+" // split
|
||||||
|
+ "\\}"; // split
|
||||||
|
checkFile(generator, outputPath + "/src/main/java/org/openapitools/api/impl/PetApiServiceImpl.java", true,
|
||||||
|
reGetPetById);
|
||||||
|
|
||||||
|
String reFindPetsByStatusTest = "(?s)(?m)public void findPetsByStatusTest\\(\\) throws Exception \\{\\s+"
|
||||||
|
+ ".*" // split
|
||||||
|
+ "List<String> status = new ArrayList<>\\(\\);" // split
|
||||||
|
+ ".*" // split
|
||||||
|
+ "List<Pet> response = api\\.findPetsByStatus\\(status\\);" // split
|
||||||
|
+ ".*" // split
|
||||||
|
+ "validate\\(response\\);\\s+" // split
|
||||||
|
+ "\\}";
|
||||||
|
checkFile(generator, outputPath + "/src/test/java/org/openapitools/api/PetApiTest.java", true,
|
||||||
|
reFindPetsByStatusTest);
|
||||||
|
|
||||||
|
checkFile(generator, outputPath + "/src/main/resources/test-data.json", false);
|
||||||
|
|
||||||
|
checkFile(generator, outputPath + "/test-data-control.json", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGenerateOperationBodyWithJsonTestData() throws Exception {
|
||||||
|
File output = Files.createTempDirectory("test").toFile();
|
||||||
|
output.deleteOnExit();
|
||||||
|
String outputPath = output.getCanonicalPath().replace('\\', '/');
|
||||||
|
|
||||||
|
OpenAPI openAPI = new OpenAPIParser()
|
||||||
|
.readLocation("src/test/resources/3_0/petstore.yaml", null, new ParseOptions()).getOpenAPI();
|
||||||
|
codegen.setOutputDir(output.getAbsolutePath());
|
||||||
|
|
||||||
|
ClientOpts opts = new ClientOpts();
|
||||||
|
opts.getProperties().put(CXFExtServerFeatures.GENERATE_OPERATION_BODY, "true");
|
||||||
|
opts.getProperties().put(CXFServerFeatures.LOAD_TEST_DATA_FROM_FILE, "true");
|
||||||
|
|
||||||
|
ClientOptInput input = new ClientOptInput();
|
||||||
|
input.setOpenAPI(openAPI);
|
||||||
|
input.setConfig(codegen);
|
||||||
|
input.setOpts(opts);
|
||||||
|
|
||||||
|
MockDefaultGenerator generator = new MockDefaultGenerator();
|
||||||
|
generator.opts(input).generate();
|
||||||
|
|
||||||
|
String reInitCache = "(?s)(?m)\\{\\s+" + "try \\{\\s+"
|
||||||
|
+ "File cacheFile = new File\\(System\\.getProperty\\(\"jaxrs\\.test\\.server\\.json\",\\s+\"(.+)\"\\)\\);\\s+"
|
||||||
|
+ "cache = JsonCache\\.Factory\\.instance\\.get\\(\"test-data\"\\)\\.load\\(cacheFile\\)\\.child\\(\"/org\\.openapitools\\.api/PetApi\"\\);";
|
||||||
|
String reGetPetById = "(?s)(?m)public Pet getPetById\\(Long petId\\) \\{.*" // split
|
||||||
|
+ "try \\{\\s*" // split
|
||||||
|
+ "Pet response = cache\\.getObject\\(\"/getPetById/response\", Pet\\.class\\);";
|
||||||
|
checkFile(generator, outputPath + "/src/main/java/org/openapitools/api/impl/PetApiServiceImpl.java", true,
|
||||||
|
reInitCache, reGetPetById);
|
||||||
|
|
||||||
|
reInitCache = "(?s)(?m)public static void beforeClass\\(\\) throws Exception \\{\\s+"
|
||||||
|
+ "File cacheFile = new File\\(System\\.getProperty\\(\"jaxrs\\.test\\.client\\.json\",\\s+"
|
||||||
|
+ "\".*src(?:\\\\\\\\|/)main(?:\\\\\\\\|/)resources(?:\\\\\\\\|/)test-data\\.json\"\\)\\);\\s+"
|
||||||
|
+ "cache = JsonCache\\.Factory\\.instance.get\\(\"test-data\"\\)\\.load\\(cacheFile\\)"
|
||||||
|
+ "\\.child\\(\"/org\\.openapitools\\.api/PetApi\"\\);";
|
||||||
|
String reAddPetTest = "public void addPetTest\\(\\) throws Exception \\{\\s+"
|
||||||
|
+ "Pet pet = cache\\.getObject\\(\"/addPet/pet\", Pet\\.class\\);";
|
||||||
|
checkFile(generator, outputPath + "/src/test/java/org/openapitools/api/PetApiTest.java", true, reInitCache,
|
||||||
|
reAddPetTest);
|
||||||
|
|
||||||
|
checkFile(generator, outputPath + "/src/main/resources/test-data.json", true);
|
||||||
|
|
||||||
|
checkFile(generator, outputPath + "/test-data-control.json", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testInitialConfigValues() throws Exception {
|
||||||
|
codegen.processOpts();
|
||||||
|
|
||||||
|
OpenAPI openAPI = new OpenAPI();
|
||||||
|
openAPI.addServersItem(new Server().url("https://api.abcde.xy:8082/v2"));
|
||||||
|
codegen.preprocessOpenAPI(openAPI);
|
||||||
|
|
||||||
|
Map<String, Object> additionalProperties = codegen.additionalProperties();
|
||||||
|
|
||||||
|
// Options processed by DefaultCodegen
|
||||||
|
assertNull(additionalProperties.get(CodegenConstants.ALLOW_UNICODE_IDENTIFIERS));
|
||||||
|
assertEquals(additionalProperties.get(CodegenConstants.API_PACKAGE), "org.openapitools.api");
|
||||||
|
assertEquals(codegen.apiPackage(), "org.openapitools.api");
|
||||||
|
assertNull(additionalProperties.get(CodegenConstants.DOCEXTENSION));
|
||||||
|
assertNull(additionalProperties.get(CodegenConstants.ENSURE_UNIQUE_PARAMS));
|
||||||
|
assertEquals(additionalProperties.get(CodegenConstants.HIDE_GENERATION_TIMESTAMP), Boolean.FALSE);
|
||||||
|
assertEquals(codegen.isHideGenerationTimestamp(), false);
|
||||||
|
assertEquals(additionalProperties.get(CodegenConstants.INVOKER_PACKAGE), "org.openapitools.api");
|
||||||
|
assertEquals(codegen.getInvokerPackage(), "org.openapitools.api");
|
||||||
|
assertNull(additionalProperties.get(CodegenConstants.MODEL_NAME_PREFIX));
|
||||||
|
assertNull(additionalProperties.get(CodegenConstants.MODEL_NAME_SUFFIX));
|
||||||
|
assertEquals(additionalProperties.get(CodegenConstants.MODEL_PACKAGE), "org.openapitools.model");
|
||||||
|
assertEquals(codegen.modelPackage(), "org.openapitools.model");
|
||||||
|
assertNull(additionalProperties.get(CodegenConstants.PREPEND_FORM_OR_BODY_PARAMETERS));
|
||||||
|
assertNull(additionalProperties.get(CodegenConstants.REMOVE_OPERATION_ID_PREFIX));
|
||||||
|
assertNull(additionalProperties.get(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG));
|
||||||
|
assertNull(additionalProperties.get(CodegenConstants.TEMPLATE_DIR));
|
||||||
|
// Options processed by AbstractJavaCodegen
|
||||||
|
assertEquals(additionalProperties.get(CodegenConstants.ARTIFACT_DESCRIPTION), "OpenAPI Java");
|
||||||
|
assertEquals(additionalProperties.get(CodegenConstants.ARTIFACT_ID), "openapi-cxf-server");
|
||||||
|
assertEquals(additionalProperties.get(CodegenConstants.ARTIFACT_VERSION), "1.0.0");
|
||||||
|
assertEquals(additionalProperties.get(CodegenConstants.ARTIFACT_URL),
|
||||||
|
"https://github.com/openapitools/openapi-generator");
|
||||||
|
assertEquals(additionalProperties.get(CodegenConstants.DEVELOPER_EMAIL), "team@openapitools.org");
|
||||||
|
assertEquals(additionalProperties.get(CodegenConstants.DEVELOPER_NAME), "OpenAPI-Generator Contributors");
|
||||||
|
assertEquals(additionalProperties.get(CodegenConstants.DEVELOPER_ORGANIZATION), "OpenAPITools.org");
|
||||||
|
assertEquals(additionalProperties.get(CodegenConstants.DEVELOPER_ORGANIZATION_URL), "http://openapitools.org");
|
||||||
|
assertEquals(additionalProperties.get(CodegenConstants.GROUP_ID), "org.openapitools");
|
||||||
|
assertEquals(additionalProperties.get(CodegenConstants.LICENSE_NAME), "Unlicense");
|
||||||
|
assertEquals(additionalProperties.get(CodegenConstants.LICENSE_URL), "http://unlicense.org");
|
||||||
|
assertEquals(additionalProperties.get(CodegenConstants.SCM_CONNECTION),
|
||||||
|
"scm:git:git@github.com:openapitools/openapi-generator.git");
|
||||||
|
assertEquals(additionalProperties.get(CodegenConstants.SCM_DEVELOPER_CONNECTION),
|
||||||
|
"scm:git:git@github.com:openapitools/openapi-generator.git");
|
||||||
|
assertEquals(additionalProperties.get(CodegenConstants.SCM_URL),
|
||||||
|
"https://github.com/openapitools/openapi-generator");
|
||||||
|
assertNull(additionalProperties.get(CodegenConstants.SERIALIZE_BIG_DECIMAL_AS_STRING));
|
||||||
|
assertEquals(additionalProperties.get(CodegenConstants.SERIALIZABLE_MODEL), Boolean.FALSE);
|
||||||
|
assertEquals(additionalProperties.get(CodegenConstants.SOURCE_FOLDER), "src/gen/java");
|
||||||
|
assertEquals(additionalProperties.get(AbstractJavaCodegen.BOOLEAN_GETTER_PREFIX), "get");
|
||||||
|
assertNull(additionalProperties.get(AbstractJavaCodegen.DATE_LIBRARY));
|
||||||
|
assertEquals(additionalProperties.get(AbstractJavaCodegen.DISABLE_HTML_ESCAPING), Boolean.FALSE);
|
||||||
|
assertEquals(additionalProperties.get(AbstractJavaCodegen.FULL_JAVA_UTIL), Boolean.FALSE);
|
||||||
|
assertNull(additionalProperties.get(AbstractJavaCodegen.JAVA8_MODE));
|
||||||
|
assertNull(additionalProperties.get(AbstractJavaCodegen.SUPPORT_ASYNC));
|
||||||
|
assertEquals(additionalProperties.get(AbstractJavaCodegen.SUPPORT_JAVA6), Boolean.FALSE);
|
||||||
|
assertEquals(additionalProperties.get(AbstractJavaCodegen.USE_NULL_FOR_UNKNOWN_ENUM_VALUE), false);
|
||||||
|
assertEquals(additionalProperties.get(AbstractJavaCodegen.WITH_XML), false);
|
||||||
|
// Options processed by AbstractJavaJAXRSServerCodegen
|
||||||
|
assertNull(additionalProperties.get(CodegenConstants.IMPL_FOLDER));
|
||||||
|
assertEquals(additionalProperties.get(BeanValidationFeatures.USE_BEANVALIDATION), Boolean.TRUE);
|
||||||
|
assertEquals(additionalProperties.get(AbstractJavaJAXRSServerCodegen.SERVER_PORT), "8082");
|
||||||
|
// Options processed by JavaCXFServerCodegen
|
||||||
|
assertNull(additionalProperties.get(BeanValidationExtendedFeatures.USE_BEANVALIDATION_FEATURE));
|
||||||
|
assertNull(additionalProperties.get(GzipFeatures.USE_GZIP_FEATURE));
|
||||||
|
assertNull(additionalProperties.get(GzipTestFeatures.USE_GZIP_FEATURE_FOR_TESTS));
|
||||||
|
assertNull(additionalProperties.get(JbossFeature.GENERATE_JBOSS_DEPLOYMENT_DESCRIPTOR));
|
||||||
|
assertNull(additionalProperties.get(LoggingFeatures.USE_LOGGING_FEATURE));
|
||||||
|
assertNull(additionalProperties.get(LoggingTestFeatures.USE_LOGGING_FEATURE_FOR_TESTS));
|
||||||
|
assertNull(additionalProperties.get(SpringFeatures.GENERATE_SPRING_APPLICATION));
|
||||||
|
assertNull(additionalProperties.get(SpringFeatures.GENERATE_SPRING_BOOT_APPLICATION));
|
||||||
|
assertNull(additionalProperties.get(SpringFeatures.USE_SPRING_ANNOTATION_CONFIG));
|
||||||
|
assertNull(additionalProperties.get(SwaggerFeatures.USE_SWAGGER_FEATURE));
|
||||||
|
assertNull(additionalProperties.get(SwaggerUIFeatures.USE_SWAGGER_UI));
|
||||||
|
assertNull(additionalProperties.get(UseGenericResponseFeatures.USE_GENERIC_RESPONSE));
|
||||||
|
assertNull(additionalProperties.get(CXFServerFeatures.ADD_CONSUMES_PRODUCES_JSON));
|
||||||
|
assertNull(additionalProperties.get(CXFServerFeatures.GENERATE_NON_SPRING_APPLICATION));
|
||||||
|
assertNull(additionalProperties.get(CXFExtServerFeatures.GENERATE_OPERATION_BODY));
|
||||||
|
assertNull(additionalProperties.get(CXFServerFeatures.LOAD_TEST_DATA_FROM_FILE));
|
||||||
|
assertNull(additionalProperties.get(CXFExtServerFeatures.SUPPORT_MULTIPLE_SPRING_SERVICES));
|
||||||
|
assertNull(additionalProperties.get(CXFExtServerFeatures.TEST_DATA_FILE));
|
||||||
|
assertNull(additionalProperties.get(CXFExtServerFeatures.TEST_DATA_CONTROL_FILE));
|
||||||
|
assertNull(additionalProperties.get(CXFServerFeatures.USE_ANNOTATED_BASE_PATH));
|
||||||
|
assertNull(additionalProperties.get(CXFServerFeatures.USE_MULTIPART_FEATURE));
|
||||||
|
assertNull(additionalProperties.get(CXFServerFeatures.USE_WADL_FEATURE));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSettersForConfigValues() throws Exception {
|
||||||
|
// It's apparent that most of these setters aren't useful to client code, only to the generator itself. The only
|
||||||
|
// reliable way to set most features is through the additional properties, since CodegenConfig.processOpts()
|
||||||
|
// overrides are typically coded to set config fields from the additional properties, not the other way round.
|
||||||
|
codegen.setHideGenerationTimestamp(false);
|
||||||
|
codegen.setModelPackage("xx.yyyyyyyy.model");
|
||||||
|
codegen.setApiPackage("xx.yyyyyyyy.api");
|
||||||
|
codegen.setInvokerPackage("xx.yyyyyyyy.invoker");
|
||||||
|
codegen.processOpts();
|
||||||
|
|
||||||
|
Map<String, Object> additionalProperties = codegen.additionalProperties();
|
||||||
|
assertEquals(additionalProperties.get(CodegenConstants.HIDE_GENERATION_TIMESTAMP), Boolean.FALSE);
|
||||||
|
assertEquals(codegen.isHideGenerationTimestamp(), false);
|
||||||
|
assertEquals(codegen.modelPackage(), "xx.yyyyyyyy.model");
|
||||||
|
assertEquals(additionalProperties.get(CodegenConstants.MODEL_PACKAGE), "xx.yyyyyyyy.model");
|
||||||
|
assertEquals(codegen.apiPackage(), "xx.yyyyyyyy.api");
|
||||||
|
assertEquals(additionalProperties.get(CodegenConstants.API_PACKAGE), "xx.yyyyyyyy.api");
|
||||||
|
assertEquals(codegen.getInvokerPackage(), "xx.yyyyyyyy.invoker");
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
@ -1,10 +1,10 @@
|
|||||||
<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">
|
<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>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>io.swagger</groupId>
|
<groupId>org.openapitools</groupId>
|
||||||
<artifactId>jaxrs-cxf-petstore-client</artifactId>
|
<artifactId>jaxrs-cxf-petstore-client</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<name>jaxrs-cxf-petstore-client</name>
|
<name>jaxrs-cxf-petstore-client</name>
|
||||||
<description>This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.</description>
|
<description>This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.</description>
|
||||||
<version>1.0.0</version>
|
<version>1.0.0</version>
|
||||||
<build>
|
<build>
|
||||||
<sourceDirectory>src/main/java</sourceDirectory>
|
<sourceDirectory>src/main/java</sourceDirectory>
|
||||||
|
@ -39,7 +39,7 @@ public interface PetApi {
|
|||||||
@ApiOperation(value = "Add a new pet to the store", tags={ })
|
@ApiOperation(value = "Add a new pet to the store", tags={ })
|
||||||
@ApiResponses(value = {
|
@ApiResponses(value = {
|
||||||
@ApiResponse(code = 405, message = "Invalid input") })
|
@ApiResponse(code = 405, message = "Invalid input") })
|
||||||
public void addPet(Pet pet);
|
public void addPet(Pet body);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes a pet
|
* Deletes a pet
|
||||||
@ -110,7 +110,7 @@ public interface PetApi {
|
|||||||
@ApiResponse(code = 400, message = "Invalid ID supplied"),
|
@ApiResponse(code = 400, message = "Invalid ID supplied"),
|
||||||
@ApiResponse(code = 404, message = "Pet not found"),
|
@ApiResponse(code = 404, message = "Pet not found"),
|
||||||
@ApiResponse(code = 405, message = "Validation exception") })
|
@ApiResponse(code = 405, message = "Validation exception") })
|
||||||
public void updatePet(Pet pet);
|
public void updatePet(Pet body);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates a pet in the store with form data
|
* Updates a pet in the store with form data
|
||||||
|
@ -82,6 +82,6 @@ public interface StoreApi {
|
|||||||
@ApiResponses(value = {
|
@ApiResponses(value = {
|
||||||
@ApiResponse(code = 200, message = "successful operation", response = Order.class),
|
@ApiResponse(code = 200, message = "successful operation", response = Order.class),
|
||||||
@ApiResponse(code = 400, message = "Invalid Order") })
|
@ApiResponse(code = 400, message = "Invalid Order") })
|
||||||
public Order placeOrder(Order order);
|
public Order placeOrder(Order body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ public interface UserApi {
|
|||||||
@ApiOperation(value = "Create user", tags={ })
|
@ApiOperation(value = "Create user", tags={ })
|
||||||
@ApiResponses(value = {
|
@ApiResponses(value = {
|
||||||
@ApiResponse(code = 200, message = "successful operation") })
|
@ApiResponse(code = 200, message = "successful operation") })
|
||||||
public void createUser(User user);
|
public void createUser(User body);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates list of users with given input array
|
* Creates list of users with given input array
|
||||||
@ -49,7 +49,7 @@ public interface UserApi {
|
|||||||
@ApiOperation(value = "Creates list of users with given input array", tags={ })
|
@ApiOperation(value = "Creates list of users with given input array", tags={ })
|
||||||
@ApiResponses(value = {
|
@ApiResponses(value = {
|
||||||
@ApiResponse(code = 200, message = "successful operation") })
|
@ApiResponse(code = 200, message = "successful operation") })
|
||||||
public void createUsersWithArrayInput(List<User> user);
|
public void createUsersWithArrayInput(List<User> body);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates list of users with given input array
|
* Creates list of users with given input array
|
||||||
@ -60,7 +60,7 @@ public interface UserApi {
|
|||||||
@ApiOperation(value = "Creates list of users with given input array", tags={ })
|
@ApiOperation(value = "Creates list of users with given input array", tags={ })
|
||||||
@ApiResponses(value = {
|
@ApiResponses(value = {
|
||||||
@ApiResponse(code = 200, message = "successful operation") })
|
@ApiResponse(code = 200, message = "successful operation") })
|
||||||
public void createUsersWithListInput(List<User> user);
|
public void createUsersWithListInput(List<User> body);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete user
|
* Delete user
|
||||||
@ -126,6 +126,6 @@ public interface UserApi {
|
|||||||
@ApiResponses(value = {
|
@ApiResponses(value = {
|
||||||
@ApiResponse(code = 400, message = "Invalid user supplied"),
|
@ApiResponse(code = 400, message = "Invalid user supplied"),
|
||||||
@ApiResponse(code = 404, message = "User not found") })
|
@ApiResponse(code = 404, message = "User not found") })
|
||||||
public void updateUser(@PathParam("username") String username, User user);
|
public void updateUser(@PathParam("username") String username, User body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/**
|
/**
|
||||||
* Swagger Petstore
|
* OpenAPI Petstore
|
||||||
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||||
*
|
*
|
||||||
* OpenAPI spec version: 1.0.0
|
* OpenAPI spec version: 1.0.0
|
||||||
* Contact: apiteam@swagger.io
|
*
|
||||||
*
|
*
|
||||||
* NOTE: This class is auto generated by the swagger code generator program.
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
* https://github.com/swagger-api/swagger-codegen.git
|
* https://openapi-generator.tech
|
||||||
* Do not edit the class manually.
|
* Do not edit the class manually.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@ -49,9 +49,9 @@ import java.util.Map;
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Swagger Petstore
|
* OpenAPI Petstore
|
||||||
*
|
*
|
||||||
* <p>This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
* <p>This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||||
*
|
*
|
||||||
* API tests for PetApi
|
* API tests for PetApi
|
||||||
*/
|
*/
|
||||||
@ -81,8 +81,8 @@ public class PetApiTest {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void addPetTest() {
|
public void addPetTest() {
|
||||||
Pet pet = null;
|
Pet body = null;
|
||||||
//api.addPet(pet);
|
//api.addPet(body);
|
||||||
|
|
||||||
// TODO: test validations
|
// TODO: test validations
|
||||||
|
|
||||||
@ -168,8 +168,8 @@ public class PetApiTest {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void updatePetTest() {
|
public void updatePetTest() {
|
||||||
Pet pet = null;
|
Pet body = null;
|
||||||
//api.updatePet(pet);
|
//api.updatePet(body);
|
||||||
|
|
||||||
// TODO: test validations
|
// TODO: test validations
|
||||||
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/**
|
/**
|
||||||
* Swagger Petstore
|
* OpenAPI Petstore
|
||||||
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||||
*
|
*
|
||||||
* OpenAPI spec version: 1.0.0
|
* OpenAPI spec version: 1.0.0
|
||||||
* Contact: apiteam@swagger.io
|
*
|
||||||
*
|
*
|
||||||
* NOTE: This class is auto generated by the swagger code generator program.
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
* https://github.com/swagger-api/swagger-codegen.git
|
* https://openapi-generator.tech
|
||||||
* Do not edit the class manually.
|
* Do not edit the class manually.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@ -47,9 +47,9 @@ import java.util.Map;
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Swagger Petstore
|
* OpenAPI Petstore
|
||||||
*
|
*
|
||||||
* <p>This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
* <p>This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||||
*
|
*
|
||||||
* API tests for StoreApi
|
* API tests for StoreApi
|
||||||
*/
|
*/
|
||||||
@ -132,8 +132,8 @@ public class StoreApiTest {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void placeOrderTest() {
|
public void placeOrderTest() {
|
||||||
Order order = null;
|
Order body = null;
|
||||||
//Order response = api.placeOrder(order);
|
//Order response = api.placeOrder(body);
|
||||||
//assertNotNull(response);
|
//assertNotNull(response);
|
||||||
// TODO: test validations
|
// TODO: test validations
|
||||||
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/**
|
/**
|
||||||
* Swagger Petstore
|
* OpenAPI Petstore
|
||||||
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||||
*
|
*
|
||||||
* OpenAPI spec version: 1.0.0
|
* OpenAPI spec version: 1.0.0
|
||||||
* Contact: apiteam@swagger.io
|
*
|
||||||
*
|
*
|
||||||
* NOTE: This class is auto generated by the swagger code generator program.
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
* https://github.com/swagger-api/swagger-codegen.git
|
* https://openapi-generator.tech
|
||||||
* Do not edit the class manually.
|
* Do not edit the class manually.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@ -47,9 +47,9 @@ import java.util.Map;
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Swagger Petstore
|
* OpenAPI Petstore
|
||||||
*
|
*
|
||||||
* <p>This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
* <p>This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||||
*
|
*
|
||||||
* API tests for UserApi
|
* API tests for UserApi
|
||||||
*/
|
*/
|
||||||
@ -81,8 +81,8 @@ public class UserApiTest {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void createUserTest() {
|
public void createUserTest() {
|
||||||
User user = null;
|
User body = null;
|
||||||
//api.createUser(user);
|
//api.createUser(body);
|
||||||
|
|
||||||
// TODO: test validations
|
// TODO: test validations
|
||||||
|
|
||||||
@ -97,8 +97,8 @@ public class UserApiTest {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void createUsersWithArrayInputTest() {
|
public void createUsersWithArrayInputTest() {
|
||||||
List<User> user = null;
|
List<User> body = null;
|
||||||
//api.createUsersWithArrayInput(user);
|
//api.createUsersWithArrayInput(body);
|
||||||
|
|
||||||
// TODO: test validations
|
// TODO: test validations
|
||||||
|
|
||||||
@ -113,8 +113,8 @@ public class UserApiTest {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void createUsersWithListInputTest() {
|
public void createUsersWithListInputTest() {
|
||||||
List<User> user = null;
|
List<User> body = null;
|
||||||
//api.createUsersWithListInput(user);
|
//api.createUsersWithListInput(body);
|
||||||
|
|
||||||
// TODO: test validations
|
// TODO: test validations
|
||||||
|
|
||||||
@ -198,8 +198,8 @@ public class UserApiTest {
|
|||||||
@Test
|
@Test
|
||||||
public void updateUserTest() {
|
public void updateUserTest() {
|
||||||
String username = null;
|
String username = null;
|
||||||
User user = null;
|
User body = null;
|
||||||
//api.updateUser(username, user);
|
//api.updateUser(username, body);
|
||||||
|
|
||||||
// TODO: test validations
|
// TODO: test validations
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ public class PetApiServiceImpl implements PetApi {
|
|||||||
* Add a new pet to the store
|
* Add a new pet to the store
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void addPet(Pet pet) {
|
public void addPet(Pet body) {
|
||||||
// TODO: Implement...
|
// TODO: Implement...
|
||||||
|
|
||||||
|
|
||||||
@ -85,7 +85,7 @@ public class PetApiServiceImpl implements PetApi {
|
|||||||
* Update an existing pet
|
* Update an existing pet
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void updatePet(Pet pet) {
|
public void updatePet(Pet body) {
|
||||||
// TODO: Implement...
|
// TODO: Implement...
|
||||||
|
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ public class StoreApiServiceImpl implements StoreApi {
|
|||||||
* Place an order for a pet
|
* Place an order for a pet
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public Order placeOrder(Order order) {
|
public Order placeOrder(Order body) {
|
||||||
// TODO: Implement...
|
// TODO: Implement...
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -30,7 +30,7 @@ public class UserApiServiceImpl implements UserApi {
|
|||||||
* This can only be done by the logged in user.
|
* This can only be done by the logged in user.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void createUser(User user) {
|
public void createUser(User body) {
|
||||||
// TODO: Implement...
|
// TODO: Implement...
|
||||||
|
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ public class UserApiServiceImpl implements UserApi {
|
|||||||
* Creates list of users with given input array
|
* Creates list of users with given input array
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void createUsersWithArrayInput(List<User> user) {
|
public void createUsersWithArrayInput(List<User> body) {
|
||||||
// TODO: Implement...
|
// TODO: Implement...
|
||||||
|
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ public class UserApiServiceImpl implements UserApi {
|
|||||||
* Creates list of users with given input array
|
* Creates list of users with given input array
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void createUsersWithListInput(List<User> user) {
|
public void createUsersWithListInput(List<User> body) {
|
||||||
// TODO: Implement...
|
// TODO: Implement...
|
||||||
|
|
||||||
|
|
||||||
@ -104,7 +104,7 @@ public class UserApiServiceImpl implements UserApi {
|
|||||||
* This can only be done by the logged in user.
|
* This can only be done by the logged in user.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void updateUser(String username, User user) {
|
public void updateUser(String username, User body) {
|
||||||
// TODO: Implement...
|
// TODO: Implement...
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/**
|
/**
|
||||||
* Swagger Petstore
|
* OpenAPI Petstore
|
||||||
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||||
*
|
*
|
||||||
* OpenAPI spec version: 1.0.0
|
* OpenAPI spec version: 1.0.0
|
||||||
* Contact: apiteam@swagger.io
|
*
|
||||||
*
|
*
|
||||||
* NOTE: This class is auto generated by the swagger code generator program.
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
* https://github.com/swagger-api/swagger-codegen.git
|
* https://openapi-generator.tech
|
||||||
* Do not edit the class manually.
|
* Do not edit the class manually.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@ -49,9 +49,9 @@ import java.util.Map;
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Swagger Petstore
|
* OpenAPI Petstore
|
||||||
*
|
*
|
||||||
* <p>This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
* <p>This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||||
*
|
*
|
||||||
* API tests for PetApi
|
* API tests for PetApi
|
||||||
*/
|
*/
|
||||||
@ -81,8 +81,8 @@ public class PetApiTest {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void addPetTest() {
|
public void addPetTest() {
|
||||||
Pet pet = null;
|
Pet body = null;
|
||||||
//api.addPet(pet);
|
//api.addPet(body);
|
||||||
|
|
||||||
// TODO: test validations
|
// TODO: test validations
|
||||||
|
|
||||||
@ -168,8 +168,8 @@ public class PetApiTest {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void updatePetTest() {
|
public void updatePetTest() {
|
||||||
Pet pet = null;
|
Pet body = null;
|
||||||
//api.updatePet(pet);
|
//api.updatePet(body);
|
||||||
|
|
||||||
// TODO: test validations
|
// TODO: test validations
|
||||||
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/**
|
/**
|
||||||
* Swagger Petstore
|
* OpenAPI Petstore
|
||||||
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||||
*
|
*
|
||||||
* OpenAPI spec version: 1.0.0
|
* OpenAPI spec version: 1.0.0
|
||||||
* Contact: apiteam@swagger.io
|
*
|
||||||
*
|
*
|
||||||
* NOTE: This class is auto generated by the swagger code generator program.
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
* https://github.com/swagger-api/swagger-codegen.git
|
* https://openapi-generator.tech
|
||||||
* Do not edit the class manually.
|
* Do not edit the class manually.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@ -48,9 +48,9 @@ import java.util.Map;
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Swagger Petstore
|
* OpenAPI Petstore
|
||||||
*
|
*
|
||||||
* <p>This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
* <p>This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||||
*
|
*
|
||||||
* API tests for StoreApi
|
* API tests for StoreApi
|
||||||
*/
|
*/
|
||||||
@ -133,8 +133,8 @@ public class StoreApiTest {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void placeOrderTest() {
|
public void placeOrderTest() {
|
||||||
Order order = null;
|
Order body = null;
|
||||||
//Order response = api.placeOrder(order);
|
//Order response = api.placeOrder(body);
|
||||||
//assertNotNull(response);
|
//assertNotNull(response);
|
||||||
// TODO: test validations
|
// TODO: test validations
|
||||||
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/**
|
/**
|
||||||
* Swagger Petstore
|
* OpenAPI Petstore
|
||||||
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||||
*
|
*
|
||||||
* OpenAPI spec version: 1.0.0
|
* OpenAPI spec version: 1.0.0
|
||||||
* Contact: apiteam@swagger.io
|
*
|
||||||
*
|
*
|
||||||
* NOTE: This class is auto generated by the swagger code generator program.
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
* https://github.com/swagger-api/swagger-codegen.git
|
* https://openapi-generator.tech
|
||||||
* Do not edit the class manually.
|
* Do not edit the class manually.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@ -48,9 +48,9 @@ import java.util.Map;
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Swagger Petstore
|
* OpenAPI Petstore
|
||||||
*
|
*
|
||||||
* <p>This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
* <p>This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||||
*
|
*
|
||||||
* API tests for UserApi
|
* API tests for UserApi
|
||||||
*/
|
*/
|
||||||
@ -82,8 +82,8 @@ public class UserApiTest {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void createUserTest() {
|
public void createUserTest() {
|
||||||
User user = null;
|
User body = null;
|
||||||
//api.createUser(user);
|
//api.createUser(body);
|
||||||
|
|
||||||
// TODO: test validations
|
// TODO: test validations
|
||||||
|
|
||||||
@ -98,8 +98,8 @@ public class UserApiTest {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void createUsersWithArrayInputTest() {
|
public void createUsersWithArrayInputTest() {
|
||||||
List<User> user = null;
|
List<User> body = null;
|
||||||
//api.createUsersWithArrayInput(user);
|
//api.createUsersWithArrayInput(body);
|
||||||
|
|
||||||
// TODO: test validations
|
// TODO: test validations
|
||||||
|
|
||||||
@ -114,8 +114,8 @@ public class UserApiTest {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void createUsersWithListInputTest() {
|
public void createUsersWithListInputTest() {
|
||||||
List<User> user = null;
|
List<User> body = null;
|
||||||
//api.createUsersWithListInput(user);
|
//api.createUsersWithListInput(body);
|
||||||
|
|
||||||
// TODO: test validations
|
// TODO: test validations
|
||||||
|
|
||||||
@ -199,8 +199,8 @@ public class UserApiTest {
|
|||||||
@Test
|
@Test
|
||||||
public void updateUserTest() {
|
public void updateUserTest() {
|
||||||
String username = null;
|
String username = null;
|
||||||
User user = null;
|
User body = null;
|
||||||
//api.updateUser(username, user);
|
//api.updateUser(username, body);
|
||||||
|
|
||||||
// TODO: test validations
|
// TODO: test validations
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ public class PetApiServiceImpl implements PetApi {
|
|||||||
* Add a new pet to the store
|
* Add a new pet to the store
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void addPet(Pet pet) {
|
public void addPet(Pet body) {
|
||||||
// TODO: Implement...
|
// TODO: Implement...
|
||||||
|
|
||||||
|
|
||||||
@ -85,7 +85,7 @@ public class PetApiServiceImpl implements PetApi {
|
|||||||
* Update an existing pet
|
* Update an existing pet
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void updatePet(Pet pet) {
|
public void updatePet(Pet body) {
|
||||||
// TODO: Implement...
|
// TODO: Implement...
|
||||||
|
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ public class StoreApiServiceImpl implements StoreApi {
|
|||||||
* Place an order for a pet
|
* Place an order for a pet
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public Order placeOrder(Order order) {
|
public Order placeOrder(Order body) {
|
||||||
// TODO: Implement...
|
// TODO: Implement...
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -30,7 +30,7 @@ public class UserApiServiceImpl implements UserApi {
|
|||||||
* This can only be done by the logged in user.
|
* This can only be done by the logged in user.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void createUser(User user) {
|
public void createUser(User body) {
|
||||||
// TODO: Implement...
|
// TODO: Implement...
|
||||||
|
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ public class UserApiServiceImpl implements UserApi {
|
|||||||
* Creates list of users with given input array
|
* Creates list of users with given input array
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void createUsersWithArrayInput(List<User> user) {
|
public void createUsersWithArrayInput(List<User> body) {
|
||||||
// TODO: Implement...
|
// TODO: Implement...
|
||||||
|
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ public class UserApiServiceImpl implements UserApi {
|
|||||||
* Creates list of users with given input array
|
* Creates list of users with given input array
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void createUsersWithListInput(List<User> user) {
|
public void createUsersWithListInput(List<User> body) {
|
||||||
// TODO: Implement...
|
// TODO: Implement...
|
||||||
|
|
||||||
|
|
||||||
@ -104,7 +104,7 @@ public class UserApiServiceImpl implements UserApi {
|
|||||||
* This can only be done by the logged in user.
|
* This can only be done by the logged in user.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void updateUser(String username, User user) {
|
public void updateUser(String username, User body) {
|
||||||
// TODO: Implement...
|
// TODO: Implement...
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/**
|
/**
|
||||||
* Swagger Petstore
|
* OpenAPI Petstore
|
||||||
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||||
*
|
*
|
||||||
* OpenAPI spec version: 1.0.0
|
* OpenAPI spec version: 1.0.0
|
||||||
* Contact: apiteam@swagger.io
|
*
|
||||||
*
|
*
|
||||||
* NOTE: This class is auto generated by the swagger code generator program.
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
* https://github.com/swagger-api/swagger-codegen.git
|
* https://openapi-generator.tech
|
||||||
* Do not edit the class manually.
|
* Do not edit the class manually.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@ -49,9 +49,9 @@ import java.util.Map;
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Swagger Petstore
|
* OpenAPI Petstore
|
||||||
*
|
*
|
||||||
* <p>This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
* <p>This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||||
*
|
*
|
||||||
* API tests for PetApi
|
* API tests for PetApi
|
||||||
*/
|
*/
|
||||||
@ -81,8 +81,8 @@ public class PetApiTest {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void addPetTest() {
|
public void addPetTest() {
|
||||||
Pet pet = null;
|
Pet body = null;
|
||||||
//api.addPet(pet);
|
//api.addPet(body);
|
||||||
|
|
||||||
// TODO: test validations
|
// TODO: test validations
|
||||||
|
|
||||||
@ -168,8 +168,8 @@ public class PetApiTest {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void updatePetTest() {
|
public void updatePetTest() {
|
||||||
Pet pet = null;
|
Pet body = null;
|
||||||
//api.updatePet(pet);
|
//api.updatePet(body);
|
||||||
|
|
||||||
// TODO: test validations
|
// TODO: test validations
|
||||||
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/**
|
/**
|
||||||
* Swagger Petstore
|
* OpenAPI Petstore
|
||||||
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||||
*
|
*
|
||||||
* OpenAPI spec version: 1.0.0
|
* OpenAPI spec version: 1.0.0
|
||||||
* Contact: apiteam@swagger.io
|
*
|
||||||
*
|
*
|
||||||
* NOTE: This class is auto generated by the swagger code generator program.
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
* https://github.com/swagger-api/swagger-codegen.git
|
* https://openapi-generator.tech
|
||||||
* Do not edit the class manually.
|
* Do not edit the class manually.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@ -48,9 +48,9 @@ import java.util.Map;
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Swagger Petstore
|
* OpenAPI Petstore
|
||||||
*
|
*
|
||||||
* <p>This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
* <p>This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||||
*
|
*
|
||||||
* API tests for StoreApi
|
* API tests for StoreApi
|
||||||
*/
|
*/
|
||||||
@ -133,8 +133,8 @@ public class StoreApiTest {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void placeOrderTest() {
|
public void placeOrderTest() {
|
||||||
Order order = null;
|
Order body = null;
|
||||||
//Order response = api.placeOrder(order);
|
//Order response = api.placeOrder(body);
|
||||||
//assertNotNull(response);
|
//assertNotNull(response);
|
||||||
// TODO: test validations
|
// TODO: test validations
|
||||||
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/**
|
/**
|
||||||
* Swagger Petstore
|
* OpenAPI Petstore
|
||||||
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||||
*
|
*
|
||||||
* OpenAPI spec version: 1.0.0
|
* OpenAPI spec version: 1.0.0
|
||||||
* Contact: apiteam@swagger.io
|
*
|
||||||
*
|
*
|
||||||
* NOTE: This class is auto generated by the swagger code generator program.
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
* https://github.com/swagger-api/swagger-codegen.git
|
* https://openapi-generator.tech
|
||||||
* Do not edit the class manually.
|
* Do not edit the class manually.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@ -48,9 +48,9 @@ import java.util.Map;
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Swagger Petstore
|
* OpenAPI Petstore
|
||||||
*
|
*
|
||||||
* <p>This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
* <p>This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||||
*
|
*
|
||||||
* API tests for UserApi
|
* API tests for UserApi
|
||||||
*/
|
*/
|
||||||
@ -82,8 +82,8 @@ public class UserApiTest {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void createUserTest() {
|
public void createUserTest() {
|
||||||
User user = null;
|
User body = null;
|
||||||
//api.createUser(user);
|
//api.createUser(body);
|
||||||
|
|
||||||
// TODO: test validations
|
// TODO: test validations
|
||||||
|
|
||||||
@ -98,8 +98,8 @@ public class UserApiTest {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void createUsersWithArrayInputTest() {
|
public void createUsersWithArrayInputTest() {
|
||||||
List<User> user = null;
|
List<User> body = null;
|
||||||
//api.createUsersWithArrayInput(user);
|
//api.createUsersWithArrayInput(body);
|
||||||
|
|
||||||
// TODO: test validations
|
// TODO: test validations
|
||||||
|
|
||||||
@ -114,8 +114,8 @@ public class UserApiTest {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void createUsersWithListInputTest() {
|
public void createUsersWithListInputTest() {
|
||||||
List<User> user = null;
|
List<User> body = null;
|
||||||
//api.createUsersWithListInput(user);
|
//api.createUsersWithListInput(body);
|
||||||
|
|
||||||
// TODO: test validations
|
// TODO: test validations
|
||||||
|
|
||||||
@ -199,8 +199,8 @@ public class UserApiTest {
|
|||||||
@Test
|
@Test
|
||||||
public void updateUserTest() {
|
public void updateUserTest() {
|
||||||
String username = null;
|
String username = null;
|
||||||
User user = null;
|
User body = null;
|
||||||
//api.updateUser(username, user);
|
//api.updateUser(username, body);
|
||||||
|
|
||||||
// TODO: test validations
|
// TODO: test validations
|
||||||
|
|
||||||
|
@ -0,0 +1,25 @@
|
|||||||
|
# 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
|
||||||
|
|
||||||
|
#**/impl/*
|
@ -0,0 +1 @@
|
|||||||
|
4.0.0-SNAPSHOT
|
266
samples/server/petstore/jaxrs-cxf-test-data/pom.xml
Normal file
266
samples/server/petstore/jaxrs-cxf-test-data/pom.xml
Normal file
@ -0,0 +1,266 @@
|
|||||||
|
<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>jaxrs-cxf-petstore-server-test-data</artifactId>
|
||||||
|
<packaging>war</packaging>
|
||||||
|
<name>jaxrs-cxf-petstore-server-test-data</name>
|
||||||
|
<description>This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\</description>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<parent>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
|
<version>2.0.4.RELEASE</version>
|
||||||
|
</parent>
|
||||||
|
<build>
|
||||||
|
<sourceDirectory>src/main/java</sourceDirectory>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-failsafe-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>integration-test</goal>
|
||||||
|
<goal>verify</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<!--plugin>
|
||||||
|
<groupId>org.eclipse.jetty</groupId>
|
||||||
|
<artifactId>jetty-maven-plugin</artifactId>
|
||||||
|
<version>${jetty-version}</version>
|
||||||
|
<configuration>
|
||||||
|
<webApp>
|
||||||
|
<contextPath>/</contextPath>
|
||||||
|
</webApp>
|
||||||
|
<webAppSourceDirectory>target/${project.artifactId}-${project.version}</webAppSourceDirectory>
|
||||||
|
<stopPort>8079</stopPort>
|
||||||
|
<stopKey>stopit</stopKey>
|
||||||
|
<httpConnector>
|
||||||
|
<port>80</port>
|
||||||
|
<idleTimeout>60000</idleTimeout>
|
||||||
|
</httpConnector>
|
||||||
|
</configuration>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.validation</groupId>
|
||||||
|
<artifactId>validation-api</artifactId>
|
||||||
|
<version>${beanvalidation-version}</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>start-jetty</id>
|
||||||
|
<phase>pre-integration-test</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>start</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<scanIntervalSeconds>0</scanIntervalSeconds>
|
||||||
|
<daemon>true</daemon>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>stop-jetty</id>
|
||||||
|
<phase>post-integration-test</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>stop</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin-->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
<artifactId>build-helper-maven-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>add-source</id>
|
||||||
|
<phase>generate-sources</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>add-source</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<sources>
|
||||||
|
<source>src/gen/java</source>
|
||||||
|
</sources>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<!-- build WAR file -->
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-war-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.swagger</groupId>
|
||||||
|
<artifactId>swagger-jaxrs</artifactId>
|
||||||
|
<scope>compile</scope>
|
||||||
|
<version>${swagger-core-version}</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>javax.ws.rs</groupId>
|
||||||
|
<artifactId>jsr311-api</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>ch.qos.logback</groupId>
|
||||||
|
<artifactId>logback-classic</artifactId>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>ch.qos.logback</groupId>
|
||||||
|
<artifactId>logback-core</artifactId>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<!-- Bean Validation API support -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.validation</groupId>
|
||||||
|
<artifactId>validation-api</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<!-- CXF Client -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.cxf</groupId>
|
||||||
|
<artifactId>cxf-rt-rs-client</artifactId>
|
||||||
|
<version>${cxf-version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<!-- CXF Server -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.cxf</groupId>
|
||||||
|
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
|
||||||
|
<version>${cxf-version}</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.cxf</groupId>
|
||||||
|
<artifactId>cxf-rt-rs-service-description</artifactId>
|
||||||
|
<version>${cxf-version}</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.cxf</groupId>
|
||||||
|
<artifactId>cxf-rt-rs-service-description-swagger</artifactId>
|
||||||
|
<version>${cxf-version}</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.cxf</groupId>
|
||||||
|
<artifactId>cxf-rt-ws-policy</artifactId>
|
||||||
|
<version>${cxf-version}</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.cxf</groupId>
|
||||||
|
<artifactId>cxf-rt-wsdl</artifactId>
|
||||||
|
<version>${cxf-version}</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<!-- Jackson -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.jaxrs</groupId>
|
||||||
|
<artifactId>jackson-jaxrs-json-provider</artifactId>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.jaxrs</groupId>
|
||||||
|
<artifactId>jackson-jaxrs-xml-provider</artifactId>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||||
|
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- Spring Framework -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-core</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-aop</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-context</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- Spring Boot dependencies for integration tests -->
|
||||||
|
<!--dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-tomcat</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-autoconfigure</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.cxf</groupId>
|
||||||
|
<artifactId>cxf-spring-boot-starter-jaxrs</artifactId>
|
||||||
|
<version>${cxf-version}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.openapitools</groupId>
|
||||||
|
<artifactId>openapi-generator</artifactId>
|
||||||
|
<version>4.0.0-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>sonatype-snapshots</id>
|
||||||
|
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||||
|
<snapshots>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
</snapshots>
|
||||||
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>sonatype-releases</id>
|
||||||
|
<url>https://oss.sonatype.org/content/repositories/releases</url>
|
||||||
|
<snapshots>
|
||||||
|
<enabled>false</enabled>
|
||||||
|
</snapshots>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
<properties>
|
||||||
|
<java.version>1.8</java.version>
|
||||||
|
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||||
|
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||||
|
<swagger-core-version>1.5.18</swagger-core-version>
|
||||||
|
<jetty-version>9.2.9.v20150224</jetty-version>
|
||||||
|
<beanvalidation-version>1.1.0.Final</beanvalidation-version>
|
||||||
|
<cxf-version>3.3.0</cxf-version>
|
||||||
|
<jackson-jaxrs-version>2.9.8</jackson-jaxrs-version>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
</project>
|
36
samples/server/petstore/jaxrs-cxf-test-data/readme.md
Normal file
36
samples/server/petstore/jaxrs-cxf-test-data/readme.md
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
|
||||||
|
# JAX-RS CXF 3 server application
|
||||||
|
|
||||||
|
## Supported features
|
||||||
|
* Bean-Validation-API support
|
||||||
|
* Spring-configuration of Swagger, WADL and Endpoints
|
||||||
|
* Swagger-API is accessible (CXF3 Swagger2Feature)
|
||||||
|
* Swagger-UI can be included as Web-Jar automatically
|
||||||
|
* WADL is accessible (CXF WADL-Generator)
|
||||||
|
* Unit-tests include Gzip-Interceptors for demonstration
|
||||||
|
|
||||||
|
|
||||||
|
## Urls to access the REST API
|
||||||
|
### Urls for Spring Boot
|
||||||
|
|
||||||
|
* Available services listing
|
||||||
|
http://localhost:8080/
|
||||||
|
|
||||||
|
* Swagger API
|
||||||
|
http://localhost:8080/services/openapi.json
|
||||||
|
|
||||||
|
* CXF WADL
|
||||||
|
http://localhost:8080/services?_wadl
|
||||||
|
|
||||||
|
|
||||||
|
### Urls if deployed to an AS
|
||||||
|
* Available services listing
|
||||||
|
http://localhost:8080/swagger-cxf-server/rest/services/
|
||||||
|
|
||||||
|
* Swagger API
|
||||||
|
http://localhost:8080/swagger-cxf-server/rest/services/swagger.json
|
||||||
|
|
||||||
|
* CXF WADL
|
||||||
|
http://localhost:8080/swagger-cxf-server/rest/services?_wadl
|
||||||
|
|
||||||
|
|
@ -0,0 +1,49 @@
|
|||||||
|
package org.openapitools.api;
|
||||||
|
|
||||||
|
import org.openapitools.model.Client;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import javax.ws.rs.*;
|
||||||
|
import javax.ws.rs.core.Response;
|
||||||
|
import javax.ws.rs.core.MediaType;
|
||||||
|
import org.apache.cxf.jaxrs.ext.multipart.*;
|
||||||
|
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import io.swagger.annotations.ApiResponses;
|
||||||
|
import io.swagger.annotations.ApiResponse;
|
||||||
|
import io.swagger.jaxrs.PATCH;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OpenAPI Petstore
|
||||||
|
*
|
||||||
|
* <p>This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Path("/v2")
|
||||||
|
@Api(value = "/", description = "")
|
||||||
|
public interface AnotherFakeApi {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To test special tags
|
||||||
|
*
|
||||||
|
* To test special tags and operation ID starting with number
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@PATCH
|
||||||
|
@Path("/another-fake/dummy")
|
||||||
|
@Consumes({ "application/json" })
|
||||||
|
@Produces({ "application/json" })
|
||||||
|
@ApiOperation(value = "To test special tags", tags={ "$another-fake?" })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 200, message = "successful operation", response = Client.class) })
|
||||||
|
public Client call123testSpecialTags(@Valid Client body);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,190 @@
|
|||||||
|
package org.openapitools.api;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import org.openapitools.model.Client;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.io.File;
|
||||||
|
import org.openapitools.model.FileSchemaTestClass;
|
||||||
|
import java.util.List;
|
||||||
|
import org.joda.time.LocalDate;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.openapitools.model.OuterComposite;
|
||||||
|
import org.openapitools.model.User;
|
||||||
|
import org.openapitools.model.XmlItem;
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import javax.ws.rs.*;
|
||||||
|
import javax.ws.rs.core.Response;
|
||||||
|
import javax.ws.rs.core.MediaType;
|
||||||
|
import org.apache.cxf.jaxrs.ext.multipart.*;
|
||||||
|
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import io.swagger.annotations.ApiResponses;
|
||||||
|
import io.swagger.annotations.ApiResponse;
|
||||||
|
import io.swagger.jaxrs.PATCH;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OpenAPI Petstore
|
||||||
|
*
|
||||||
|
* <p>This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Path("/v2")
|
||||||
|
@Api(value = "/", description = "")
|
||||||
|
public interface FakeApi {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* creates an XmlItem
|
||||||
|
*
|
||||||
|
* this route creates an XmlItem
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@POST
|
||||||
|
@Path("/fake/create_xml_item")
|
||||||
|
@Consumes({ "application/xml", "application/xml; charset=utf-8", "application/xml; charset=utf-16", "text/xml", "text/xml; charset=utf-8", "text/xml; charset=utf-16" })
|
||||||
|
@ApiOperation(value = "creates an XmlItem", tags={ "fake", })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 200, message = "successful operation") })
|
||||||
|
public void createXmlItem(@Valid XmlItem xmlItem);
|
||||||
|
|
||||||
|
@POST
|
||||||
|
@Path("/fake/outer/boolean")
|
||||||
|
@Consumes({ "text/plain" })
|
||||||
|
@Produces({ "*/*" })
|
||||||
|
@ApiOperation(value = "", tags={ "fake", })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 200, message = "Output boolean", response = Boolean.class) })
|
||||||
|
public Boolean fakeOuterBooleanSerialize(@Valid Boolean body);
|
||||||
|
|
||||||
|
@POST
|
||||||
|
@Path("/fake/outer/composite")
|
||||||
|
@Consumes({ "application/json" })
|
||||||
|
@Produces({ "*/*" })
|
||||||
|
@ApiOperation(value = "", tags={ "fake", })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 200, message = "Output composite", response = OuterComposite.class) })
|
||||||
|
public OuterComposite fakeOuterCompositeSerialize(@Valid OuterComposite body);
|
||||||
|
|
||||||
|
@POST
|
||||||
|
@Path("/fake/outer/number")
|
||||||
|
@Consumes({ "application/json" })
|
||||||
|
@Produces({ "*/*" })
|
||||||
|
@ApiOperation(value = "", tags={ "fake", })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 200, message = "Output number", response = BigDecimal.class) })
|
||||||
|
public BigDecimal fakeOuterNumberSerialize(@Valid BigDecimal body);
|
||||||
|
|
||||||
|
@POST
|
||||||
|
@Path("/fake/outer/string")
|
||||||
|
@Consumes({ "text/plain" })
|
||||||
|
@Produces({ "*/*" })
|
||||||
|
@ApiOperation(value = "", tags={ "fake", })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 200, message = "Output string", response = String.class) })
|
||||||
|
public String fakeOuterStringSerialize(@Valid String body);
|
||||||
|
|
||||||
|
@PUT
|
||||||
|
@Path("/fake/body-with-file-schema")
|
||||||
|
@Consumes({ "application/json" })
|
||||||
|
@ApiOperation(value = "", tags={ "fake", })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 200, message = "Success") })
|
||||||
|
public void testBodyWithFileSchema(@Valid FileSchemaTestClass body);
|
||||||
|
|
||||||
|
@PUT
|
||||||
|
@Path("/fake/body-with-query-params")
|
||||||
|
@Consumes({ "application/json" })
|
||||||
|
@ApiOperation(value = "", tags={ "fake", })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 200, message = "Success") })
|
||||||
|
public void testBodyWithQueryParams(@QueryParam("query") @NotNull String query, @Valid User body);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To test \"client\" model
|
||||||
|
*
|
||||||
|
* To test \"client\" model
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@PATCH
|
||||||
|
@Path("/fake")
|
||||||
|
@Consumes({ "application/json" })
|
||||||
|
@Produces({ "application/json" })
|
||||||
|
@ApiOperation(value = "To test \"client\" model", tags={ "fake", })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 200, message = "successful operation", response = Client.class) })
|
||||||
|
public Client testClientModel(@Valid Client body);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||||
|
*
|
||||||
|
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@POST
|
||||||
|
@Path("/fake")
|
||||||
|
@Consumes({ "application/x-www-form-urlencoded" })
|
||||||
|
@ApiOperation(value = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", tags={ "fake", })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 400, message = "Invalid username supplied"),
|
||||||
|
@ApiResponse(code = 404, message = "User not found") })
|
||||||
|
public void testEndpointParameters(@Multipart(value = "number") BigDecimal number, @Multipart(value = "double") Double _double, @Multipart(value = "pattern_without_delimiter") String patternWithoutDelimiter, @Multipart(value = "byte") byte[] _byte, @Multipart(value = "integer", required = false) Integer integer, @Multipart(value = "int32", required = false) Integer int32, @Multipart(value = "int64", required = false) Long int64, @Multipart(value = "float", required = false) Float _float, @Multipart(value = "string", required = false) String string, @Multipart(value = "binary" , required = false) Attachment binaryDetail, @Multipart(value = "date", required = false) LocalDate date, @Multipart(value = "dateTime", required = false) Date dateTime, @Multipart(value = "password", required = false) String password, @Multipart(value = "callback", required = false) String paramCallback);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To test enum parameters
|
||||||
|
*
|
||||||
|
* To test enum parameters
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@GET
|
||||||
|
@Path("/fake")
|
||||||
|
@Consumes({ "application/x-www-form-urlencoded" })
|
||||||
|
@ApiOperation(value = "To test enum parameters", tags={ "fake", })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 400, message = "Invalid request"),
|
||||||
|
@ApiResponse(code = 404, message = "Not found") })
|
||||||
|
public void testEnumParameters(@HeaderParam("enum_header_string_array") List<String> enumHeaderStringArray, @HeaderParam("enum_header_string") String enumHeaderString, @QueryParam("enum_query_string_array") List<String> enumQueryStringArray, @QueryParam("enum_query_string") @DefaultValue("-efg") String enumQueryString, @QueryParam("enum_query_integer") Integer enumQueryInteger, @QueryParam("enum_query_double") Double enumQueryDouble, @Multipart(value = "enum_form_string_array", required = false) List<String> enumFormStringArray, @Multipart(value = "enum_form_string", required = false) String enumFormString);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fake endpoint to test group parameters (optional)
|
||||||
|
*
|
||||||
|
* Fake endpoint to test group parameters (optional)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@DELETE
|
||||||
|
@Path("/fake")
|
||||||
|
@ApiOperation(value = "Fake endpoint to test group parameters (optional)", tags={ "fake", })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 400, message = "Someting wrong") })
|
||||||
|
public void testGroupParameters(@QueryParam("required_string_group") @NotNull Integer requiredStringGroup, @HeaderParam("required_boolean_group") @NotNull Boolean requiredBooleanGroup, @QueryParam("required_int64_group") @NotNull Long requiredInt64Group, @QueryParam("string_group") Integer stringGroup, @HeaderParam("boolean_group") Boolean booleanGroup, @QueryParam("int64_group") Long int64Group);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* test inline additionalProperties
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@POST
|
||||||
|
@Path("/fake/inline-additionalProperties")
|
||||||
|
@Consumes({ "application/json" })
|
||||||
|
@ApiOperation(value = "test inline additionalProperties", tags={ "fake", })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 200, message = "successful operation") })
|
||||||
|
public void testInlineAdditionalProperties(@Valid Map<String, String> param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* test json serialization of form data
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@GET
|
||||||
|
@Path("/fake/jsonFormData")
|
||||||
|
@Consumes({ "application/x-www-form-urlencoded" })
|
||||||
|
@ApiOperation(value = "test json serialization of form data", tags={ "fake" })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 200, message = "successful operation") })
|
||||||
|
public void testJsonFormData(@Multipart(value = "param") String param, @Multipart(value = "param2") String param2);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,49 @@
|
|||||||
|
package org.openapitools.api;
|
||||||
|
|
||||||
|
import org.openapitools.model.Client;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import javax.ws.rs.*;
|
||||||
|
import javax.ws.rs.core.Response;
|
||||||
|
import javax.ws.rs.core.MediaType;
|
||||||
|
import org.apache.cxf.jaxrs.ext.multipart.*;
|
||||||
|
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import io.swagger.annotations.ApiResponses;
|
||||||
|
import io.swagger.annotations.ApiResponse;
|
||||||
|
import io.swagger.jaxrs.PATCH;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OpenAPI Petstore
|
||||||
|
*
|
||||||
|
* <p>This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Path("/v2")
|
||||||
|
@Api(value = "/", description = "")
|
||||||
|
public interface FakeClassnameTags123Api {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To test class name in snake case
|
||||||
|
*
|
||||||
|
* To test class name in snake case
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@PATCH
|
||||||
|
@Path("/fake_classname_test")
|
||||||
|
@Consumes({ "application/json" })
|
||||||
|
@Produces({ "application/json" })
|
||||||
|
@ApiOperation(value = "To test class name in snake case", tags={ "fake_classname_tags 123#$%^" })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 200, message = "successful operation", response = Client.class) })
|
||||||
|
public Client testClassname(@Valid Client body);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,158 @@
|
|||||||
|
package org.openapitools.api;
|
||||||
|
|
||||||
|
import org.openapitools.model.Category;
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.openapitools.model.ModelApiResponse;
|
||||||
|
import org.openapitools.model.Pet;
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import javax.ws.rs.*;
|
||||||
|
import javax.ws.rs.core.Response;
|
||||||
|
import javax.ws.rs.core.MediaType;
|
||||||
|
import org.apache.cxf.jaxrs.ext.multipart.*;
|
||||||
|
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import io.swagger.annotations.ApiResponses;
|
||||||
|
import io.swagger.annotations.ApiResponse;
|
||||||
|
import io.swagger.jaxrs.PATCH;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OpenAPI Petstore
|
||||||
|
*
|
||||||
|
* <p>This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Path("/v2")
|
||||||
|
@Api(value = "/", description = "")
|
||||||
|
public interface PetApi {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a new pet to the store
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@POST
|
||||||
|
@Path("/pet")
|
||||||
|
@Consumes({ "application/json", "application/xml" })
|
||||||
|
@ApiOperation(value = "Add a new pet to the store", tags={ "pet", })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 405, message = "Invalid input") })
|
||||||
|
public void addPet(@Valid Pet body);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes a pet
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@DELETE
|
||||||
|
@Path("/pet/{petId}")
|
||||||
|
@ApiOperation(value = "Deletes a pet", tags={ "pet", })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 400, message = "Invalid pet value") })
|
||||||
|
public void deletePet(@PathParam("petId") Long petId, @HeaderParam("api_key") String apiKey);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds Pets by status
|
||||||
|
*
|
||||||
|
* Multiple status values can be provided with comma separated strings
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@GET
|
||||||
|
@Path("/pet/findByStatus")
|
||||||
|
@Produces({ "application/xml", "application/json" })
|
||||||
|
@ApiOperation(value = "Finds Pets by status", tags={ "pet", })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"),
|
||||||
|
@ApiResponse(code = 400, message = "Invalid status value") })
|
||||||
|
public List<Pet> findPetsByStatus(@QueryParam("status") @NotNull List<String> status);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds Pets by tags
|
||||||
|
*
|
||||||
|
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@GET
|
||||||
|
@Path("/pet/findByTags")
|
||||||
|
@Produces({ "application/xml", "application/json" })
|
||||||
|
@ApiOperation(value = "Finds Pets by tags", tags={ "pet", })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"),
|
||||||
|
@ApiResponse(code = 400, message = "Invalid tag value") })
|
||||||
|
public List<Pet> findPetsByTags(@QueryParam("tags") @NotNull List<String> tags);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find pet by ID
|
||||||
|
*
|
||||||
|
* Returns a single pet
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@GET
|
||||||
|
@Path("/pet/{petId}")
|
||||||
|
@Produces({ "application/xml", "application/json" })
|
||||||
|
@ApiOperation(value = "Find pet by ID", tags={ "pet", })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 200, message = "successful operation", response = Pet.class),
|
||||||
|
@ApiResponse(code = 400, message = "Invalid ID supplied"),
|
||||||
|
@ApiResponse(code = 404, message = "Pet not found") })
|
||||||
|
public Pet getPetById(@PathParam("petId") Long petId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update an existing pet
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@PUT
|
||||||
|
@Path("/pet")
|
||||||
|
@Consumes({ "application/json", "application/xml" })
|
||||||
|
@ApiOperation(value = "Update an existing pet", tags={ "pet", })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 400, message = "Invalid ID supplied"),
|
||||||
|
@ApiResponse(code = 404, message = "Pet not found"),
|
||||||
|
@ApiResponse(code = 405, message = "Validation exception") })
|
||||||
|
public void updatePet(@Valid Pet body);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates a pet in the store with form data
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@POST
|
||||||
|
@Path("/pet/{petId}")
|
||||||
|
@Consumes({ "application/x-www-form-urlencoded" })
|
||||||
|
@ApiOperation(value = "Updates a pet in the store with form data", tags={ "pet", })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 405, message = "Invalid input") })
|
||||||
|
public void updatePetWithForm(@PathParam("petId") Long petId, @Multipart(value = "name", required = false) String name, @Multipart(value = "status", required = false) String status);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* uploads an image
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@POST
|
||||||
|
@Path("/pet/{petId}/uploadImage")
|
||||||
|
@Consumes({ "multipart/form-data" })
|
||||||
|
@Produces({ "application/json" })
|
||||||
|
@ApiOperation(value = "uploads an image", tags={ "pet", })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) })
|
||||||
|
public ModelApiResponse uploadFile(@PathParam("petId") Long petId, @Multipart(value = "additionalMetadata", required = false) String additionalMetadata, @Multipart(value = "file" , required = false) Attachment fileDetail);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* uploads an image (required)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@POST
|
||||||
|
@Path("/fake/{petId}/uploadImageWithRequiredFile")
|
||||||
|
@Consumes({ "multipart/form-data" })
|
||||||
|
@Produces({ "application/json" })
|
||||||
|
@ApiOperation(value = "uploads an image (required)", tags={ "pet" })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) })
|
||||||
|
public ModelApiResponse uploadFileWithRequiredFile(@PathParam("petId") Long petId, @Multipart(value = "requiredFile" ) Attachment requiredFileDetail, @Multipart(value = "additionalMetadata", required = false) String additionalMetadata);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,92 @@
|
|||||||
|
package org.openapitools.api;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.openapitools.model.Order;
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import javax.ws.rs.*;
|
||||||
|
import javax.ws.rs.core.Response;
|
||||||
|
import javax.ws.rs.core.MediaType;
|
||||||
|
import org.apache.cxf.jaxrs.ext.multipart.*;
|
||||||
|
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import io.swagger.annotations.ApiResponses;
|
||||||
|
import io.swagger.annotations.ApiResponse;
|
||||||
|
import io.swagger.jaxrs.PATCH;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OpenAPI Petstore
|
||||||
|
*
|
||||||
|
* <p>This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Path("/v2")
|
||||||
|
@Api(value = "/", description = "")
|
||||||
|
public interface StoreApi {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete purchase order by ID
|
||||||
|
*
|
||||||
|
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@DELETE
|
||||||
|
@Path("/store/order/{order_id}")
|
||||||
|
@ApiOperation(value = "Delete purchase order by ID", tags={ "store", })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 400, message = "Invalid ID supplied"),
|
||||||
|
@ApiResponse(code = 404, message = "Order not found") })
|
||||||
|
public void deleteOrder(@PathParam("order_id") String orderId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns pet inventories by status
|
||||||
|
*
|
||||||
|
* Returns a map of status codes to quantities
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@GET
|
||||||
|
@Path("/store/inventory")
|
||||||
|
@Produces({ "application/json" })
|
||||||
|
@ApiOperation(value = "Returns pet inventories by status", tags={ "store", })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 200, message = "successful operation", response = Map.class, responseContainer = "Map") })
|
||||||
|
public Map<String, Integer> getInventory();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find purchase order by ID
|
||||||
|
*
|
||||||
|
* For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@GET
|
||||||
|
@Path("/store/order/{order_id}")
|
||||||
|
@Produces({ "application/xml", "application/json" })
|
||||||
|
@ApiOperation(value = "Find purchase order by ID", tags={ "store", })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 200, message = "successful operation", response = Order.class),
|
||||||
|
@ApiResponse(code = 400, message = "Invalid ID supplied"),
|
||||||
|
@ApiResponse(code = 404, message = "Order not found") })
|
||||||
|
public Order getOrderById(@PathParam("order_id") @Min(1L) @Max(5L) Long orderId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Place an order for a pet
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@POST
|
||||||
|
@Path("/store/order")
|
||||||
|
@Consumes({ "application/json" })
|
||||||
|
@Produces({ "application/xml", "application/json" })
|
||||||
|
@ApiOperation(value = "Place an order for a pet", tags={ "store" })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 200, message = "successful operation", response = Order.class),
|
||||||
|
@ApiResponse(code = 400, message = "Invalid Order") })
|
||||||
|
public Order placeOrder(@Valid Order body);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,139 @@
|
|||||||
|
package org.openapitools.api;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.openapitools.model.User;
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import javax.ws.rs.*;
|
||||||
|
import javax.ws.rs.core.Response;
|
||||||
|
import javax.ws.rs.core.MediaType;
|
||||||
|
import org.apache.cxf.jaxrs.ext.multipart.*;
|
||||||
|
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import io.swagger.annotations.ApiResponses;
|
||||||
|
import io.swagger.annotations.ApiResponse;
|
||||||
|
import io.swagger.jaxrs.PATCH;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OpenAPI Petstore
|
||||||
|
*
|
||||||
|
* <p>This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Path("/v2")
|
||||||
|
@Api(value = "/", description = "")
|
||||||
|
public interface UserApi {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create user
|
||||||
|
*
|
||||||
|
* This can only be done by the logged in user.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@POST
|
||||||
|
@Path("/user")
|
||||||
|
@Consumes({ "application/json" })
|
||||||
|
@ApiOperation(value = "Create user", tags={ "user", })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 200, message = "successful operation") })
|
||||||
|
public void createUser(@Valid User body);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates list of users with given input array
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@POST
|
||||||
|
@Path("/user/createWithArray")
|
||||||
|
@Consumes({ "application/json" })
|
||||||
|
@ApiOperation(value = "Creates list of users with given input array", tags={ "user", })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 200, message = "successful operation") })
|
||||||
|
public void createUsersWithArrayInput(@Valid List<User> body);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates list of users with given input array
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@POST
|
||||||
|
@Path("/user/createWithList")
|
||||||
|
@Consumes({ "application/json" })
|
||||||
|
@ApiOperation(value = "Creates list of users with given input array", tags={ "user", })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 200, message = "successful operation") })
|
||||||
|
public void createUsersWithListInput(@Valid List<User> body);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete user
|
||||||
|
*
|
||||||
|
* This can only be done by the logged in user.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@DELETE
|
||||||
|
@Path("/user/{username}")
|
||||||
|
@ApiOperation(value = "Delete user", tags={ "user", })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 400, message = "Invalid username supplied"),
|
||||||
|
@ApiResponse(code = 404, message = "User not found") })
|
||||||
|
public void deleteUser(@PathParam("username") String username);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get user by user name
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@GET
|
||||||
|
@Path("/user/{username}")
|
||||||
|
@Produces({ "application/xml", "application/json" })
|
||||||
|
@ApiOperation(value = "Get user by user name", tags={ "user", })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 200, message = "successful operation", response = User.class),
|
||||||
|
@ApiResponse(code = 400, message = "Invalid username supplied"),
|
||||||
|
@ApiResponse(code = 404, message = "User not found") })
|
||||||
|
public User getUserByName(@PathParam("username") String username);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logs user into the system
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@GET
|
||||||
|
@Path("/user/login")
|
||||||
|
@Produces({ "application/xml", "application/json" })
|
||||||
|
@ApiOperation(value = "Logs user into the system", tags={ "user", })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 200, message = "successful operation", response = String.class),
|
||||||
|
@ApiResponse(code = 400, message = "Invalid username/password supplied") })
|
||||||
|
public String loginUser(@QueryParam("username") @NotNull String username, @QueryParam("password") @NotNull String password);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logs out current logged in user session
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@GET
|
||||||
|
@Path("/user/logout")
|
||||||
|
@ApiOperation(value = "Logs out current logged in user session", tags={ "user", })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 200, message = "successful operation") })
|
||||||
|
public void logoutUser();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updated user
|
||||||
|
*
|
||||||
|
* This can only be done by the logged in user.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@PUT
|
||||||
|
@Path("/user/{username}")
|
||||||
|
@Consumes({ "application/json" })
|
||||||
|
@ApiOperation(value = "Updated user", tags={ "user" })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 400, message = "Invalid user supplied"),
|
||||||
|
@ApiResponse(code = 404, message = "User not found") })
|
||||||
|
public void updateUser(@PathParam("username") String username, @Valid User body);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,115 @@
|
|||||||
|
package org.openapitools.model;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
|
import javax.xml.bind.annotation.XmlType;
|
||||||
|
import javax.xml.bind.annotation.XmlEnum;
|
||||||
|
import javax.xml.bind.annotation.XmlEnumValue;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
|
public class AdditionalPropertiesClass {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "")
|
||||||
|
private Map<String, String> mapProperty = null;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "")
|
||||||
|
@Valid
|
||||||
|
private Map<String, Map<String, String>> mapOfMapProperty = null;
|
||||||
|
/**
|
||||||
|
* Get mapProperty
|
||||||
|
* @return mapProperty
|
||||||
|
*/
|
||||||
|
@JsonProperty("map_property")
|
||||||
|
public Map<String, String> getMapProperty() {
|
||||||
|
return mapProperty;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the <code>mapProperty</code> property.
|
||||||
|
*/
|
||||||
|
public void setMapProperty(Map<String, String> mapProperty) {
|
||||||
|
this.mapProperty = mapProperty;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the <code>mapProperty</code> property.
|
||||||
|
*/
|
||||||
|
public AdditionalPropertiesClass mapProperty(Map<String, String> mapProperty) {
|
||||||
|
this.mapProperty = mapProperty;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Puts a new item into the <code>mapProperty</code> map.
|
||||||
|
*/
|
||||||
|
public AdditionalPropertiesClass putMapPropertyItem(String key, String mapPropertyItem) {
|
||||||
|
this.mapProperty.put(key, mapPropertyItem);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get mapOfMapProperty
|
||||||
|
* @return mapOfMapProperty
|
||||||
|
*/
|
||||||
|
@JsonProperty("map_of_map_property")
|
||||||
|
public Map<String, Map<String, String>> getMapOfMapProperty() {
|
||||||
|
return mapOfMapProperty;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the <code>mapOfMapProperty</code> property.
|
||||||
|
*/
|
||||||
|
public void setMapOfMapProperty(Map<String, Map<String, String>> mapOfMapProperty) {
|
||||||
|
this.mapOfMapProperty = mapOfMapProperty;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the <code>mapOfMapProperty</code> property.
|
||||||
|
*/
|
||||||
|
public AdditionalPropertiesClass mapOfMapProperty(Map<String, Map<String, String>> mapOfMapProperty) {
|
||||||
|
this.mapOfMapProperty = mapOfMapProperty;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Puts a new item into the <code>mapOfMapProperty</code> map.
|
||||||
|
*/
|
||||||
|
public AdditionalPropertiesClass putMapOfMapPropertyItem(String key, Map<String, String> mapOfMapPropertyItem) {
|
||||||
|
this.mapOfMapProperty.put(key, mapOfMapPropertyItem);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("class AdditionalPropertiesClass {\n");
|
||||||
|
|
||||||
|
sb.append(" mapProperty: ").append(toIndentedString(mapProperty)).append("\n");
|
||||||
|
sb.append(" mapOfMapProperty: ").append(toIndentedString(mapOfMapProperty)).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 static String toIndentedString(java.lang.Object o) {
|
||||||
|
if (o == null) {
|
||||||
|
return "null";
|
||||||
|
}
|
||||||
|
return o.toString().replace("\n", "\n ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,98 @@
|
|||||||
|
package org.openapitools.model;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
|
import javax.xml.bind.annotation.XmlType;
|
||||||
|
import javax.xml.bind.annotation.XmlEnum;
|
||||||
|
import javax.xml.bind.annotation.XmlEnumValue;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
|
public class Animal {
|
||||||
|
|
||||||
|
@ApiModelProperty(required = true, value = "")
|
||||||
|
private String className;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "")
|
||||||
|
private String color = "red";
|
||||||
|
/**
|
||||||
|
* Get className
|
||||||
|
* @return className
|
||||||
|
*/
|
||||||
|
@JsonProperty("className")
|
||||||
|
@NotNull
|
||||||
|
public String getClassName() {
|
||||||
|
return className;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the <code>className</code> property.
|
||||||
|
*/
|
||||||
|
public void setClassName(String className) {
|
||||||
|
this.className = className;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the <code>className</code> property.
|
||||||
|
*/
|
||||||
|
public Animal className(String className) {
|
||||||
|
this.className = className;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get color
|
||||||
|
* @return color
|
||||||
|
*/
|
||||||
|
@JsonProperty("color")
|
||||||
|
public String getColor() {
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the <code>color</code> property.
|
||||||
|
*/
|
||||||
|
public void setColor(String color) {
|
||||||
|
this.color = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the <code>color</code> property.
|
||||||
|
*/
|
||||||
|
public Animal color(String color) {
|
||||||
|
this.color = color;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("class Animal {\n");
|
||||||
|
|
||||||
|
sb.append(" className: ").append(toIndentedString(className)).append("\n");
|
||||||
|
sb.append(" color: ").append(toIndentedString(color)).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 static String toIndentedString(java.lang.Object o) {
|
||||||
|
if (o == null) {
|
||||||
|
return "null";
|
||||||
|
}
|
||||||
|
return o.toString().replace("\n", "\n ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,42 @@
|
|||||||
|
package org.openapitools.model;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import org.openapitools.model.Animal;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
|
import javax.xml.bind.annotation.XmlType;
|
||||||
|
import javax.xml.bind.annotation.XmlEnum;
|
||||||
|
import javax.xml.bind.annotation.XmlEnumValue;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
|
public class AnimalFarm extends ArrayList<Animal> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("class AnimalFarm {\n");
|
||||||
|
sb.append(" ").append(toIndentedString(super.toString())).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 static String toIndentedString(java.lang.Object o) {
|
||||||
|
if (o == null) {
|
||||||
|
return "null";
|
||||||
|
}
|
||||||
|
return o.toString().replace("\n", "\n ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,79 @@
|
|||||||
|
package org.openapitools.model;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
|
import javax.xml.bind.annotation.XmlType;
|
||||||
|
import javax.xml.bind.annotation.XmlEnum;
|
||||||
|
import javax.xml.bind.annotation.XmlEnumValue;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
|
public class ArrayOfArrayOfNumberOnly {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "")
|
||||||
|
@Valid
|
||||||
|
private List<List<BigDecimal>> arrayArrayNumber = null;
|
||||||
|
/**
|
||||||
|
* Get arrayArrayNumber
|
||||||
|
* @return arrayArrayNumber
|
||||||
|
*/
|
||||||
|
@JsonProperty("ArrayArrayNumber")
|
||||||
|
public List<List<BigDecimal>> getArrayArrayNumber() {
|
||||||
|
return arrayArrayNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the <code>arrayArrayNumber</code> property.
|
||||||
|
*/
|
||||||
|
public void setArrayArrayNumber(List<List<BigDecimal>> arrayArrayNumber) {
|
||||||
|
this.arrayArrayNumber = arrayArrayNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the <code>arrayArrayNumber</code> property.
|
||||||
|
*/
|
||||||
|
public ArrayOfArrayOfNumberOnly arrayArrayNumber(List<List<BigDecimal>> arrayArrayNumber) {
|
||||||
|
this.arrayArrayNumber = arrayArrayNumber;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a new item to the <code>arrayArrayNumber</code> list.
|
||||||
|
*/
|
||||||
|
public ArrayOfArrayOfNumberOnly addArrayArrayNumberItem(List<BigDecimal> arrayArrayNumberItem) {
|
||||||
|
this.arrayArrayNumber.add(arrayArrayNumberItem);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("class ArrayOfArrayOfNumberOnly {\n");
|
||||||
|
|
||||||
|
sb.append(" arrayArrayNumber: ").append(toIndentedString(arrayArrayNumber)).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 static String toIndentedString(java.lang.Object o) {
|
||||||
|
if (o == null) {
|
||||||
|
return "null";
|
||||||
|
}
|
||||||
|
return o.toString().replace("\n", "\n ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,79 @@
|
|||||||
|
package org.openapitools.model;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
|
import javax.xml.bind.annotation.XmlType;
|
||||||
|
import javax.xml.bind.annotation.XmlEnum;
|
||||||
|
import javax.xml.bind.annotation.XmlEnumValue;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
|
public class ArrayOfNumberOnly {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "")
|
||||||
|
@Valid
|
||||||
|
private List<BigDecimal> arrayNumber = null;
|
||||||
|
/**
|
||||||
|
* Get arrayNumber
|
||||||
|
* @return arrayNumber
|
||||||
|
*/
|
||||||
|
@JsonProperty("ArrayNumber")
|
||||||
|
public List<BigDecimal> getArrayNumber() {
|
||||||
|
return arrayNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the <code>arrayNumber</code> property.
|
||||||
|
*/
|
||||||
|
public void setArrayNumber(List<BigDecimal> arrayNumber) {
|
||||||
|
this.arrayNumber = arrayNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the <code>arrayNumber</code> property.
|
||||||
|
*/
|
||||||
|
public ArrayOfNumberOnly arrayNumber(List<BigDecimal> arrayNumber) {
|
||||||
|
this.arrayNumber = arrayNumber;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a new item to the <code>arrayNumber</code> list.
|
||||||
|
*/
|
||||||
|
public ArrayOfNumberOnly addArrayNumberItem(BigDecimal arrayNumberItem) {
|
||||||
|
this.arrayNumber.add(arrayNumberItem);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("class ArrayOfNumberOnly {\n");
|
||||||
|
|
||||||
|
sb.append(" arrayNumber: ").append(toIndentedString(arrayNumber)).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 static String toIndentedString(java.lang.Object o) {
|
||||||
|
if (o == null) {
|
||||||
|
return "null";
|
||||||
|
}
|
||||||
|
return o.toString().replace("\n", "\n ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,152 @@
|
|||||||
|
package org.openapitools.model;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import org.openapitools.model.ReadOnlyFirst;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
|
import javax.xml.bind.annotation.XmlType;
|
||||||
|
import javax.xml.bind.annotation.XmlEnum;
|
||||||
|
import javax.xml.bind.annotation.XmlEnumValue;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
|
public class ArrayTest {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "")
|
||||||
|
private List<String> arrayOfString = null;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "")
|
||||||
|
@Valid
|
||||||
|
private List<List<Long>> arrayArrayOfInteger = null;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "")
|
||||||
|
@Valid
|
||||||
|
private List<List<ReadOnlyFirst>> arrayArrayOfModel = null;
|
||||||
|
/**
|
||||||
|
* Get arrayOfString
|
||||||
|
* @return arrayOfString
|
||||||
|
*/
|
||||||
|
@JsonProperty("array_of_string")
|
||||||
|
public List<String> getArrayOfString() {
|
||||||
|
return arrayOfString;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the <code>arrayOfString</code> property.
|
||||||
|
*/
|
||||||
|
public void setArrayOfString(List<String> arrayOfString) {
|
||||||
|
this.arrayOfString = arrayOfString;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the <code>arrayOfString</code> property.
|
||||||
|
*/
|
||||||
|
public ArrayTest arrayOfString(List<String> arrayOfString) {
|
||||||
|
this.arrayOfString = arrayOfString;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a new item to the <code>arrayOfString</code> list.
|
||||||
|
*/
|
||||||
|
public ArrayTest addArrayOfStringItem(String arrayOfStringItem) {
|
||||||
|
this.arrayOfString.add(arrayOfStringItem);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get arrayArrayOfInteger
|
||||||
|
* @return arrayArrayOfInteger
|
||||||
|
*/
|
||||||
|
@JsonProperty("array_array_of_integer")
|
||||||
|
public List<List<Long>> getArrayArrayOfInteger() {
|
||||||
|
return arrayArrayOfInteger;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the <code>arrayArrayOfInteger</code> property.
|
||||||
|
*/
|
||||||
|
public void setArrayArrayOfInteger(List<List<Long>> arrayArrayOfInteger) {
|
||||||
|
this.arrayArrayOfInteger = arrayArrayOfInteger;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the <code>arrayArrayOfInteger</code> property.
|
||||||
|
*/
|
||||||
|
public ArrayTest arrayArrayOfInteger(List<List<Long>> arrayArrayOfInteger) {
|
||||||
|
this.arrayArrayOfInteger = arrayArrayOfInteger;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a new item to the <code>arrayArrayOfInteger</code> list.
|
||||||
|
*/
|
||||||
|
public ArrayTest addArrayArrayOfIntegerItem(List<Long> arrayArrayOfIntegerItem) {
|
||||||
|
this.arrayArrayOfInteger.add(arrayArrayOfIntegerItem);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get arrayArrayOfModel
|
||||||
|
* @return arrayArrayOfModel
|
||||||
|
*/
|
||||||
|
@JsonProperty("array_array_of_model")
|
||||||
|
public List<List<ReadOnlyFirst>> getArrayArrayOfModel() {
|
||||||
|
return arrayArrayOfModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the <code>arrayArrayOfModel</code> property.
|
||||||
|
*/
|
||||||
|
public void setArrayArrayOfModel(List<List<ReadOnlyFirst>> arrayArrayOfModel) {
|
||||||
|
this.arrayArrayOfModel = arrayArrayOfModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the <code>arrayArrayOfModel</code> property.
|
||||||
|
*/
|
||||||
|
public ArrayTest arrayArrayOfModel(List<List<ReadOnlyFirst>> arrayArrayOfModel) {
|
||||||
|
this.arrayArrayOfModel = arrayArrayOfModel;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a new item to the <code>arrayArrayOfModel</code> list.
|
||||||
|
*/
|
||||||
|
public ArrayTest addArrayArrayOfModelItem(List<ReadOnlyFirst> arrayArrayOfModelItem) {
|
||||||
|
this.arrayArrayOfModel.add(arrayArrayOfModelItem);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("class ArrayTest {\n");
|
||||||
|
|
||||||
|
sb.append(" arrayOfString: ").append(toIndentedString(arrayOfString)).append("\n");
|
||||||
|
sb.append(" arrayArrayOfInteger: ").append(toIndentedString(arrayArrayOfInteger)).append("\n");
|
||||||
|
sb.append(" arrayArrayOfModel: ").append(toIndentedString(arrayArrayOfModel)).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 static String toIndentedString(java.lang.Object o) {
|
||||||
|
if (o == null) {
|
||||||
|
return "null";
|
||||||
|
}
|
||||||
|
return o.toString().replace("\n", "\n ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,210 @@
|
|||||||
|
package org.openapitools.model;
|
||||||
|
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
|
import javax.xml.bind.annotation.XmlType;
|
||||||
|
import javax.xml.bind.annotation.XmlEnum;
|
||||||
|
import javax.xml.bind.annotation.XmlEnumValue;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
|
public class Capitalization {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "")
|
||||||
|
private String smallCamel;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "")
|
||||||
|
private String capitalCamel;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "")
|
||||||
|
private String smallSnake;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "")
|
||||||
|
private String capitalSnake;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "")
|
||||||
|
private String scAETHFlowPoints;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Name of the pet
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "Name of the pet ")
|
||||||
|
private String ATT_NAME;
|
||||||
|
/**
|
||||||
|
* Get smallCamel
|
||||||
|
* @return smallCamel
|
||||||
|
*/
|
||||||
|
@JsonProperty("smallCamel")
|
||||||
|
public String getSmallCamel() {
|
||||||
|
return smallCamel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the <code>smallCamel</code> property.
|
||||||
|
*/
|
||||||
|
public void setSmallCamel(String smallCamel) {
|
||||||
|
this.smallCamel = smallCamel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the <code>smallCamel</code> property.
|
||||||
|
*/
|
||||||
|
public Capitalization smallCamel(String smallCamel) {
|
||||||
|
this.smallCamel = smallCamel;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get capitalCamel
|
||||||
|
* @return capitalCamel
|
||||||
|
*/
|
||||||
|
@JsonProperty("CapitalCamel")
|
||||||
|
public String getCapitalCamel() {
|
||||||
|
return capitalCamel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the <code>capitalCamel</code> property.
|
||||||
|
*/
|
||||||
|
public void setCapitalCamel(String capitalCamel) {
|
||||||
|
this.capitalCamel = capitalCamel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the <code>capitalCamel</code> property.
|
||||||
|
*/
|
||||||
|
public Capitalization capitalCamel(String capitalCamel) {
|
||||||
|
this.capitalCamel = capitalCamel;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get smallSnake
|
||||||
|
* @return smallSnake
|
||||||
|
*/
|
||||||
|
@JsonProperty("small_Snake")
|
||||||
|
public String getSmallSnake() {
|
||||||
|
return smallSnake;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the <code>smallSnake</code> property.
|
||||||
|
*/
|
||||||
|
public void setSmallSnake(String smallSnake) {
|
||||||
|
this.smallSnake = smallSnake;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the <code>smallSnake</code> property.
|
||||||
|
*/
|
||||||
|
public Capitalization smallSnake(String smallSnake) {
|
||||||
|
this.smallSnake = smallSnake;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get capitalSnake
|
||||||
|
* @return capitalSnake
|
||||||
|
*/
|
||||||
|
@JsonProperty("Capital_Snake")
|
||||||
|
public String getCapitalSnake() {
|
||||||
|
return capitalSnake;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the <code>capitalSnake</code> property.
|
||||||
|
*/
|
||||||
|
public void setCapitalSnake(String capitalSnake) {
|
||||||
|
this.capitalSnake = capitalSnake;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the <code>capitalSnake</code> property.
|
||||||
|
*/
|
||||||
|
public Capitalization capitalSnake(String capitalSnake) {
|
||||||
|
this.capitalSnake = capitalSnake;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get scAETHFlowPoints
|
||||||
|
* @return scAETHFlowPoints
|
||||||
|
*/
|
||||||
|
@JsonProperty("SCA_ETH_Flow_Points")
|
||||||
|
public String getScAETHFlowPoints() {
|
||||||
|
return scAETHFlowPoints;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the <code>scAETHFlowPoints</code> property.
|
||||||
|
*/
|
||||||
|
public void setScAETHFlowPoints(String scAETHFlowPoints) {
|
||||||
|
this.scAETHFlowPoints = scAETHFlowPoints;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the <code>scAETHFlowPoints</code> property.
|
||||||
|
*/
|
||||||
|
public Capitalization scAETHFlowPoints(String scAETHFlowPoints) {
|
||||||
|
this.scAETHFlowPoints = scAETHFlowPoints;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Name of the pet
|
||||||
|
* @return ATT_NAME
|
||||||
|
*/
|
||||||
|
@JsonProperty("ATT_NAME")
|
||||||
|
public String getATTNAME() {
|
||||||
|
return ATT_NAME;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the <code>ATT_NAME</code> property.
|
||||||
|
*/
|
||||||
|
public void setATTNAME(String ATT_NAME) {
|
||||||
|
this.ATT_NAME = ATT_NAME;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the <code>ATT_NAME</code> property.
|
||||||
|
*/
|
||||||
|
public Capitalization ATT_NAME(String ATT_NAME) {
|
||||||
|
this.ATT_NAME = ATT_NAME;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("class Capitalization {\n");
|
||||||
|
|
||||||
|
sb.append(" smallCamel: ").append(toIndentedString(smallCamel)).append("\n");
|
||||||
|
sb.append(" capitalCamel: ").append(toIndentedString(capitalCamel)).append("\n");
|
||||||
|
sb.append(" smallSnake: ").append(toIndentedString(smallSnake)).append("\n");
|
||||||
|
sb.append(" capitalSnake: ").append(toIndentedString(capitalSnake)).append("\n");
|
||||||
|
sb.append(" scAETHFlowPoints: ").append(toIndentedString(scAETHFlowPoints)).append("\n");
|
||||||
|
sb.append(" ATT_NAME: ").append(toIndentedString(ATT_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 static String toIndentedString(java.lang.Object o) {
|
||||||
|
if (o == null) {
|
||||||
|
return "null";
|
||||||
|
}
|
||||||
|
return o.toString().replace("\n", "\n ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,68 @@
|
|||||||
|
package org.openapitools.model;
|
||||||
|
|
||||||
|
import org.openapitools.model.Animal;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
|
import javax.xml.bind.annotation.XmlType;
|
||||||
|
import javax.xml.bind.annotation.XmlEnum;
|
||||||
|
import javax.xml.bind.annotation.XmlEnumValue;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
|
public class Cat extends Animal {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "")
|
||||||
|
private Boolean declawed;
|
||||||
|
/**
|
||||||
|
* Get declawed
|
||||||
|
* @return declawed
|
||||||
|
*/
|
||||||
|
@JsonProperty("declawed")
|
||||||
|
public Boolean getDeclawed() {
|
||||||
|
return declawed;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the <code>declawed</code> property.
|
||||||
|
*/
|
||||||
|
public void setDeclawed(Boolean declawed) {
|
||||||
|
this.declawed = declawed;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the <code>declawed</code> property.
|
||||||
|
*/
|
||||||
|
public Cat declawed(Boolean declawed) {
|
||||||
|
this.declawed = declawed;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("class Cat {\n");
|
||||||
|
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
|
||||||
|
sb.append(" declawed: ").append(toIndentedString(declawed)).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 static String toIndentedString(java.lang.Object o) {
|
||||||
|
if (o == null) {
|
||||||
|
return "null";
|
||||||
|
}
|
||||||
|
return o.toString().replace("\n", "\n ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user