Fix json polymorphism jaxRS (#2602)

* Fix json polymorphism jaxRS

Fix #2576

* Samples
This commit is contained in:
Thibault Duperron
2019-04-18 10:01:46 +02:00
committed by William Cheng
parent ff0d4eb8d7
commit 14215ba554
102 changed files with 1259 additions and 246 deletions

View File

@@ -3,8 +3,7 @@ import java.util.Objects;
import javax.xml.bind.annotation.*;
{{#description}}@ApiModel(description = "{{{description}}}"){{/description}}
{{#description}}@ApiModel(description = "{{{description}}}"){{/description}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}
public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} {
{{#vars}}{{#isEnum}}{{^isContainer}}

View File

@@ -0,0 +1,8 @@
{{#jackson}}
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "{{{discriminatorName}}}", visible = true)
@JsonSubTypes({
{{#discriminator.mappedModels}}
@JsonSubTypes.Type(value = {{modelName}}.class, name = "{{^vendorExtensions.x-discriminator-value}}{{mappingName}}{{/vendorExtensions.x-discriminator-value}}{{#vendorExtensions.x-discriminator-value}}{{{vendorExtensions.x-discriminator-value}}}{{/vendorExtensions.x-discriminator-value}}"),
{{/discriminator.mappedModels}}
})
{{/jackson}}

View File

@@ -17,7 +17,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
{{^hasVars}}@XmlType(name = "{{classname}}"){{/hasVars}}
{{^parent}}@XmlRootElement(name="{{classname}}"){{/parent}}
{{/withXml}}
{{#description}}
{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}{{#description}}
/**
* {{{description}}}
*/

View File

@@ -0,0 +1,8 @@
{{#jackson}}
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "{{{discriminatorName}}}", visible = true)
@JsonSubTypes({
{{#discriminator.mappedModels}}
@JsonSubTypes.Type(value = {{modelName}}.class, name = "{{^vendorExtensions.x-discriminator-value}}{{mappingName}}{{/vendorExtensions.x-discriminator-value}}{{#vendorExtensions.x-discriminator-value}}{{{vendorExtensions.x-discriminator-value}}}{{/vendorExtensions.x-discriminator-value}}"),
{{/discriminator.mappedModels}}
})
{{/jackson}}

View File

@@ -8,21 +8,13 @@ import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
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}} {
{{>xmlPojoAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}}{{#serializableModel}} implements Serializable{{/serializableModel}} {
{{#vars}}{{#isEnum}}{{^isContainer}}
{{>enumClass}}{{/isContainer}}{{#isContainer}}{{#mostInnerItems}}
{{>enumClass}}{{/mostInnerItems}}{{/isContainer}}{{/isEnum}}

View File

@@ -0,0 +1,8 @@
{{#jackson}}
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "{{{discriminatorName}}}", visible = true)
@JsonSubTypes({
{{#discriminator.mappedModels}}
@JsonSubTypes.Type(value = {{modelName}}.class, name = "{{^vendorExtensions.x-discriminator-value}}{{mappingName}}{{/vendorExtensions.x-discriminator-value}}{{#vendorExtensions.x-discriminator-value}}{{{vendorExtensions.x-discriminator-value}}}{{/vendorExtensions.x-discriminator-value}}"),
{{/discriminator.mappedModels}}
})
{{/jackson}}

View File

@@ -0,0 +1,8 @@
{{#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}}

View File

@@ -2,7 +2,7 @@
* {{#description}}{{.}}{{/description}}{{^description}}{{classname}}{{/description}}
*/{{#description}}
@ApiModel(description = "{{{description}}}"){{/description}}
{{>generatedAnnotation}}
{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}
public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} {
{{#vars}}
{{#isEnum}}

View File

@@ -1,7 +1,6 @@
import io.swagger.annotations.*;
{{#description}}@ApiModel(description="{{{description}}}"){{/description}}
{{>generatedAnnotation}}
{{#description}}@ApiModel(description="{{{description}}}"){{/description}}{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}
public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} {
{{#serializableModel}}
private static final long serialVersionUID = 1L;

View File

@@ -0,0 +1,8 @@
{{#jackson}}
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "{{{discriminatorName}}}", visible = true)
@JsonSubTypes({
{{#discriminator.mappedModels}}
@JsonSubTypes.Type(value = {{modelName}}.class, name = "{{^vendorExtensions.x-discriminator-value}}{{mappingName}}{{/vendorExtensions.x-discriminator-value}}{{#vendorExtensions.x-discriminator-value}}{{{vendorExtensions.x-discriminator-value}}}{{/vendorExtensions.x-discriminator-value}}"),
{{/discriminator.mappedModels}}
})
{{/jackson}}

View File

@@ -1,7 +1,6 @@
import io.swagger.annotations.*;
{{#description}}@ApiModel(description="{{{description}}}"){{/description}}
{{>generatedAnnotation}}
{{#description}}@ApiModel(description="{{{description}}}"){{/description}}{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}
public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} {
{{#serializableModel}}
private static final long serialVersionUID = 1L;

View File

@@ -0,0 +1,8 @@
{{#jackson}}
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "{{{discriminatorName}}}", visible = true)
@JsonSubTypes({
{{#discriminator.mappedModels}}
@JsonSubTypes.Type(value = {{modelName}}.class, name = "{{^vendorExtensions.x-discriminator-value}}{{mappingName}}{{/vendorExtensions.x-discriminator-value}}{{#vendorExtensions.x-discriminator-value}}{{{vendorExtensions.x-discriminator-value}}}{{/vendorExtensions.x-discriminator-value}}"),
{{/discriminator.mappedModels}}
})
{{/jackson}}

View File

@@ -6,7 +6,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
{{#description}}
{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}{{#description}}
/**
* {{description}}
**/{{/description}}{{#useSwaggerAnnotations}}

View File

@@ -0,0 +1,8 @@
{{#jackson}}
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "{{{discriminatorName}}}", visible = true)
@JsonSubTypes({
{{#discriminator.mappedModels}}
@JsonSubTypes.Type(value = {{modelName}}.class, name = "{{^vendorExtensions.x-discriminator-value}}{{mappingName}}{{/vendorExtensions.x-discriminator-value}}{{#vendorExtensions.x-discriminator-value}}{{{vendorExtensions.x-discriminator-value}}}{{/vendorExtensions.x-discriminator-value}}"),
{{/discriminator.mappedModels}}
})
{{/jackson}}

View File

@@ -1,8 +1,8 @@
{{#jackson}}
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "{{{discriminatorName}}}", visible = true)
@JsonSubTypes({
{{#discriminator.mappedModels}}
@JsonSubTypes.Type(value = {{modelName}}.class, name = "{{^vendorExtensions.x-discriminator-value}}{{mappingName}}{{/vendorExtensions.x-discriminator-value}}{{#vendorExtensions.x-discriminator-value}}{{{vendorExtensions.x-discriminator-value}}}{{/vendorExtensions.x-discriminator-value}}"),
{{/discriminator.mappedModels}}
}){{/jackson}}
})
{{/jackson}}

View File

@@ -30,7 +30,7 @@ public class AbstractJavaJAXRSServerCodegenTest {
private final AbstractJavaJAXRSServerCodegen fakeJavaJAXRSCodegen = new P_AbstractJavaJAXRSServerCodegen();
@Test
public void convertApiName() throws Exception {
public void convertApiName() {
Assert.assertEquals(fakeJavaJAXRSCodegen.toApiName("name"), "NameApi");
Assert.assertEquals(fakeJavaJAXRSCodegen.toApiName("$name"), "NameApi");
Assert.assertEquals(fakeJavaJAXRSCodegen.toApiName("nam#e"), "NameApi");
@@ -83,8 +83,8 @@ public class AbstractJavaJAXRSServerCodegenTest {
codegen.additionalProperties().put(CodegenConstants.HIDE_GENERATION_TIMESTAMP, "true");
codegen.additionalProperties().put(CodegenConstants.MODEL_PACKAGE, "xyz.yyyyy.mmmmm.model");
codegen.additionalProperties().put(CodegenConstants.API_PACKAGE, "xyz.yyyyy.aaaaa.api");
codegen.additionalProperties().put(CodegenConstants.INVOKER_PACKAGE,"xyz.yyyyy.iiii.invoker");
codegen.additionalProperties().put("serverPort","8088");
codegen.additionalProperties().put(CodegenConstants.INVOKER_PACKAGE, "xyz.yyyyy.iiii.invoker");
codegen.additionalProperties().put("serverPort", "8088");
codegen.processOpts();
OpenAPI openAPI = new OpenAPI();

View File

@@ -21,8 +21,7 @@ import java.util.regex.Pattern;
import static org.testng.Assert.*;
public class JavaJAXRSCXFExtServerCodegenTest {
@SuppressWarnings("unused")
public class JavaJAXRSCXFExtServerCodegenTest extends JavaJaxrsBaseTest {
private static class JavaCXFExtServerCodegenTester extends JavaCXFExtServerCodegen {
/* Options processed by DefaultCodegen */
@@ -36,9 +35,6 @@ public class JavaJAXRSCXFExtServerCodegenTest {
return apiPackage;
}
// CodegenConstants.DOCEXTENSION
// String getDocExtension();
// CodegenConstants.ARTIFACT_DESCRIPTION
public String getArtifactDescription() {
return artifactDescription;
@@ -101,11 +97,6 @@ public class JavaJAXRSCXFExtServerCodegenTest {
return groupId;
}
// CodegenConstants.HIDE_GENERATION_TIMESTAMP
public Boolean getHideGenerationTimestamp() {
return hideGenerationTimestamp;
}
// CodegenConstants.IMPL_FOLDER
public String getImplFolder() {
return implFolder;
@@ -126,11 +117,6 @@ public class JavaJAXRSCXFExtServerCodegenTest {
return licenseUrl;
}
// CodegenConstants.LOCAL_VARIABLE_PREFIX
public String getLocalVariablePrefix() {
return localVariablePrefix;
}
// CodegenConstants.MODEL_NAME_PREFIX
public String getModelNamePrefix() {
return modelNamePrefix;
@@ -232,8 +218,6 @@ public class JavaJAXRSCXFExtServerCodegenTest {
return generateSpringApplication;
}
// AbstractJavaJAXRSServerCodegen.SERVER_PORT (no corresponding field)
/* Options processed by JavaCXFServerCodegen */
// SpringFeatures.GENERATE_SPRING_BOOT_APPLICATION
@@ -256,11 +240,6 @@ public class JavaJAXRSCXFExtServerCodegenTest {
return supportAsync;
}
// AbstractJavaCodegen.SUPPORT_JAVA6
public boolean isSupportJava6() {
return supportJava6;
}
// CXFServerFeatures.USE_ANNOTATED_BASE_PATH
public boolean isUseAnnotatedBasePath() {
return useAnnotatedBasePath;
@@ -359,8 +338,6 @@ public class JavaJAXRSCXFExtServerCodegenTest {
}
}
private JavaCXFExtServerCodegenTester codegen;
@BeforeMethod
public void beforeMethod() {
codegen = new JavaCXFExtServerCodegenTester();
@@ -386,7 +363,8 @@ public class JavaJAXRSCXFExtServerCodegenTest {
@Test
public void testAdditionalPropertiesPutForConfigValues() throws Exception {
Map<String, Object> additionalProperties = codegen.additionalProperties();
JavaCXFExtServerCodegenTester testerCodegen = (JavaCXFExtServerCodegenTester) this.codegen;
Map<String, Object> additionalProperties = testerCodegen.additionalProperties();
// Options processed by DefaultCodegen
additionalProperties.put(CodegenConstants.ALLOW_UNICODE_IDENTIFIERS, "true");
@@ -458,81 +436,80 @@ public class JavaJAXRSCXFExtServerCodegenTest {
additionalProperties.put(CXFExtServerFeatures.TEST_DATA_FILE, "my/test-data.json");
additionalProperties.put(CXFExtServerFeatures.TEST_DATA_CONTROL_FILE, "my/test-data-control.json");
codegen.processOpts();
testerCodegen.processOpts();
OpenAPI openAPI = new OpenAPI();
openAPI.addServersItem(new Server().url("https://api.abcde.xy:8082/v2"));
codegen.preprocessOpenAPI(openAPI);
testerCodegen.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");
assertEquals(testerCodegen.getAllowUnicodeIdentifiers(), Boolean.TRUE);
assertEquals(testerCodegen.apiPackage(), "xyz.yyyyy.aaaaa.api");
assertEquals(testerCodegen.getDocExtension(), "doc");
assertEquals(testerCodegen.getEnsureUniqueParams(), Boolean.TRUE);
assertEquals(testerCodegen.isHideGenerationTimestamp(), true);
assertEquals(testerCodegen.getInvokerPackage(), "xyz.yyyyy.iiii.invoker");
assertEquals(testerCodegen.getModelNamePrefix(), "MyPrefix");
assertEquals(testerCodegen.getModelNameSuffix(), "MySuffix");
assertEquals(testerCodegen.getModelPackage(), "xyz.yyyyy.mmmmm.model");
assertEquals(testerCodegen.getPrependFormOrBodyParameters(), Boolean.TRUE);
assertEquals(testerCodegen.getRemoveOperationIdPrefix(), true);
assertEquals(testerCodegen.getSortParamsByRequiredFlag(), Boolean.TRUE);
assertEquals(testerCodegen.getTemplateDir(), "MyTemplates");
assertEquals(testerCodegen.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);
assertEquals(testerCodegen.getArtifactId(), "my-artifact");
assertEquals(testerCodegen.getArtifactVersion(), "9.9.9");
assertEquals(testerCodegen.getArtifactUrl(), "http://organisation.org/group/artifact");
assertEquals(testerCodegen.getDeveloperEmail(), "dchappie@organisation.org");
assertEquals(testerCodegen.getDeveloperName(), "Developer Chappie");
assertEquals(testerCodegen.getDeveloperOrganization(), "My Organisation");
assertEquals(testerCodegen.getDeveloperOrganizationUrl(), "http://www.organisation.org/");
assertEquals(testerCodegen.getGroupId(), "org.organisation.group.id");
assertEquals(testerCodegen.getLicenseName(), "Apache 2.0");
assertEquals(testerCodegen.getLicenseUrl(), "https://www.apache.org/licenses/LICENSE-2.0");
assertEquals(testerCodegen.getScmConnection(), "http://svn.organisation.org/group/");
assertEquals(testerCodegen.getScmDeveloperConnection(), "http://svn.organisation.org/dev/group/");
assertEquals(testerCodegen.getScmUrl(), "http://svn.organisation.org/group/");
assertEquals(testerCodegen.isSerializeBigDecimalAsString(), true);
assertEquals(testerCodegen.getSerializableModel(), Boolean.TRUE);
assertEquals(testerCodegen.getSourceFolder(), "src/main/java");
assertEquals(testerCodegen.getBooleanGetterPrefix(), "isIt");
assertEquals(testerCodegen.getDateLibrary(), "MyDateLibrary");
assertEquals(testerCodegen.isDisableHtmlEscaping(), true);
assertEquals(testerCodegen.isFullJavaUtil(), true);
assertEquals(testerCodegen.isJava8Mode(), true);
assertEquals(testerCodegen.isSupportAsync(), true);
assertEquals(testerCodegen.isUseNullForUnknownEnumValue(), true);
assertEquals(testerCodegen.isWithXml(), true);
// Options processed by AbstractJavaJAXRSServerCodegen
assertEquals(codegen.getImplFolder(), "myimpl");
assertEquals(codegen.isUseBeanValidation(), true);
// assertEquals(codegen.getServerPort(), 8088);
assertEquals(testerCodegen.getImplFolder(), "myimpl");
assertEquals(testerCodegen.isUseBeanValidation(), true);
// 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);
assertEquals(testerCodegen.isUseBeanValidationFeature(), true);
assertEquals(testerCodegen.isUseGzipFeature(), true);
assertEquals(testerCodegen.isUseGzipFeatureForTests(), true);
assertEquals(testerCodegen.isGenerateJbossDeploymentDescriptor(), true);
assertEquals(testerCodegen.isUseLoggingFeature(), true);
assertEquals(testerCodegen.isUseLoggingFeatureForTests(), true);
assertEquals(testerCodegen.isGenerateSpringApplication(), true);
assertEquals(testerCodegen.isGenerateSpringBootApplication(), true);
assertEquals(testerCodegen.isUseSpringAnnotationConfig(), true);
assertEquals(testerCodegen.isUseSwaggerFeature(), true);
assertEquals(testerCodegen.isUseSwaggerUI(), true);
assertEquals(testerCodegen.isUseGenericResponse(), true);
assertEquals(testerCodegen.isAddConsumesProducesJson(), true);
assertEquals(testerCodegen.isGenerateNonSpringApplication(), false);
assertEquals(testerCodegen.isUseAnnotatedBasePath(), true);
assertEquals(testerCodegen.isUseMultipartFeature(), true);
assertEquals(testerCodegen.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"));
assertEquals(testerCodegen.isGenerateOperationBody(), true);
assertEquals(testerCodegen.isLoadTestDataFromFile(), true);
assertEquals(testerCodegen.isSupportMultipleSpringServices(), true);
assertEquals(testerCodegen.getTestDataFile(), new File(curdir, "my/test-data.json"));
assertEquals(testerCodegen.getTestDataControlFile(), new File(curdir, "my/test-data-control.json"));
}
@Test
@@ -813,4 +790,5 @@ public class JavaJAXRSCXFExtServerCodegenTest {
assertEquals(additionalProperties.get(CodegenConstants.API_PACKAGE), "xx.yyyyyyyy.api");
assertEquals(codegen.getInvokerPackage(), "xx.yyyyyyyy.invoker");
}
}

View File

@@ -16,13 +16,11 @@ import java.util.Map;
*
* @author attrobit
*/
public class JavaJAXRSSpecServerCodegenTest {
private JavaJAXRSSpecServerCodegen instance;
public class JavaJAXRSSpecServerCodegenTest extends JavaJaxrsBaseTest {
@BeforeMethod
public void before() {
instance = new JavaJAXRSSpecServerCodegen();
codegen = new JavaJAXRSSpecServerCodegen();
}
/**
@@ -36,7 +34,7 @@ public class JavaJAXRSSpecServerCodegenTest {
Operation operation = new Operation();
Map<String, List<CodegenOperation>> operationList = new HashMap<>();
instance.addOperationToGroup("Primaryresource", "/", operation, codegenOperation, operationList);
codegen.addOperationToGroup("Primaryresource", "/", operation, codegenOperation, operationList);
Assert.assertEquals(operationList.size(), 1);
Assert.assertTrue(operationList.containsKey(""));
@@ -54,7 +52,7 @@ public class JavaJAXRSSpecServerCodegenTest {
Operation operation = new Operation();
Map<String, List<CodegenOperation>> operationList = new HashMap<>();
instance.addOperationToGroup("Primaryresource", "/{uuid}", operation, codegenOperation, operationList);
codegen.addOperationToGroup("Primaryresource", "/{uuid}", operation, codegenOperation, operationList);
Assert.assertEquals(operationList.size(), 1);
Assert.assertTrue(operationList.containsKey(""));
@@ -73,7 +71,7 @@ public class JavaJAXRSSpecServerCodegenTest {
Operation operation = new Operation();
Map<String, List<CodegenOperation>> operationList = new HashMap<>();
instance.addOperationToGroup("Default", "/subresource", operation, codegenOperation, operationList);
codegen.addOperationToGroup("Default", "/subresource", operation, codegenOperation, operationList);
Assert.assertEquals(codegenOperation.baseName, "subresource");
Assert.assertEquals(operationList.size(), 1);
@@ -85,7 +83,7 @@ public class JavaJAXRSSpecServerCodegenTest {
*/
@Test
public void testToApiNameForSubresource() {
final String subresource = instance.toApiName("subresource");
final String subresource = codegen.toApiName("subresource");
Assert.assertEquals(subresource, "SubresourceApi");
}
@@ -98,9 +96,9 @@ public class JavaJAXRSSpecServerCodegenTest {
codegenOperation.operationId = "findPrimaryresource";
Operation operation = new Operation();
Map<String, List<CodegenOperation>> operationList = new HashMap<>();
instance.addOperationToGroup("Primaryresource", "/", operation, codegenOperation, operationList);
codegen.addOperationToGroup("Primaryresource", "/", operation, codegenOperation, operationList);
final String subresource = instance.toApiName("");
final String subresource = codegen.toApiName("");
Assert.assertEquals(subresource, "PrimaryresourceApi");
}
}

View File

@@ -0,0 +1,99 @@
package org.openapitools.codegen.java.jaxrs;
import io.swagger.parser.OpenAPIParser;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.parser.core.models.ParseOptions;
import org.openapitools.codegen.ClientOptInput;
import org.openapitools.codegen.ClientOpts;
import org.openapitools.codegen.MockDefaultGenerator;
import org.openapitools.codegen.languages.AbstractJavaJAXRSServerCodegen;
import org.openapitools.codegen.languages.features.CXFServerFeatures;
import org.testng.annotations.Test;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue;
public abstract class JavaJaxrsBaseTest {
protected AbstractJavaJAXRSServerCodegen codegen;
@Test
public void generateJsonAnnotationForPolymorphism() throws IOException {
File output = Files.createTempDirectory("test").toFile().getCanonicalFile();
output.deleteOnExit();
String outputPath = output.getAbsolutePath().replace('\\', '/');
OpenAPI openAPI = new OpenAPIParser()
.readLocation("src/test/resources/3_0/generic.yaml", null, new ParseOptions()).getOpenAPI();
codegen.setOutputDir(output.getAbsolutePath());
ClientOpts opts = new ClientOpts();
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 jsonTypeInfo = "@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = \"className\", visible = true)";
String jsonSubType = "@JsonSubTypes({\n" +
" @JsonSubTypes.Type(value = Dog.class, name = \"Dog\"),\n" +
" @JsonSubTypes.Type(value = Cat.class, name = \"Cat\"),\n" +
"})";
checkFileContains(generator, outputPath + "/src/gen/java/org/openapitools/model/Animal.java", jsonTypeInfo, jsonSubType);
}
private void checkFileContains(MockDefaultGenerator generator, String path, String... lines) {
String file = generator.getFiles().get(path);
assertNotNull(file);
for (String line : lines)
assertTrue(file.contains(line));
}
@Test
public void doNotGenerateJsonAnnotationForPolymorphismIfJsonExclude() throws IOException {
codegen.additionalProperties().put("jackson", false);
File output = Files.createTempDirectory("test").toFile().getCanonicalFile();
output.deleteOnExit();
String outputPath = output.getAbsolutePath().replace('\\', '/');
OpenAPI openAPI = new OpenAPIParser()
.readLocation("src/test/resources/3_0/generic.yaml", null, new ParseOptions()).getOpenAPI();
codegen.setOutputDir(output.getAbsolutePath());
ClientOpts opts = new ClientOpts();
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 jsonTypeInfo = "@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = \"className\", visible = true)";
String jsonSubType = "@JsonSubTypes({\n" +
" @JsonSubTypes.Type(value = Dog.class, name = \"Dog\"),\n" +
" @JsonSubTypes.Type(value = Cat.class, name = \"Cat\"),\n" +
"})";
checkFileNotContains(generator, outputPath + "/src/gen/java/org/openapitools/model/Animal.java", jsonTypeInfo, jsonSubType);
}
private void checkFileNotContains(MockDefaultGenerator generator, String path, String... lines) {
String file = generator.getFiles().get(path);
assertNotNull(file);
for (String line : lines)
assertFalse(file.contains(line));
}
}

View File

@@ -6,12 +6,18 @@ import io.swagger.v3.oas.models.media.Schema;
import org.openapitools.codegen.CodegenModel;
import org.openapitools.codegen.TestUtils;
import org.openapitools.codegen.languages.JavaResteasyServerCodegen;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
public class JavaJaxrsResteasyServerCodegenModelTest {
public class JavaJaxrsResteasyServerCodegenModelTest extends JavaJaxrsBaseTest {
@BeforeMethod
public void beforeMethod() {
codegen = new JavaResteasyServerCodegen();
}
@Test(description = "convert a simple java model with java8 types")
public void mapModelTest() {
@@ -19,7 +25,6 @@ public class JavaJaxrsResteasyServerCodegenModelTest {
.description("A model with a map")
.addProperties("map", new MapSchema());
final JavaResteasyServerCodegen codegen = new JavaResteasyServerCodegen();
OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("sample", model);
codegen.setOpenAPI(openAPI);
final CodegenModel cm = codegen.fromModel("sample", model);

View File

@@ -2,10 +2,16 @@ package org.openapitools.codegen.java.jaxrs;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.servers.Server;
import org.openapitools.codegen.*;
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.JavaJerseyServerCodegen;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import java.io.File;
@@ -13,11 +19,15 @@ import java.nio.file.Files;
import java.util.List;
import java.util.Map;
public class JavaJerseyServerCodegenTest {
public class JavaJerseyServerCodegenTest extends JavaJaxrsBaseTest {
@BeforeMethod
public void before() {
codegen = new JavaJerseyServerCodegen();
}
@Test
public void testInitialConfigValues() throws Exception {
final JavaJerseyServerCodegen codegen = new JavaJerseyServerCodegen();
codegen.processOpts();
OpenAPI openAPI = new OpenAPI();
@@ -37,7 +47,6 @@ public class JavaJerseyServerCodegenTest {
@Test
public void testSettersForConfigValues() throws Exception {
final JavaJerseyServerCodegen codegen = new JavaJerseyServerCodegen();
codegen.setHideGenerationTimestamp(true);
codegen.setModelPackage("xx.yyyyyyyy.model");
codegen.setApiPackage("xx.yyyyyyyy.api");
@@ -56,12 +65,11 @@ public class JavaJerseyServerCodegenTest {
@Test
public void testAdditionalPropertiesPutForConfigValues() throws Exception {
final JavaJerseyServerCodegen codegen = new JavaJerseyServerCodegen();
codegen.additionalProperties().put(CodegenConstants.HIDE_GENERATION_TIMESTAMP, "true");
codegen.additionalProperties().put(CodegenConstants.MODEL_PACKAGE, "xyz.yyyyy.mmmmm.model");
codegen.additionalProperties().put(CodegenConstants.API_PACKAGE, "xyz.yyyyy.aaaaa.api");
codegen.additionalProperties().put(CodegenConstants.INVOKER_PACKAGE,"xyz.yyyyy.iiii.invoker");
codegen.additionalProperties().put("serverPort","8088");
codegen.additionalProperties().put(CodegenConstants.INVOKER_PACKAGE, "xyz.yyyyy.iiii.invoker");
codegen.additionalProperties().put("serverPort", "8088");
codegen.processOpts();
OpenAPI openAPI = new OpenAPI();
@@ -85,8 +93,7 @@ public class JavaJerseyServerCodegenTest {
output.deleteOnExit();
OpenAPI openAPI = TestUtils.parseSpec("src/test/resources/3_0/tags.yaml");
JavaJerseyServerCodegen codegen = new JavaJerseyServerCodegen();
codegen.setUseTags(false);
((JavaJerseyServerCodegen) codegen).setUseTags(false);
codegen.setOutputDir(output.getAbsolutePath());
ClientOpts opts = new ClientOpts();
@@ -165,8 +172,7 @@ public class JavaJerseyServerCodegenTest {
output.deleteOnExit();
OpenAPI openAPI = TestUtils.parseSpec("src/test/resources/3_0/tags.yaml");
JavaJerseyServerCodegen codegen = new JavaJerseyServerCodegen();
codegen.setUseTags(true);
((JavaJerseyServerCodegen) codegen).setUseTags(true);
codegen.setOutputDir(output.getAbsolutePath());
ClientOpts opts = new ClientOpts();

View File

@@ -6,12 +6,18 @@ import io.swagger.v3.oas.models.media.Schema;
import org.openapitools.codegen.CodegenModel;
import org.openapitools.codegen.TestUtils;
import org.openapitools.codegen.languages.JavaResteasyEapServerCodegen;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
public class JavaResteasyEapServerCodegenModelTest {
public class JavaResteasyEapServerCodegenModelTest extends JavaJaxrsBaseTest {
@BeforeMethod
public void before() {
codegen = new JavaResteasyEapServerCodegen();
}
@Test(description = "convert a simple java model with java8 types")
public void mapModelTest() {
@@ -19,7 +25,6 @@ public class JavaResteasyEapServerCodegenModelTest {
.description("A model with a map")
.addProperties("map", new MapSchema());
final JavaResteasyEapServerCodegen codegen = new JavaResteasyEapServerCodegen();
OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("sample", model);
codegen.setOpenAPI(openAPI);
final CodegenModel cm = codegen.fromModel("sample", model);

View File

@@ -0,0 +1,58 @@
openapi: 3.0.0
info:
title: Sample API
description: API description in Markdown.
version: 1.0.0
paths:
/animals:
get:
summary: Returns all animals.
description: Optional extended description in Markdown.
responses:
200:
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Animal'
components:
schemas:
Dog:
allOf:
- $ref: '#/components/schemas/Animal'
- type: object
properties:
breed:
type: string
Cat:
allOf:
- $ref: '#/components/schemas/Animal'
- type: object
properties:
breed:
type: string
BigDog:
allOf:
- $ref: '#/components/schemas/Dog'
- type: object
discriminator:
propertyName: dogType
required:
- dogType
properties:
dogType:
type: string
declawed:
type: boolean
Animal:
type: object
discriminator:
propertyName: className
required:
- className
properties:
className:
type: string
color:
type: string
default: red

View File

@@ -16,7 +16,6 @@ import java.util.Objects;
import javax.xml.bind.annotation.*;
@ApiModel(description = "A category for a pet")
public class Category {
private Long id;

View File

@@ -16,7 +16,6 @@ import java.util.Objects;
import javax.xml.bind.annotation.*;
@ApiModel(description = "Describes the result of uploading an image resource")
public class ModelApiResponse {
private Integer code;

View File

@@ -16,7 +16,6 @@ import java.util.Objects;
import javax.xml.bind.annotation.*;
@ApiModel(description = "An order for a pets from the pet store")
public class Order {
private Long id;

View File

@@ -20,7 +20,6 @@ import java.util.Objects;
import javax.xml.bind.annotation.*;
@ApiModel(description = "A pet for sale in the pet store")
public class Pet {
private Long id;

View File

@@ -16,7 +16,6 @@ import java.util.Objects;
import javax.xml.bind.annotation.*;
@ApiModel(description = "A tag for a pet")
public class Tag {
private Long id;

View File

@@ -16,7 +16,6 @@ import java.util.Objects;
import javax.xml.bind.annotation.*;
@ApiModel(description = "A User who is purchasing from the pet store")
public class User {
private Long id;

View File

@@ -0,0 +1,69 @@
package org.openapitools.model;
import java.util.HashMap;
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 AdditionalPropertiesAnyType extends HashMap<String, Object> {
@ApiModelProperty(value = "")
private String name;
/**
* Get name
* @return name
*/
@JsonProperty("name")
public String getName() {
return name;
}
/**
* Sets the <code>name</code> property.
*/
public void setName(String name) {
this.name = name;
}
/**
* Sets the <code>name</code> property.
*/
public AdditionalPropertiesAnyType name(String name) {
this.name = name;
return this;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class AdditionalPropertiesAnyType {\n");
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private static String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -0,0 +1,70 @@
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 AdditionalPropertiesArray extends HashMap<String, List> {
@ApiModelProperty(value = "")
private String name;
/**
* Get name
* @return name
*/
@JsonProperty("name")
public String getName() {
return name;
}
/**
* Sets the <code>name</code> property.
*/
public void setName(String name) {
this.name = name;
}
/**
* Sets the <code>name</code> property.
*/
public AdditionalPropertiesArray name(String name) {
this.name = name;
return this;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class AdditionalPropertiesArray {\n");
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private static String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -0,0 +1,69 @@
package org.openapitools.model;
import java.util.HashMap;
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 AdditionalPropertiesBoolean extends HashMap<String, Boolean> {
@ApiModelProperty(value = "")
private String name;
/**
* Get name
* @return name
*/
@JsonProperty("name")
public String getName() {
return name;
}
/**
* Sets the <code>name</code> property.
*/
public void setName(String name) {
this.name = name;
}
/**
* Sets the <code>name</code> property.
*/
public AdditionalPropertiesBoolean name(String name) {
this.name = name;
return this;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class AdditionalPropertiesBoolean {\n");
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private static String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -1,5 +1,6 @@
package org.openapitools.model;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -20,72 +21,370 @@ import com.fasterxml.jackson.annotation.JsonProperty;
public class AdditionalPropertiesClass {
@ApiModelProperty(value = "")
private Map<String, String> mapProperty = null;
private Map<String, String> mapString = null;
@ApiModelProperty(value = "")
@Valid
private Map<String, Map<String, String>> mapOfMapProperty = null;
private Map<String, BigDecimal> mapNumber = null;
@ApiModelProperty(value = "")
private Map<String, Integer> mapInteger = null;
@ApiModelProperty(value = "")
private Map<String, Boolean> mapBoolean = null;
@ApiModelProperty(value = "")
@Valid
private Map<String, List<Integer>> mapArrayInteger = null;
@ApiModelProperty(value = "")
@Valid
private Map<String, List<Object>> mapArrayAnytype = null;
@ApiModelProperty(value = "")
@Valid
private Map<String, Map<String, String>> mapMapString = null;
@ApiModelProperty(value = "")
@Valid
private Map<String, Map<String, Object>> mapMapAnytype = null;
@ApiModelProperty(value = "")
@Valid
private Object anytype1 = null;
@ApiModelProperty(value = "")
@Valid
private Object anytype2 = null;
@ApiModelProperty(value = "")
@Valid
private Object anytype3 = null;
/**
* Get mapProperty
* @return mapProperty
* Get mapString
* @return mapString
*/
@JsonProperty("map_property")
public Map<String, String> getMapProperty() {
return mapProperty;
@JsonProperty("map_string")
public Map<String, String> getMapString() {
return mapString;
}
/**
* Sets the <code>mapProperty</code> property.
* Sets the <code>mapString</code> property.
*/
public void setMapProperty(Map<String, String> mapProperty) {
this.mapProperty = mapProperty;
public void setMapString(Map<String, String> mapString) {
this.mapString = mapString;
}
/**
* Sets the <code>mapProperty</code> property.
* Sets the <code>mapString</code> property.
*/
public AdditionalPropertiesClass mapProperty(Map<String, String> mapProperty) {
this.mapProperty = mapProperty;
public AdditionalPropertiesClass mapString(Map<String, String> mapString) {
this.mapString = mapString;
return this;
}
/**
* Puts a new item into the <code>mapProperty</code> map.
* Puts a new item into the <code>mapString</code> map.
*/
public AdditionalPropertiesClass putMapPropertyItem(String key, String mapPropertyItem) {
this.mapProperty.put(key, mapPropertyItem);
public AdditionalPropertiesClass putMapStringItem(String key, String mapStringItem) {
this.mapString.put(key, mapStringItem);
return this;
}
/**
* Get mapOfMapProperty
* @return mapOfMapProperty
* Get mapNumber
* @return mapNumber
*/
@JsonProperty("map_of_map_property")
public Map<String, Map<String, String>> getMapOfMapProperty() {
return mapOfMapProperty;
@JsonProperty("map_number")
public Map<String, BigDecimal> getMapNumber() {
return mapNumber;
}
/**
* Sets the <code>mapOfMapProperty</code> property.
* Sets the <code>mapNumber</code> property.
*/
public void setMapOfMapProperty(Map<String, Map<String, String>> mapOfMapProperty) {
this.mapOfMapProperty = mapOfMapProperty;
public void setMapNumber(Map<String, BigDecimal> mapNumber) {
this.mapNumber = mapNumber;
}
/**
* Sets the <code>mapOfMapProperty</code> property.
* Sets the <code>mapNumber</code> property.
*/
public AdditionalPropertiesClass mapOfMapProperty(Map<String, Map<String, String>> mapOfMapProperty) {
this.mapOfMapProperty = mapOfMapProperty;
public AdditionalPropertiesClass mapNumber(Map<String, BigDecimal> mapNumber) {
this.mapNumber = mapNumber;
return this;
}
/**
* Puts a new item into the <code>mapOfMapProperty</code> map.
* Puts a new item into the <code>mapNumber</code> map.
*/
public AdditionalPropertiesClass putMapOfMapPropertyItem(String key, Map<String, String> mapOfMapPropertyItem) {
this.mapOfMapProperty.put(key, mapOfMapPropertyItem);
public AdditionalPropertiesClass putMapNumberItem(String key, BigDecimal mapNumberItem) {
this.mapNumber.put(key, mapNumberItem);
return this;
}
/**
* Get mapInteger
* @return mapInteger
*/
@JsonProperty("map_integer")
public Map<String, Integer> getMapInteger() {
return mapInteger;
}
/**
* Sets the <code>mapInteger</code> property.
*/
public void setMapInteger(Map<String, Integer> mapInteger) {
this.mapInteger = mapInteger;
}
/**
* Sets the <code>mapInteger</code> property.
*/
public AdditionalPropertiesClass mapInteger(Map<String, Integer> mapInteger) {
this.mapInteger = mapInteger;
return this;
}
/**
* Puts a new item into the <code>mapInteger</code> map.
*/
public AdditionalPropertiesClass putMapIntegerItem(String key, Integer mapIntegerItem) {
this.mapInteger.put(key, mapIntegerItem);
return this;
}
/**
* Get mapBoolean
* @return mapBoolean
*/
@JsonProperty("map_boolean")
public Map<String, Boolean> getMapBoolean() {
return mapBoolean;
}
/**
* Sets the <code>mapBoolean</code> property.
*/
public void setMapBoolean(Map<String, Boolean> mapBoolean) {
this.mapBoolean = mapBoolean;
}
/**
* Sets the <code>mapBoolean</code> property.
*/
public AdditionalPropertiesClass mapBoolean(Map<String, Boolean> mapBoolean) {
this.mapBoolean = mapBoolean;
return this;
}
/**
* Puts a new item into the <code>mapBoolean</code> map.
*/
public AdditionalPropertiesClass putMapBooleanItem(String key, Boolean mapBooleanItem) {
this.mapBoolean.put(key, mapBooleanItem);
return this;
}
/**
* Get mapArrayInteger
* @return mapArrayInteger
*/
@JsonProperty("map_array_integer")
public Map<String, List<Integer>> getMapArrayInteger() {
return mapArrayInteger;
}
/**
* Sets the <code>mapArrayInteger</code> property.
*/
public void setMapArrayInteger(Map<String, List<Integer>> mapArrayInteger) {
this.mapArrayInteger = mapArrayInteger;
}
/**
* Sets the <code>mapArrayInteger</code> property.
*/
public AdditionalPropertiesClass mapArrayInteger(Map<String, List<Integer>> mapArrayInteger) {
this.mapArrayInteger = mapArrayInteger;
return this;
}
/**
* Puts a new item into the <code>mapArrayInteger</code> map.
*/
public AdditionalPropertiesClass putMapArrayIntegerItem(String key, List<Integer> mapArrayIntegerItem) {
this.mapArrayInteger.put(key, mapArrayIntegerItem);
return this;
}
/**
* Get mapArrayAnytype
* @return mapArrayAnytype
*/
@JsonProperty("map_array_anytype")
public Map<String, List<Object>> getMapArrayAnytype() {
return mapArrayAnytype;
}
/**
* Sets the <code>mapArrayAnytype</code> property.
*/
public void setMapArrayAnytype(Map<String, List<Object>> mapArrayAnytype) {
this.mapArrayAnytype = mapArrayAnytype;
}
/**
* Sets the <code>mapArrayAnytype</code> property.
*/
public AdditionalPropertiesClass mapArrayAnytype(Map<String, List<Object>> mapArrayAnytype) {
this.mapArrayAnytype = mapArrayAnytype;
return this;
}
/**
* Puts a new item into the <code>mapArrayAnytype</code> map.
*/
public AdditionalPropertiesClass putMapArrayAnytypeItem(String key, List<Object> mapArrayAnytypeItem) {
this.mapArrayAnytype.put(key, mapArrayAnytypeItem);
return this;
}
/**
* Get mapMapString
* @return mapMapString
*/
@JsonProperty("map_map_string")
public Map<String, Map<String, String>> getMapMapString() {
return mapMapString;
}
/**
* Sets the <code>mapMapString</code> property.
*/
public void setMapMapString(Map<String, Map<String, String>> mapMapString) {
this.mapMapString = mapMapString;
}
/**
* Sets the <code>mapMapString</code> property.
*/
public AdditionalPropertiesClass mapMapString(Map<String, Map<String, String>> mapMapString) {
this.mapMapString = mapMapString;
return this;
}
/**
* Puts a new item into the <code>mapMapString</code> map.
*/
public AdditionalPropertiesClass putMapMapStringItem(String key, Map<String, String> mapMapStringItem) {
this.mapMapString.put(key, mapMapStringItem);
return this;
}
/**
* Get mapMapAnytype
* @return mapMapAnytype
*/
@JsonProperty("map_map_anytype")
public Map<String, Map<String, Object>> getMapMapAnytype() {
return mapMapAnytype;
}
/**
* Sets the <code>mapMapAnytype</code> property.
*/
public void setMapMapAnytype(Map<String, Map<String, Object>> mapMapAnytype) {
this.mapMapAnytype = mapMapAnytype;
}
/**
* Sets the <code>mapMapAnytype</code> property.
*/
public AdditionalPropertiesClass mapMapAnytype(Map<String, Map<String, Object>> mapMapAnytype) {
this.mapMapAnytype = mapMapAnytype;
return this;
}
/**
* Puts a new item into the <code>mapMapAnytype</code> map.
*/
public AdditionalPropertiesClass putMapMapAnytypeItem(String key, Map<String, Object> mapMapAnytypeItem) {
this.mapMapAnytype.put(key, mapMapAnytypeItem);
return this;
}
/**
* Get anytype1
* @return anytype1
*/
@JsonProperty("anytype_1")
public Object getAnytype1() {
return anytype1;
}
/**
* Sets the <code>anytype1</code> property.
*/
public void setAnytype1(Object anytype1) {
this.anytype1 = anytype1;
}
/**
* Sets the <code>anytype1</code> property.
*/
public AdditionalPropertiesClass anytype1(Object anytype1) {
this.anytype1 = anytype1;
return this;
}
/**
* Get anytype2
* @return anytype2
*/
@JsonProperty("anytype_2")
public Object getAnytype2() {
return anytype2;
}
/**
* Sets the <code>anytype2</code> property.
*/
public void setAnytype2(Object anytype2) {
this.anytype2 = anytype2;
}
/**
* Sets the <code>anytype2</code> property.
*/
public AdditionalPropertiesClass anytype2(Object anytype2) {
this.anytype2 = anytype2;
return this;
}
/**
* Get anytype3
* @return anytype3
*/
@JsonProperty("anytype_3")
public Object getAnytype3() {
return anytype3;
}
/**
* Sets the <code>anytype3</code> property.
*/
public void setAnytype3(Object anytype3) {
this.anytype3 = anytype3;
}
/**
* Sets the <code>anytype3</code> property.
*/
public AdditionalPropertiesClass anytype3(Object anytype3) {
this.anytype3 = anytype3;
return this;
}
@@ -95,8 +394,17 @@ public class AdditionalPropertiesClass {
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(" mapString: ").append(toIndentedString(mapString)).append("\n");
sb.append(" mapNumber: ").append(toIndentedString(mapNumber)).append("\n");
sb.append(" mapInteger: ").append(toIndentedString(mapInteger)).append("\n");
sb.append(" mapBoolean: ").append(toIndentedString(mapBoolean)).append("\n");
sb.append(" mapArrayInteger: ").append(toIndentedString(mapArrayInteger)).append("\n");
sb.append(" mapArrayAnytype: ").append(toIndentedString(mapArrayAnytype)).append("\n");
sb.append(" mapMapString: ").append(toIndentedString(mapMapString)).append("\n");
sb.append(" mapMapAnytype: ").append(toIndentedString(mapMapAnytype)).append("\n");
sb.append(" anytype1: ").append(toIndentedString(anytype1)).append("\n");
sb.append(" anytype2: ").append(toIndentedString(anytype2)).append("\n");
sb.append(" anytype3: ").append(toIndentedString(anytype3)).append("\n");
sb.append("}");
return sb.toString();
}

View File

@@ -0,0 +1,69 @@
package org.openapitools.model;
import java.util.HashMap;
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 AdditionalPropertiesInteger extends HashMap<String, Integer> {
@ApiModelProperty(value = "")
private String name;
/**
* Get name
* @return name
*/
@JsonProperty("name")
public String getName() {
return name;
}
/**
* Sets the <code>name</code> property.
*/
public void setName(String name) {
this.name = name;
}
/**
* Sets the <code>name</code> property.
*/
public AdditionalPropertiesInteger name(String name) {
this.name = name;
return this;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class AdditionalPropertiesInteger {\n");
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private static String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -0,0 +1,70 @@
package org.openapitools.model;
import java.math.BigDecimal;
import java.util.HashMap;
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 AdditionalPropertiesNumber extends HashMap<String, BigDecimal> {
@ApiModelProperty(value = "")
private String name;
/**
* Get name
* @return name
*/
@JsonProperty("name")
public String getName() {
return name;
}
/**
* Sets the <code>name</code> property.
*/
public void setName(String name) {
this.name = name;
}
/**
* Sets the <code>name</code> property.
*/
public AdditionalPropertiesNumber name(String name) {
this.name = name;
return this;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class AdditionalPropertiesNumber {\n");
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private static String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -0,0 +1,69 @@
package org.openapitools.model;
import java.util.HashMap;
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 AdditionalPropertiesObject extends HashMap<String, Map> {
@ApiModelProperty(value = "")
private String name;
/**
* Get name
* @return name
*/
@JsonProperty("name")
public String getName() {
return name;
}
/**
* Sets the <code>name</code> property.
*/
public void setName(String name) {
this.name = name;
}
/**
* Sets the <code>name</code> property.
*/
public AdditionalPropertiesObject name(String name) {
this.name = name;
return this;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class AdditionalPropertiesObject {\n");
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private static String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -0,0 +1,69 @@
package org.openapitools.model;
import java.util.HashMap;
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 AdditionalPropertiesString extends HashMap<String, String> {
@ApiModelProperty(value = "")
private String name;
/**
* Get name
* @return name
*/
@JsonProperty("name")
public String getName() {
return name;
}
/**
* Sets the <code>name</code> property.
*/
public void setName(String name) {
this.name = name;
}
/**
* Sets the <code>name</code> property.
*/
public AdditionalPropertiesString name(String name) {
this.name = name;
return this;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class AdditionalPropertiesString {\n");
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private static String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -16,6 +16,11 @@ import javax.xml.bind.annotation.XmlEnumValue;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true)
@JsonSubTypes({
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
})
public class Animal {
@ApiModelProperty(required = true, value = "")

View File

@@ -15,6 +15,7 @@ import javax.xml.bind.annotation.XmlEnumValue;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Model for testing model with \"_class\" property
*/

View File

@@ -40,13 +40,13 @@ public enum JustSymbolEnum {
return String.valueOf(value);
}
public static JustSymbolEnum fromValue(String v) {
public static JustSymbolEnum fromValue(String value) {
for (JustSymbolEnum b : JustSymbolEnum.values()) {
if (String.valueOf(b.value).equals(v)) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + v + "'");
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
}
@@ -75,13 +75,13 @@ public enum ArrayEnumEnum {
return String.valueOf(value);
}
public static ArrayEnumEnum fromValue(String v) {
public static ArrayEnumEnum fromValue(String value) {
for (ArrayEnumEnum b : ArrayEnumEnum.values()) {
if (String.valueOf(b.value).equals(v)) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + v + "'");
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
}

View File

@@ -30,13 +30,13 @@ public enum EnumClass {
}
@JsonCreator
public static EnumClass fromValue(String text) {
public static EnumClass fromValue(String value) {
for (EnumClass b : EnumClass.values()) {
if (String.valueOf(b.value).equals(text)) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + text + "'");
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
}

View File

@@ -40,13 +40,13 @@ public enum EnumStringEnum {
return String.valueOf(value);
}
public static EnumStringEnum fromValue(String v) {
public static EnumStringEnum fromValue(String value) {
for (EnumStringEnum b : EnumStringEnum.values()) {
if (String.valueOf(b.value).equals(v)) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + v + "'");
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
}
@@ -76,13 +76,13 @@ public enum EnumStringRequiredEnum {
return String.valueOf(value);
}
public static EnumStringRequiredEnum fromValue(String v) {
public static EnumStringRequiredEnum fromValue(String value) {
for (EnumStringRequiredEnum b : EnumStringRequiredEnum.values()) {
if (String.valueOf(b.value).equals(v)) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + v + "'");
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
}
@@ -111,13 +111,13 @@ public enum EnumIntegerEnum {
return String.valueOf(value);
}
public static EnumIntegerEnum fromValue(String v) {
public static EnumIntegerEnum fromValue(Integer value) {
for (EnumIntegerEnum b : EnumIntegerEnum.values()) {
if (String.valueOf(b.value).equals(v)) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + v + "'");
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
}
@@ -146,13 +146,13 @@ public enum EnumNumberEnum {
return String.valueOf(value);
}
public static EnumNumberEnum fromValue(String v) {
public static EnumNumberEnum fromValue(Double value) {
for (EnumNumberEnum b : EnumNumberEnum.values()) {
if (String.valueOf(b.value).equals(v)) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + v + "'");
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
}

View File

@@ -46,13 +46,13 @@ public enum InnerEnum {
return String.valueOf(value);
}
public static InnerEnum fromValue(String v) {
public static InnerEnum fromValue(String value) {
for (InnerEnum b : InnerEnum.values()) {
if (String.valueOf(b.value).equals(v)) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + v + "'");
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
}

View File

@@ -15,6 +15,7 @@ import javax.xml.bind.annotation.XmlEnumValue;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Model for testing model name starting with number
*/

View File

@@ -15,6 +15,7 @@ import javax.xml.bind.annotation.XmlEnumValue;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Model for testing reserved words
*/

View File

@@ -15,6 +15,7 @@ import javax.xml.bind.annotation.XmlEnumValue;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Model for testing model name same as property name
*/

View File

@@ -53,13 +53,13 @@ public enum StatusEnum {
return String.valueOf(value);
}
public static StatusEnum fromValue(String v) {
public static StatusEnum fromValue(String value) {
for (StatusEnum b : StatusEnum.values()) {
if (String.valueOf(b.value).equals(v)) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + v + "'");
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
}

View File

@@ -30,13 +30,13 @@ public enum OuterEnum {
}
@JsonCreator
public static OuterEnum fromValue(String text) {
public static OuterEnum fromValue(String value) {
for (OuterEnum b : OuterEnum.values()) {
if (String.valueOf(b.value).equals(text)) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + text + "'");
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
}

View File

@@ -60,13 +60,13 @@ public enum StatusEnum {
return String.valueOf(value);
}
public static StatusEnum fromValue(String v) {
public static StatusEnum fromValue(String value) {
for (StatusEnum b : StatusEnum.values()) {
if (String.valueOf(b.value).equals(v)) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + v + "'");
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
}

View File

@@ -35,7 +35,7 @@ public class AnotherFakeApiServiceImpl implements AnotherFakeApi {
{
try {
File cacheFile = new File(System.getProperty("jaxrs.test.server.json",
"/Users/williamcheng/Code/demonfiddler/samples/server/petstore/jaxrs-cxf-test-data/src/main/resources/test-data.json"));
"/home/tduperron/git/zomzog/openapi-generator/samples/server/petstore/jaxrs-cxf-test-data/src/main/resources/test-data.json"));
cache = JsonCache.Factory.instance.get("test-data").load(cacheFile).child("/org.openapitools.api/AnotherFakeApi");
} catch (CacheException e) {
e.printStackTrace();

View File

@@ -43,7 +43,7 @@ public class FakeApiServiceImpl implements FakeApi {
{
try {
File cacheFile = new File(System.getProperty("jaxrs.test.server.json",
"/Users/williamcheng/Code/demonfiddler/samples/server/petstore/jaxrs-cxf-test-data/src/main/resources/test-data.json"));
"/home/tduperron/git/zomzog/openapi-generator/samples/server/petstore/jaxrs-cxf-test-data/src/main/resources/test-data.json"));
cache = JsonCache.Factory.instance.get("test-data").load(cacheFile).child("/org.openapitools.api/FakeApi");
} catch (CacheException e) {
e.printStackTrace();

View File

@@ -35,7 +35,7 @@ public class FakeClassnameTags123ApiServiceImpl implements FakeClassnameTags123A
{
try {
File cacheFile = new File(System.getProperty("jaxrs.test.server.json",
"/Users/williamcheng/Code/demonfiddler/samples/server/petstore/jaxrs-cxf-test-data/src/main/resources/test-data.json"));
"/home/tduperron/git/zomzog/openapi-generator/samples/server/petstore/jaxrs-cxf-test-data/src/main/resources/test-data.json"));
cache = JsonCache.Factory.instance.get("test-data").load(cacheFile).child("/org.openapitools.api/FakeClassnameTags123Api");
} catch (CacheException e) {
e.printStackTrace();

View File

@@ -38,7 +38,7 @@ public class PetApiServiceImpl implements PetApi {
{
try {
File cacheFile = new File(System.getProperty("jaxrs.test.server.json",
"/Users/williamcheng/Code/demonfiddler/samples/server/petstore/jaxrs-cxf-test-data/src/main/resources/test-data.json"));
"/home/tduperron/git/zomzog/openapi-generator/samples/server/petstore/jaxrs-cxf-test-data/src/main/resources/test-data.json"));
cache = JsonCache.Factory.instance.get("test-data").load(cacheFile).child("/org.openapitools.api/PetApi");
} catch (CacheException e) {
e.printStackTrace();

View File

@@ -35,7 +35,7 @@ public class StoreApiServiceImpl implements StoreApi {
{
try {
File cacheFile = new File(System.getProperty("jaxrs.test.server.json",
"/Users/williamcheng/Code/demonfiddler/samples/server/petstore/jaxrs-cxf-test-data/src/main/resources/test-data.json"));
"/home/tduperron/git/zomzog/openapi-generator/samples/server/petstore/jaxrs-cxf-test-data/src/main/resources/test-data.json"));
cache = JsonCache.Factory.instance.get("test-data").load(cacheFile).child("/org.openapitools.api/StoreApi");
} catch (CacheException e) {
e.printStackTrace();

View File

@@ -35,7 +35,7 @@ public class UserApiServiceImpl implements UserApi {
{
try {
File cacheFile = new File(System.getProperty("jaxrs.test.server.json",
"/Users/williamcheng/Code/demonfiddler/samples/server/petstore/jaxrs-cxf-test-data/src/main/resources/test-data.json"));
"/home/tduperron/git/zomzog/openapi-generator/samples/server/petstore/jaxrs-cxf-test-data/src/main/resources/test-data.json"));
cache = JsonCache.Factory.instance.get("test-data").load(cacheFile).child("/org.openapitools.api/UserApi");
} catch (CacheException e) {
e.printStackTrace();

View File

@@ -15,6 +15,11 @@ import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
import com.fasterxml.jackson.annotation.JsonProperty;
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true)
@JsonSubTypes({
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
})
public class Animal {
@ApiModelProperty(required = true, value = "")

View File

@@ -27,6 +27,11 @@ import javax.validation.Valid;
/**
* Animal
*/
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true)
@JsonSubTypes({
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
})
public class Animal implements Serializable {
@JsonProperty("className")

View File

@@ -26,6 +26,11 @@ import javax.validation.Valid;
/**
* Animal
*/
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true)
@JsonSubTypes({
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
})
public class Animal {
@JsonProperty("className")

View File

@@ -10,7 +10,6 @@ import javax.validation.constraints.*;
import io.swagger.annotations.*;
@ApiModel(description="A category for a pet")
public class Category {
private Long id;

View File

@@ -10,7 +10,6 @@ import javax.validation.constraints.*;
import io.swagger.annotations.*;
@ApiModel(description="Describes the result of uploading an image resource")
public class ModelApiResponse {
private Integer code;

View File

@@ -12,7 +12,6 @@ import javax.validation.constraints.*;
import io.swagger.annotations.*;
@ApiModel(description="An order for a pets from the pet store")
public class Order {
private Long id;

View File

@@ -15,7 +15,6 @@ import javax.validation.constraints.*;
import io.swagger.annotations.*;
@ApiModel(description="A pet for sale in the pet store")
public class Pet {
private Long id;

View File

@@ -10,7 +10,6 @@ import javax.validation.constraints.*;
import io.swagger.annotations.*;
@ApiModel(description="A tag for a pet")
public class Tag {
private Long id;

View File

@@ -10,7 +10,6 @@ import javax.validation.constraints.*;
import io.swagger.annotations.*;
@ApiModel(description="A User who is purchasing from the pet store")
public class User {
private Long id;

View File

@@ -10,7 +10,6 @@ import javax.validation.constraints.*;
import io.swagger.annotations.*;
@ApiModel(description="A category for a pet")
public class Category {

View File

@@ -10,7 +10,6 @@ import javax.validation.constraints.*;
import io.swagger.annotations.*;
@ApiModel(description="Describes the result of uploading an image resource")
public class ModelApiResponse {

View File

@@ -12,7 +12,6 @@ import javax.validation.constraints.*;
import io.swagger.annotations.*;
@ApiModel(description="An order for a pets from the pet store")
public class Order {

View File

@@ -15,7 +15,6 @@ import javax.validation.constraints.*;
import io.swagger.annotations.*;
@ApiModel(description="A pet for sale in the pet store")
public class Pet {

View File

@@ -10,7 +10,6 @@ import javax.validation.constraints.*;
import io.swagger.annotations.*;
@ApiModel(description="A tag for a pet")
public class Tag {

View File

@@ -10,7 +10,6 @@ import javax.validation.constraints.*;
import io.swagger.annotations.*;
@ApiModel(description="A User who is purchasing from the pet store")
public class User {

View File

@@ -10,7 +10,6 @@ import javax.validation.constraints.*;
import io.swagger.annotations.*;
@ApiModel(description="A category for a pet")
public class Category {

View File

@@ -10,7 +10,6 @@ import javax.validation.constraints.*;
import io.swagger.annotations.*;
@ApiModel(description="Describes the result of uploading an image resource")
public class ModelApiResponse {

View File

@@ -12,7 +12,6 @@ import javax.validation.constraints.*;
import io.swagger.annotations.*;
@ApiModel(description="An order for a pets from the pet store")
public class Order {

View File

@@ -15,7 +15,6 @@ import javax.validation.constraints.*;
import io.swagger.annotations.*;
@ApiModel(description="A pet for sale in the pet store")
public class Pet {

View File

@@ -10,7 +10,6 @@ import javax.validation.constraints.*;
import io.swagger.annotations.*;
@ApiModel(description="A tag for a pet")
public class Tag {

View File

@@ -10,7 +10,6 @@ import javax.validation.constraints.*;
import io.swagger.annotations.*;
@ApiModel(description="A User who is purchasing from the pet store")
public class User {

View File

@@ -10,7 +10,6 @@ import javax.validation.constraints.*;
import io.swagger.annotations.*;
@ApiModel(description="A category for a pet")
public class Category {

View File

@@ -10,7 +10,6 @@ import javax.validation.constraints.*;
import io.swagger.annotations.*;
@ApiModel(description="Describes the result of uploading an image resource")
public class ModelApiResponse {

View File

@@ -12,7 +12,6 @@ import javax.validation.constraints.*;
import io.swagger.annotations.*;
@ApiModel(description="An order for a pets from the pet store")
public class Order {

View File

@@ -15,7 +15,6 @@ import javax.validation.constraints.*;
import io.swagger.annotations.*;
@ApiModel(description="A pet for sale in the pet store")
public class Pet {

View File

@@ -10,7 +10,6 @@ import javax.validation.constraints.*;
import io.swagger.annotations.*;
@ApiModel(description="A tag for a pet")
public class Tag {

View File

@@ -10,7 +10,6 @@ import javax.validation.constraints.*;
import io.swagger.annotations.*;
@ApiModel(description="A User who is purchasing from the pet store")
public class User {

View File

@@ -10,7 +10,6 @@ import javax.validation.constraints.*;
import io.swagger.annotations.*;
@ApiModel(description="A category for a pet")
public class Category {
private Long id;

View File

@@ -10,7 +10,6 @@ import javax.validation.constraints.*;
import io.swagger.annotations.*;
@ApiModel(description="Describes the result of uploading an image resource")
public class ModelApiResponse {
private Integer code;

View File

@@ -12,7 +12,6 @@ import javax.validation.constraints.*;
import io.swagger.annotations.*;
@ApiModel(description="An order for a pets from the pet store")
public class Order {
private Long id;

View File

@@ -15,7 +15,6 @@ import javax.validation.constraints.*;
import io.swagger.annotations.*;
@ApiModel(description="A pet for sale in the pet store")
public class Pet {
private Long id;

View File

@@ -10,7 +10,6 @@ import javax.validation.constraints.*;
import io.swagger.annotations.*;
@ApiModel(description="A tag for a pet")
public class Tag {
private Long id;

View File

@@ -10,7 +10,6 @@ import javax.validation.constraints.*;
import io.swagger.annotations.*;
@ApiModel(description="A User who is purchasing from the pet store")
public class User {
private Long id;

View File

@@ -14,6 +14,11 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true)
@JsonSubTypes({
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
})
public class Animal implements Serializable {

View File

@@ -12,6 +12,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
/**
* Model for testing model with \&quot;_class\&quot; property
**/

View File

@@ -12,6 +12,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
/**
* Model for testing model name starting with number
**/

View File

@@ -12,6 +12,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
/**
* Model for testing reserved words
**/

View File

@@ -12,6 +12,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
/**
* Model for testing model name same as property name
**/

View File

@@ -14,6 +14,11 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true)
@JsonSubTypes({
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
})
public class Animal implements Serializable {

View File

@@ -12,6 +12,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
/**
* Model for testing model with \&quot;_class\&quot; property
**/

View File

@@ -12,6 +12,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
/**
* Model for testing model name starting with number
**/

View File

@@ -12,6 +12,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
/**
* Model for testing reserved words
**/

View File

@@ -12,6 +12,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
/**
* Model for testing model name same as property name
**/

View File

@@ -26,6 +26,11 @@ import javax.validation.Valid;
/**
* Animal
*/
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true)
@JsonSubTypes({
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
})
public class Animal {
@JsonProperty("className")

View File

@@ -26,6 +26,11 @@ import javax.validation.Valid;
/**
* Animal
*/
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true)
@JsonSubTypes({
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
})
public class Animal {
@JsonProperty("className")

Some files were not shown because too many files have changed in this diff Show More