forked from loafle/openapi-generator-original
Support for discriminator.mapping (#536)
This commit is contained in:
committed by
Jérémie Bresson
parent
478d6ced4e
commit
0a52f56ba4
@@ -0,0 +1,88 @@
|
|||||||
|
package org.openapitools.codegen;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class CodegenDiscriminator {
|
||||||
|
private String propertyName;
|
||||||
|
private Map<String, String> mapping;
|
||||||
|
private Set<MappedModel> mappedModels = new LinkedHashSet<>();
|
||||||
|
|
||||||
|
public String getPropertyName() {
|
||||||
|
return propertyName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPropertyName(String propertyName) {
|
||||||
|
this.propertyName = propertyName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, String> getMapping() {
|
||||||
|
return mapping;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMapping(Map<String, String> mapping) {
|
||||||
|
this.mapping = mapping;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Set<MappedModel> getMappedModels() {
|
||||||
|
return mappedModels;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMappedModels(Set<MappedModel> mappedModels) {
|
||||||
|
this.mappedModels = mappedModels;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class MappedModel {
|
||||||
|
private String mappingName;
|
||||||
|
private String modelName;
|
||||||
|
|
||||||
|
public MappedModel(String mappingName, String modelName) {
|
||||||
|
this.mappingName = mappingName;
|
||||||
|
this.modelName = modelName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMappingName() {
|
||||||
|
return mappingName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMappingName(String mappingName) {
|
||||||
|
this.mappingName = mappingName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getModelName() {
|
||||||
|
return modelName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setModelName(String modelName) {
|
||||||
|
this.modelName = modelName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (o == null || getClass() != o.getClass()) return false;
|
||||||
|
MappedModel that = (MappedModel) o;
|
||||||
|
return Objects.equals(mappingName, that.mappingName) &&
|
||||||
|
Objects.equals(modelName, that.modelName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(mappingName, modelName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (o == null || getClass() != o.getClass()) return false;
|
||||||
|
CodegenDiscriminator that = (CodegenDiscriminator) o;
|
||||||
|
return Objects.equals(propertyName, that.propertyName) &&
|
||||||
|
Objects.equals(mapping, that.mapping) &&
|
||||||
|
Objects.equals(mappedModels, that.mappedModels);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(propertyName, mapping, mappedModels);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -18,15 +18,14 @@
|
|||||||
package org.openapitools.codegen;
|
package org.openapitools.codegen;
|
||||||
|
|
||||||
import io.swagger.v3.oas.models.ExternalDocumentation;
|
import io.swagger.v3.oas.models.ExternalDocumentation;
|
||||||
import io.swagger.v3.oas.models.media.Discriminator;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
public class CodegenModel {
|
public class CodegenModel {
|
||||||
public String parent, parentSchema;
|
public String parent, parentSchema;
|
||||||
@@ -40,7 +39,7 @@ public class CodegenModel {
|
|||||||
public String name, classname, title, description, classVarName, modelJson, dataType, xmlPrefix, xmlNamespace, xmlName;
|
public String name, classname, title, description, classVarName, modelJson, dataType, xmlPrefix, xmlNamespace, xmlName;
|
||||||
public String classFilename; // store the class file name, mainly used for import
|
public String classFilename; // store the class file name, mainly used for import
|
||||||
public String unescapedDescription;
|
public String unescapedDescription;
|
||||||
public Discriminator discriminator;
|
public CodegenDiscriminator discriminator;
|
||||||
public String defaultValue;
|
public String defaultValue;
|
||||||
public String arrayModelType;
|
public String arrayModelType;
|
||||||
public boolean isAlias; // Is this effectively an alias of another simple type
|
public boolean isAlias; // Is this effectively an alias of another simple type
|
||||||
@@ -349,7 +348,7 @@ public class CodegenModel {
|
|||||||
this.unescapedDescription = unescapedDescription;
|
this.unescapedDescription = unescapedDescription;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Discriminator getDiscriminator() {
|
public CodegenDiscriminator getDiscriminator() {
|
||||||
return discriminator;
|
return discriminator;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -357,7 +356,7 @@ public class CodegenModel {
|
|||||||
return discriminator == null ? null : discriminator.getPropertyName();
|
return discriminator == null ? null : discriminator.getPropertyName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDiscriminator(Discriminator discriminator) {
|
public void setDiscriminator(CodegenDiscriminator discriminator) {
|
||||||
this.discriminator = discriminator;
|
this.discriminator = discriminator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,17 +18,15 @@
|
|||||||
package org.openapitools.codegen;
|
package org.openapitools.codegen;
|
||||||
|
|
||||||
import io.swagger.v3.oas.models.ExternalDocumentation;
|
import io.swagger.v3.oas.models.ExternalDocumentation;
|
||||||
import io.swagger.v3.oas.models.media.Discriminator;
|
|
||||||
import io.swagger.v3.oas.models.parameters.RequestBody;
|
|
||||||
import io.swagger.v3.oas.models.tags.Tag;
|
import io.swagger.v3.oas.models.tags.Tag;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
public class CodegenOperation {
|
public class CodegenOperation {
|
||||||
public final List<CodegenProperty> responseHeaders = new ArrayList<CodegenProperty>();
|
public final List<CodegenProperty> responseHeaders = new ArrayList<CodegenProperty>();
|
||||||
@@ -40,7 +38,7 @@ public class CodegenOperation {
|
|||||||
isRestful, isDeprecated;
|
isRestful, isDeprecated;
|
||||||
public String path, operationId, returnType, httpMethod, returnBaseType,
|
public String path, operationId, returnType, httpMethod, returnBaseType,
|
||||||
returnContainer, summary, unescapedNotes, notes, baseName, defaultResponse;
|
returnContainer, summary, unescapedNotes, notes, baseName, defaultResponse;
|
||||||
public Discriminator discriminator;
|
public CodegenDiscriminator discriminator;
|
||||||
public List<Map<String, String>> consumes, produces, prioritizedContentTypes;
|
public List<Map<String, String>> consumes, produces, prioritizedContentTypes;
|
||||||
public CodegenParameter bodyParam;
|
public CodegenParameter bodyParam;
|
||||||
public List<CodegenParameter> allParams = new ArrayList<CodegenParameter>();
|
public List<CodegenParameter> allParams = new ArrayList<CodegenParameter>();
|
||||||
|
|||||||
@@ -26,7 +26,12 @@ import io.swagger.v3.oas.models.OpenAPI;
|
|||||||
import io.swagger.v3.oas.models.Operation;
|
import io.swagger.v3.oas.models.Operation;
|
||||||
import io.swagger.v3.oas.models.examples.Example;
|
import io.swagger.v3.oas.models.examples.Example;
|
||||||
import io.swagger.v3.oas.models.headers.Header;
|
import io.swagger.v3.oas.models.headers.Header;
|
||||||
import io.swagger.v3.oas.models.media.*;
|
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||||
|
import io.swagger.v3.oas.models.media.ComposedSchema;
|
||||||
|
import io.swagger.v3.oas.models.media.Content;
|
||||||
|
import io.swagger.v3.oas.models.media.MediaType;
|
||||||
|
import io.swagger.v3.oas.models.media.Schema;
|
||||||
|
import io.swagger.v3.oas.models.media.StringSchema;
|
||||||
import io.swagger.v3.oas.models.parameters.CookieParameter;
|
import io.swagger.v3.oas.models.parameters.CookieParameter;
|
||||||
import io.swagger.v3.oas.models.parameters.HeaderParameter;
|
import io.swagger.v3.oas.models.parameters.HeaderParameter;
|
||||||
import io.swagger.v3.oas.models.parameters.Parameter;
|
import io.swagger.v3.oas.models.parameters.Parameter;
|
||||||
@@ -43,6 +48,7 @@ import io.swagger.v3.parser.util.SchemaTypeUtil;
|
|||||||
import org.apache.commons.lang3.ObjectUtils;
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
import org.apache.commons.lang3.StringEscapeUtils;
|
import org.apache.commons.lang3.StringEscapeUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.openapitools.codegen.CodegenDiscriminator.MappedModel;
|
||||||
import org.openapitools.codegen.examples.ExampleGenerator;
|
import org.openapitools.codegen.examples.ExampleGenerator;
|
||||||
import org.openapitools.codegen.serializer.SerializerUtils;
|
import org.openapitools.codegen.serializer.SerializerUtils;
|
||||||
import org.openapitools.codegen.utils.ModelUtils;
|
import org.openapitools.codegen.utils.ModelUtils;
|
||||||
@@ -66,6 +72,7 @@ import java.util.TreeSet;
|
|||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
public class DefaultCodegen implements CodegenConfig {
|
public class DefaultCodegen implements CodegenConfig {
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(DefaultCodegen.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(DefaultCodegen.class);
|
||||||
@@ -1469,6 +1476,10 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
|
|
||||||
// unalias schema
|
// unalias schema
|
||||||
schema = ModelUtils.unaliasSchema(allDefinitions, schema);
|
schema = ModelUtils.unaliasSchema(allDefinitions, schema);
|
||||||
|
if (schema == null) {
|
||||||
|
LOGGER.warn("Schema {} not found", name);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
CodegenModel m = CodegenModelFactory.newInstance(CodegenModelType.MODEL);
|
CodegenModel m = CodegenModelFactory.newInstance(CodegenModelType.MODEL);
|
||||||
|
|
||||||
@@ -1489,7 +1500,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
m.getVendorExtensions().putAll(schema.getExtensions());
|
m.getVendorExtensions().putAll(schema.getExtensions());
|
||||||
}
|
}
|
||||||
m.isAlias = typeAliases.containsKey(name);
|
m.isAlias = typeAliases.containsKey(name);
|
||||||
m.discriminator = schema.getDiscriminator();
|
m.discriminator = createDiscriminator(name, schema, allDefinitions);
|
||||||
|
|
||||||
if (schema.getXml() != null) {
|
if (schema.getXml() != null) {
|
||||||
m.xmlPrefix = schema.getXml().getPrefix();
|
m.xmlPrefix = schema.getXml().getPrefix();
|
||||||
@@ -1516,7 +1527,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
int modelImplCnt = 0; // only one inline object allowed in a ComposedModel
|
int modelImplCnt = 0; // only one inline object allowed in a ComposedModel
|
||||||
for (Schema innerModel : composed.getAllOf()) {
|
for (Schema innerModel : composed.getAllOf()) {
|
||||||
if (m.discriminator == null) {
|
if (m.discriminator == null) {
|
||||||
m.discriminator = schema.getDiscriminator();
|
m.discriminator = createDiscriminator(name, schema, allDefinitions);
|
||||||
}
|
}
|
||||||
if (innerModel.getXml() != null) {
|
if (innerModel.getXml() != null) {
|
||||||
m.xmlPrefix = innerModel.getXml().getPrefix();
|
m.xmlPrefix = innerModel.getXml().getPrefix();
|
||||||
@@ -1631,6 +1642,34 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private CodegenDiscriminator createDiscriminator(String schemaName, Schema schema, Map<String, Schema> allDefinitions) {
|
||||||
|
if(schema.getDiscriminator() == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
CodegenDiscriminator discriminator = new CodegenDiscriminator();
|
||||||
|
discriminator.setPropertyName(schema.getDiscriminator().getPropertyName());
|
||||||
|
discriminator.setMapping(schema.getDiscriminator().getMapping());
|
||||||
|
if(schema.getDiscriminator().getMapping() != null && !schema.getDiscriminator().getMapping().isEmpty()) {
|
||||||
|
for (Entry<String, String> e : schema.getDiscriminator().getMapping().entrySet()) {
|
||||||
|
String name = ModelUtils.getSimpleRef(e.getValue());
|
||||||
|
discriminator.getMappedModels().add(new MappedModel(e.getKey(), name));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
allDefinitions.forEach((childName, child) -> {
|
||||||
|
if (child instanceof ComposedSchema && ((ComposedSchema) child).getAllOf() != null) {
|
||||||
|
Set<String> parentSchemas = ((ComposedSchema) child).getAllOf().stream()
|
||||||
|
.filter(s -> s.get$ref() != null)
|
||||||
|
.map(s -> ModelUtils.getSimpleRef(s.get$ref()))
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
if (parentSchemas.contains(schemaName)) {
|
||||||
|
discriminator.getMappedModels().add(new MappedModel(childName, childName));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return discriminator;
|
||||||
|
}
|
||||||
|
|
||||||
protected void addAdditionPropertiesToCodeGenModel(CodegenModel codegenModel, Schema schema) {
|
protected void addAdditionPropertiesToCodeGenModel(CodegenModel codegenModel, Schema schema) {
|
||||||
addParentContainer(codegenModel, codegenModel.name, schema);
|
addParentContainer(codegenModel, codegenModel.name, schema);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -523,25 +523,6 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
|
||||||
public Map<String, Object> postProcessAllModels(Map<String, Object> objs) {
|
|
||||||
Map<String, Object> allProcessedModels = super.postProcessAllModels(objs);
|
|
||||||
if (!additionalProperties.containsKey("gsonFactoryMethod")) {
|
|
||||||
List<Object> allModels = new ArrayList<Object>();
|
|
||||||
for (String name : allProcessedModels.keySet()) {
|
|
||||||
Map<String, Object> models = (Map<String, Object>) allProcessedModels.get(name);
|
|
||||||
try {
|
|
||||||
allModels.add(((List<Object>) models.get("models")).get(0));
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
additionalProperties.put("parent", modelInheritanceSupportInGson(allModels));
|
|
||||||
}
|
|
||||||
return allProcessedModels;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> postProcessModelsEnum(Map<String, Object> objs) {
|
public Map<String, Object> postProcessModelsEnum(Map<String, Object> objs) {
|
||||||
objs = super.postProcessModelsEnum(objs);
|
objs = super.postProcessModelsEnum(objs);
|
||||||
@@ -564,34 +545,6 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
|||||||
return objs;
|
return objs;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<Map<String, Object>> modelInheritanceSupportInGson(List<?> allModels) {
|
|
||||||
Map<CodegenModel, List<CodegenModel>> byParent = new LinkedHashMap<>();
|
|
||||||
for (Object model : allModels) {
|
|
||||||
Map entry = (Map) model;
|
|
||||||
CodegenModel parent = ((CodegenModel)entry.get("model")).parentModel;
|
|
||||||
if(null!= parent) {
|
|
||||||
byParent.computeIfAbsent(parent, k -> new LinkedList<>()).add((CodegenModel)entry.get("model"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
List<Map<String, Object>> parentsList = new ArrayList<>();
|
|
||||||
for (CodegenModel parentModel : byParent.keySet()) {
|
|
||||||
List<Map<String, Object>> childrenList = new ArrayList<>();
|
|
||||||
Map<String, Object> parent = new HashMap<>();
|
|
||||||
parent.put("classname", parentModel.classname);
|
|
||||||
List<CodegenModel> childrenModels = byParent.get(parentModel);
|
|
||||||
for (CodegenModel model : childrenModels) {
|
|
||||||
Map<String, Object> child = new HashMap<>();
|
|
||||||
child.put("name", model.name);
|
|
||||||
child.put("classname", model.classname);
|
|
||||||
childrenList.add(child);
|
|
||||||
}
|
|
||||||
parent.put("children", childrenList);
|
|
||||||
parent.put("discriminator", parentModel.discriminator);
|
|
||||||
parentsList.add(parent);
|
|
||||||
}
|
|
||||||
return parentsList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUseRxJava(boolean useRxJava) {
|
public void setUseRxJava(boolean useRxJava) {
|
||||||
this.useRxJava = useRxJava;
|
this.useRxJava = useRxJava;
|
||||||
doNotUseRx = false;
|
doNotUseRx = false;
|
||||||
|
|||||||
@@ -60,21 +60,20 @@ public class JSON {
|
|||||||
|
|
||||||
public static GsonBuilder createGson() {
|
public static GsonBuilder createGson() {
|
||||||
GsonFireBuilder fireBuilder = new GsonFireBuilder()
|
GsonFireBuilder fireBuilder = new GsonFireBuilder()
|
||||||
{{#parent}}
|
{{#models}}{{#model}}{{#discriminator}} .registerTypeSelector({{classname}}.class, new TypeSelector() {
|
||||||
.registerTypeSelector({{classname}}.class, new TypeSelector() {
|
|
||||||
@Override
|
@Override
|
||||||
public Class getClassForElement(JsonElement readElement) {
|
public Class getClassForElement(JsonElement readElement) {
|
||||||
Map classByDiscriminatorValue = new HashMap();
|
Map classByDiscriminatorValue = new HashMap();
|
||||||
{{#children}}
|
{{#mappedModels}}
|
||||||
classByDiscriminatorValue.put("{{name}}".toUpperCase(), {{classname}}.class);
|
classByDiscriminatorValue.put("{{mappingName}}".toUpperCase(), {{modelName}}.class);
|
||||||
{{/children}}
|
{{/mappedModels}}
|
||||||
classByDiscriminatorValue.put("{{classname}}".toUpperCase(), {{classname}}.class);
|
classByDiscriminatorValue.put("{{classname}}".toUpperCase(), {{classname}}.class);
|
||||||
return getClassByDiscriminator(
|
return getClassByDiscriminator(
|
||||||
classByDiscriminatorValue,
|
classByDiscriminatorValue,
|
||||||
getDiscriminatorValue(readElement, "{{{discriminatorName}}}"));
|
getDiscriminatorValue(readElement, "{{{propertyName}}}"));
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
{{/parent}}
|
{{/discriminator}}{{/model}}{{/models}}
|
||||||
;
|
;
|
||||||
GsonBuilder builder = fireBuilder.createGsonBuilder();
|
GsonBuilder builder = fireBuilder.createGsonBuilder();
|
||||||
{{#disableHtmlEscaping}}
|
{{#disableHtmlEscaping}}
|
||||||
|
|||||||
@@ -57,21 +57,20 @@ public class JSON {
|
|||||||
|
|
||||||
public static GsonBuilder createGson() {
|
public static GsonBuilder createGson() {
|
||||||
GsonFireBuilder fireBuilder = new GsonFireBuilder()
|
GsonFireBuilder fireBuilder = new GsonFireBuilder()
|
||||||
{{#parent}}
|
{{#models}}{{#model}}{{#discriminator}} .registerTypeSelector({{classname}}.class, new TypeSelector() {
|
||||||
.registerTypeSelector({{classname}}.class, new TypeSelector() {
|
|
||||||
@Override
|
@Override
|
||||||
public Class getClassForElement(JsonElement readElement) {
|
public Class getClassForElement(JsonElement readElement) {
|
||||||
Map classByDiscriminatorValue = new HashMap();
|
Map classByDiscriminatorValue = new HashMap();
|
||||||
{{#children}}
|
{{#mappedModels}}
|
||||||
classByDiscriminatorValue.put("{{name}}".toUpperCase(), {{classname}}.class);
|
classByDiscriminatorValue.put("{{mappingName}}".toUpperCase(), {{modelName}}.class);
|
||||||
{{/children}}
|
{{/mappedModels}}
|
||||||
classByDiscriminatorValue.put("{{classname}}".toUpperCase(), {{classname}}.class);
|
classByDiscriminatorValue.put("{{classname}}".toUpperCase(), {{classname}}.class);
|
||||||
return getClassByDiscriminator(
|
return getClassByDiscriminator(
|
||||||
classByDiscriminatorValue,
|
classByDiscriminatorValue,
|
||||||
getDiscriminatorValue(readElement, "{{{discriminatorName}}}"));
|
getDiscriminatorValue(readElement, "{{{propertyName}}}"));
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
{{/parent}}
|
{{/discriminator}}{{/model}}{{/models}}
|
||||||
;
|
;
|
||||||
return fireBuilder.createGsonBuilder();
|
return fireBuilder.createGsonBuilder();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
{{#jackson}}
|
{{#jackson}}
|
||||||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "{{{discriminatorName}}}", visible = true )
|
|
||||||
|
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "{{{discriminatorName}}}", visible = true)
|
||||||
@JsonSubTypes({
|
@JsonSubTypes({
|
||||||
{{#children}}
|
{{#discriminator.mappedModels}}
|
||||||
@JsonSubTypes.Type(value = {{classname}}.class, name = "{{^vendorExtensions.x-discriminator-value}}{{name}}{{/vendorExtensions.x-discriminator-value}}{{#vendorExtensions.x-discriminator-value}}{{{vendorExtensions.x-discriminator-value}}}{{/vendorExtensions.x-discriminator-value}}"),
|
@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}}"),
|
||||||
{{/children}}
|
{{/discriminator.mappedModels}}
|
||||||
}){{/jackson}}
|
}){{/jackson}}
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
{{#jackson}}
|
{{#jackson}}
|
||||||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "{{{discriminatorName}}}", visible = true )
|
|
||||||
|
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "{{{discriminatorName}}}", visible = true)
|
||||||
@JsonSubTypes({
|
@JsonSubTypes({
|
||||||
{{#children}}
|
{{#discriminator.mappedModels}}
|
||||||
@JsonSubTypes.Type(value = {{classname}}.class, name = "{{^vendorExtensions.x-discriminator-value}}{{name}}{{/vendorExtensions.x-discriminator-value}}{{#vendorExtensions.x-discriminator-value}}{{{vendorExtensions.x-discriminator-value}}}{{/vendorExtensions.x-discriminator-value}}"),
|
@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}}"),
|
||||||
{{/children}}
|
{{/discriminator.mappedModels}}
|
||||||
}){{/jackson}}
|
}){{/jackson}}
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
{{#jackson}}
|
{{#jackson}}
|
||||||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "{{{discriminatorName}}}", visible = true )
|
|
||||||
|
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "{{{discriminatorName}}}", visible = true)
|
||||||
@JsonSubTypes({
|
@JsonSubTypes({
|
||||||
{{#children}}
|
{{#discriminator.mappedModels}}
|
||||||
@JsonSubTypes.Type(value = {{classname}}.class, name = "{{^vendorExtensions.x-discriminator-value}}{{name}}{{/vendorExtensions.x-discriminator-value}}{{#vendorExtensions.x-discriminator-value}}{{{vendorExtensions.x-discriminator-value}}}{{/vendorExtensions.x-discriminator-value}}"),
|
@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}}"),
|
||||||
{{/children}}
|
{{/discriminator.mappedModels}}
|
||||||
}){{/jackson}}
|
}){{/jackson}}
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
{{#jackson}}
|
{{#jackson}}
|
||||||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "{{{discriminatorName}}}", visible = true )
|
|
||||||
|
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "{{{discriminatorName}}}", visible = true)
|
||||||
@JsonSubTypes({
|
@JsonSubTypes({
|
||||||
{{#children}}
|
{{#discriminator.mappedModels}}
|
||||||
@JsonSubTypes.Type(value = {{classname}}.class, name = "{{^vendorExtensions.x-discriminator-value}}{{name}}{{/vendorExtensions.x-discriminator-value}}{{#vendorExtensions.x-discriminator-value}}{{{vendorExtensions.x-discriminator-value}}}{{/vendorExtensions.x-discriminator-value}}"),
|
@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}}"),
|
||||||
{{/children}}
|
{{/discriminator.mappedModels}}
|
||||||
}){{/jackson}}
|
}){{/jackson}}
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
{{#jackson}}
|
{{#jackson}}
|
||||||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "{{{discriminatorName}}}", visible = true )
|
|
||||||
|
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "{{{discriminatorName}}}", visible = true)
|
||||||
@JsonSubTypes({
|
@JsonSubTypes({
|
||||||
{{#children}}
|
{{#discriminator.mappedModels}}
|
||||||
@JsonSubTypes.Type(value = {{classname}}.class, name = "{{^vendorExtensions.x-discriminator-value}}{{name}}{{/vendorExtensions.x-discriminator-value}}{{#vendorExtensions.x-discriminator-value}}{{{vendorExtensions.x-discriminator-value}}}{{/vendorExtensions.x-discriminator-value}}"),
|
@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}}"),
|
||||||
{{/children}}
|
{{/discriminator.mappedModels}}
|
||||||
}){{/jackson}}
|
}){{/jackson}}
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
{{#jackson}}
|
{{#jackson}}
|
||||||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "{{{discriminatorName}}}", visible = true )
|
|
||||||
|
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "{{{discriminatorName}}}", visible = true)
|
||||||
@JsonSubTypes({
|
@JsonSubTypes({
|
||||||
{{#children}}
|
{{#discriminator.mappedModels}}
|
||||||
@JsonSubTypes.Type(value = {{classname}}.class, name = "{{^vendorExtensions.x-discriminator-value}}{{name}}{{/vendorExtensions.x-discriminator-value}}{{#vendorExtensions.x-discriminator-value}}{{{vendorExtensions.x-discriminator-value}}}{{/vendorExtensions.x-discriminator-value}}"),
|
@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}}"),
|
||||||
{{/children}}
|
{{/discriminator.mappedModels}}
|
||||||
}){{/jackson}}
|
}){{/jackson}}
|
||||||
|
|||||||
@@ -356,6 +356,47 @@ public class DefaultCodegenTest {
|
|||||||
Assert.assertEquals(codegenParameter2.example, "An example4 value");
|
Assert.assertEquals(codegenParameter2.example, "An example4 value");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDiscriminator() {
|
||||||
|
final OpenAPI openAPI = new OpenAPIParser().readLocation("src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml", null, new ParseOptions()).getOpenAPI();
|
||||||
|
DefaultCodegen codegen = new DefaultCodegen();
|
||||||
|
|
||||||
|
Schema animal = openAPI.getComponents().getSchemas().get("Animal");
|
||||||
|
CodegenModel animalModel = codegen.fromModel("Animal", animal, openAPI.getComponents().getSchemas());
|
||||||
|
CodegenDiscriminator discriminator = animalModel.getDiscriminator();
|
||||||
|
CodegenDiscriminator test = new CodegenDiscriminator();
|
||||||
|
test.setPropertyName("className");
|
||||||
|
test.getMappedModels().add(new CodegenDiscriminator.MappedModel("Dog", "Dog"));
|
||||||
|
test.getMappedModels().add(new CodegenDiscriminator.MappedModel("Cat", "Cat"));
|
||||||
|
Assert.assertEquals(discriminator, test);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDiscriminatorWithCustomMapping() {
|
||||||
|
final OpenAPI openAPI = new OpenAPIParser().readLocation("src/test/resources/3_0/allOf.yaml", null, new ParseOptions()).getOpenAPI();
|
||||||
|
DefaultCodegen codegen = new DefaultCodegen();
|
||||||
|
|
||||||
|
String path = "/person/display/{personId}";
|
||||||
|
Operation operation = openAPI.getPaths().get(path).getGet();
|
||||||
|
CodegenOperation codegenOperation = codegen.fromOperation(path, "GET", operation, openAPI.getComponents().getSchemas());
|
||||||
|
verifyPersonDiscriminator(codegenOperation.discriminator);
|
||||||
|
|
||||||
|
Schema person = openAPI.getComponents().getSchemas().get("Person");
|
||||||
|
CodegenModel personModel = codegen.fromModel("Person", person, openAPI.getComponents().getSchemas());
|
||||||
|
verifyPersonDiscriminator(personModel.discriminator);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void verifyPersonDiscriminator(CodegenDiscriminator discriminator) {
|
||||||
|
CodegenDiscriminator test = new CodegenDiscriminator();
|
||||||
|
test.setPropertyName("$_type");
|
||||||
|
test.setMapping(new HashMap<>());
|
||||||
|
test.getMapping().put("a", "#/components/schemas/Adult");
|
||||||
|
test.getMapping().put("c", "#/components/schemas/Child");
|
||||||
|
test.getMappedModels().add(new CodegenDiscriminator.MappedModel("a", "Adult"));
|
||||||
|
test.getMappedModels().add(new CodegenDiscriminator.MappedModel("c", "Child"));
|
||||||
|
Assert.assertEquals(discriminator, test);
|
||||||
|
}
|
||||||
|
|
||||||
private CodegenProperty codegenPropertyWithArrayOfIntegerValues() {
|
private CodegenProperty codegenPropertyWithArrayOfIntegerValues() {
|
||||||
CodegenProperty array = new CodegenProperty();
|
CodegenProperty array = new CodegenProperty();
|
||||||
final CodegenProperty items = new CodegenProperty();
|
final CodegenProperty items = new CodegenProperty();
|
||||||
|
|||||||
@@ -64,111 +64,6 @@ import java.util.stream.Collectors;
|
|||||||
|
|
||||||
public class JavaClientCodegenTest {
|
public class JavaClientCodegenTest {
|
||||||
|
|
||||||
@Test
|
|
||||||
public void modelInheritanceSupportInGson() throws Exception {
|
|
||||||
List<Map<String, Object>> allModels = new ArrayList<>();
|
|
||||||
|
|
||||||
CodegenModel parent1 = CodegenModelFactory.newInstance(CodegenModelType.MODEL);
|
|
||||||
parent1.setName("parent1");
|
|
||||||
parent1.setClassname("test.Parent1");
|
|
||||||
|
|
||||||
Map<String, Object> modelMap = new HashMap<>();
|
|
||||||
modelMap.put("model", parent1);
|
|
||||||
allModels.add(modelMap);
|
|
||||||
|
|
||||||
CodegenModel parent2 = CodegenModelFactory.newInstance(CodegenModelType.MODEL);
|
|
||||||
parent2.setName("parent2");
|
|
||||||
parent2.setClassname("test.Parent2");
|
|
||||||
|
|
||||||
modelMap = new HashMap<>();
|
|
||||||
modelMap.put("model", parent2);
|
|
||||||
allModels.add(modelMap);
|
|
||||||
|
|
||||||
CodegenModel model1 = CodegenModelFactory.newInstance(CodegenModelType.MODEL);
|
|
||||||
model1.setName("model1");
|
|
||||||
model1.setClassname("test.Model1");
|
|
||||||
model1.setParentModel(parent1);
|
|
||||||
|
|
||||||
modelMap = new HashMap<>();
|
|
||||||
modelMap.put("model", model1);
|
|
||||||
allModels.add(modelMap);
|
|
||||||
|
|
||||||
CodegenModel model2 = CodegenModelFactory.newInstance(CodegenModelType.MODEL);
|
|
||||||
model2.setName("model2");
|
|
||||||
model2.setClassname("test.Model2");
|
|
||||||
model2.setParentModel(parent1);
|
|
||||||
|
|
||||||
modelMap = new HashMap<>();
|
|
||||||
modelMap.put("model", model2);
|
|
||||||
allModels.add(modelMap);
|
|
||||||
|
|
||||||
CodegenModel model3 = CodegenModelFactory.newInstance(CodegenModelType.MODEL);
|
|
||||||
model3.setName("model3");
|
|
||||||
model3.setClassname("test.Model3");
|
|
||||||
model3.setParentModel(parent1);
|
|
||||||
|
|
||||||
modelMap = new HashMap<>();
|
|
||||||
modelMap.put("model", model3);
|
|
||||||
allModels.add(modelMap);
|
|
||||||
|
|
||||||
CodegenModel model4 = CodegenModelFactory.newInstance(CodegenModelType.MODEL);
|
|
||||||
model4.setName("model4");
|
|
||||||
model4.setClassname("test.Model4");
|
|
||||||
model4.setParentModel(parent2);
|
|
||||||
|
|
||||||
modelMap = new HashMap<>();
|
|
||||||
modelMap.put("model", model4);
|
|
||||||
allModels.add(modelMap);
|
|
||||||
|
|
||||||
CodegenModel model5 = CodegenModelFactory.newInstance(CodegenModelType.MODEL);
|
|
||||||
model5.setName("model5");
|
|
||||||
model5.setClassname("test.Model5");
|
|
||||||
model5.setParentModel(parent2);
|
|
||||||
|
|
||||||
modelMap = new HashMap<>();
|
|
||||||
modelMap.put("model", model5);
|
|
||||||
allModels.add(modelMap);
|
|
||||||
|
|
||||||
List<Map<String, Object>> parentsList = JavaClientCodegen.modelInheritanceSupportInGson(allModels);
|
|
||||||
|
|
||||||
Assert.assertNotNull(parentsList);
|
|
||||||
Assert.assertEquals(parentsList.size(), 2);
|
|
||||||
|
|
||||||
Map<String, Object> parent = parentsList.get(0);
|
|
||||||
Assert.assertEquals(parent.get("classname"), "test.Parent1");
|
|
||||||
|
|
||||||
List<CodegenModel> children = (List<CodegenModel>) parent.get("children");
|
|
||||||
Assert.assertNotNull(children);
|
|
||||||
Assert.assertEquals(children.size(), 3);
|
|
||||||
|
|
||||||
Map<String, Object> models = (Map<String, Object>) children.get(0);
|
|
||||||
Assert.assertEquals(models.get("name"), "model1");
|
|
||||||
Assert.assertEquals(models.get("classname"), "test.Model1");
|
|
||||||
|
|
||||||
models = (Map<String, Object>) children.get(1);
|
|
||||||
Assert.assertEquals(models.get("name"), "model2");
|
|
||||||
Assert.assertEquals(models.get("classname"), "test.Model2");
|
|
||||||
|
|
||||||
models = (Map<String, Object>) children.get(2);
|
|
||||||
Assert.assertEquals(models.get("name"), "model3");
|
|
||||||
Assert.assertEquals(models.get("classname"), "test.Model3");
|
|
||||||
|
|
||||||
parent = parentsList.get(1);
|
|
||||||
Assert.assertEquals(parent.get("classname"), "test.Parent2");
|
|
||||||
|
|
||||||
children = (List<CodegenModel>) parent.get("children");
|
|
||||||
Assert.assertNotNull(children);
|
|
||||||
Assert.assertEquals(children.size(), 2);
|
|
||||||
|
|
||||||
models = (Map<String, Object>) children.get(0);
|
|
||||||
Assert.assertEquals(models.get("name"), "model4");
|
|
||||||
Assert.assertEquals(models.get("classname"), "test.Model4");
|
|
||||||
|
|
||||||
models = (Map<String, Object>) children.get(1);
|
|
||||||
Assert.assertEquals(models.get("name"), "model5");
|
|
||||||
Assert.assertEquals(models.get("classname"), "test.Model5");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void arraysInRequestBody() throws Exception {
|
public void arraysInRequestBody() throws Exception {
|
||||||
final JavaClientCodegen codegen = new JavaClientCodegen();
|
final JavaClientCodegen codegen = new JavaClientCodegen();
|
||||||
|
|||||||
61
modules/openapi-generator/src/test/resources/3_0/allOf.yaml
Normal file
61
modules/openapi-generator/src/test/resources/3_0/allOf.yaml
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
openapi: 3.0.1
|
||||||
|
info:
|
||||||
|
version: 1.0.0
|
||||||
|
title: Example
|
||||||
|
license:
|
||||||
|
name: MIT
|
||||||
|
servers:
|
||||||
|
- url: http://api.example.xyz/v1
|
||||||
|
paths:
|
||||||
|
/person/display/{personId}:
|
||||||
|
get:
|
||||||
|
parameters:
|
||||||
|
- name: personId
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
description: The id of the person to retrieve
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
operationId: list
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: OK
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/Person"
|
||||||
|
components:
|
||||||
|
schemas:
|
||||||
|
Person:
|
||||||
|
type: object
|
||||||
|
discriminator:
|
||||||
|
propertyName: $_type
|
||||||
|
mapping:
|
||||||
|
a: '#/components/schemas/Adult'
|
||||||
|
c: '#/components/schemas/Child'
|
||||||
|
properties:
|
||||||
|
$_type:
|
||||||
|
type: string
|
||||||
|
lastName:
|
||||||
|
type: string
|
||||||
|
firstName:
|
||||||
|
type: string
|
||||||
|
Adult:
|
||||||
|
description: A representation of an adult
|
||||||
|
allOf:
|
||||||
|
- $ref: '#/components/schemas/Person'
|
||||||
|
- type: object
|
||||||
|
properties:
|
||||||
|
children:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: "#/components/schemas/Child"
|
||||||
|
Child:
|
||||||
|
description: A representation of a child
|
||||||
|
allOf:
|
||||||
|
- $ref: '#/components/schemas/Person'
|
||||||
|
- type: object
|
||||||
|
properties:
|
||||||
|
age:
|
||||||
|
type: integer
|
||||||
|
format: int32
|
||||||
@@ -26,7 +26,8 @@ import io.swagger.annotations.ApiModelProperty;
|
|||||||
/**
|
/**
|
||||||
* Animal
|
* Animal
|
||||||
*/
|
*/
|
||||||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true )
|
|
||||||
|
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true)
|
||||||
@JsonSubTypes({
|
@JsonSubTypes({
|
||||||
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
|
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
|
||||||
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
|
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
|
||||||
|
|||||||
@@ -26,7 +26,8 @@ import io.swagger.annotations.ApiModelProperty;
|
|||||||
/**
|
/**
|
||||||
* Animal
|
* Animal
|
||||||
*/
|
*/
|
||||||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true )
|
|
||||||
|
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true)
|
||||||
@JsonSubTypes({
|
@JsonSubTypes({
|
||||||
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
|
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
|
||||||
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
|
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
|
||||||
|
|||||||
@@ -26,7 +26,8 @@ import io.swagger.annotations.ApiModelProperty;
|
|||||||
/**
|
/**
|
||||||
* Animal
|
* Animal
|
||||||
*/
|
*/
|
||||||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true )
|
|
||||||
|
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true)
|
||||||
@JsonSubTypes({
|
@JsonSubTypes({
|
||||||
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
|
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
|
||||||
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
|
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
|
||||||
|
|||||||
@@ -25,7 +25,8 @@ import io.swagger.annotations.ApiModelProperty;
|
|||||||
/**
|
/**
|
||||||
* Animal
|
* Animal
|
||||||
*/
|
*/
|
||||||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true )
|
|
||||||
|
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true)
|
||||||
@JsonSubTypes({
|
@JsonSubTypes({
|
||||||
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
|
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
|
||||||
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
|
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
|
||||||
|
|||||||
@@ -26,7 +26,8 @@ import io.swagger.annotations.ApiModelProperty;
|
|||||||
/**
|
/**
|
||||||
* Animal
|
* Animal
|
||||||
*/
|
*/
|
||||||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true )
|
|
||||||
|
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true)
|
||||||
@JsonSubTypes({
|
@JsonSubTypes({
|
||||||
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
|
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
|
||||||
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
|
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
|
||||||
|
|||||||
@@ -26,7 +26,8 @@ import io.swagger.annotations.ApiModelProperty;
|
|||||||
/**
|
/**
|
||||||
* Animal
|
* Animal
|
||||||
*/
|
*/
|
||||||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true )
|
|
||||||
|
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true)
|
||||||
@JsonSubTypes({
|
@JsonSubTypes({
|
||||||
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
|
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
|
||||||
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
|
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
|
||||||
|
|||||||
@@ -55,14 +55,15 @@ public class JSON {
|
|||||||
@Override
|
@Override
|
||||||
public Class getClassForElement(JsonElement readElement) {
|
public Class getClassForElement(JsonElement readElement) {
|
||||||
Map classByDiscriminatorValue = new HashMap();
|
Map classByDiscriminatorValue = new HashMap();
|
||||||
classByDiscriminatorValue.put("Cat".toUpperCase(), Cat.class);
|
|
||||||
classByDiscriminatorValue.put("Dog".toUpperCase(), Dog.class);
|
classByDiscriminatorValue.put("Dog".toUpperCase(), Dog.class);
|
||||||
|
classByDiscriminatorValue.put("Cat".toUpperCase(), Cat.class);
|
||||||
classByDiscriminatorValue.put("Animal".toUpperCase(), Animal.class);
|
classByDiscriminatorValue.put("Animal".toUpperCase(), Animal.class);
|
||||||
return getClassByDiscriminator(
|
return getClassByDiscriminator(
|
||||||
classByDiscriminatorValue,
|
classByDiscriminatorValue,
|
||||||
getDiscriminatorValue(readElement, ""));
|
getDiscriminatorValue(readElement, "className"));
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
;
|
;
|
||||||
GsonBuilder builder = fireBuilder.createGsonBuilder();
|
GsonBuilder builder = fireBuilder.createGsonBuilder();
|
||||||
return builder;
|
return builder;
|
||||||
|
|||||||
@@ -55,14 +55,15 @@ public class JSON {
|
|||||||
@Override
|
@Override
|
||||||
public Class getClassForElement(JsonElement readElement) {
|
public Class getClassForElement(JsonElement readElement) {
|
||||||
Map classByDiscriminatorValue = new HashMap();
|
Map classByDiscriminatorValue = new HashMap();
|
||||||
classByDiscriminatorValue.put("Cat".toUpperCase(), Cat.class);
|
|
||||||
classByDiscriminatorValue.put("Dog".toUpperCase(), Dog.class);
|
classByDiscriminatorValue.put("Dog".toUpperCase(), Dog.class);
|
||||||
|
classByDiscriminatorValue.put("Cat".toUpperCase(), Cat.class);
|
||||||
classByDiscriminatorValue.put("Animal".toUpperCase(), Animal.class);
|
classByDiscriminatorValue.put("Animal".toUpperCase(), Animal.class);
|
||||||
return getClassByDiscriminator(
|
return getClassByDiscriminator(
|
||||||
classByDiscriminatorValue,
|
classByDiscriminatorValue,
|
||||||
getDiscriminatorValue(readElement, ""));
|
getDiscriminatorValue(readElement, "className"));
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
;
|
;
|
||||||
GsonBuilder builder = fireBuilder.createGsonBuilder();
|
GsonBuilder builder = fireBuilder.createGsonBuilder();
|
||||||
return builder;
|
return builder;
|
||||||
|
|||||||
@@ -55,14 +55,15 @@ public class JSON {
|
|||||||
@Override
|
@Override
|
||||||
public Class getClassForElement(JsonElement readElement) {
|
public Class getClassForElement(JsonElement readElement) {
|
||||||
Map classByDiscriminatorValue = new HashMap();
|
Map classByDiscriminatorValue = new HashMap();
|
||||||
classByDiscriminatorValue.put("Cat".toUpperCase(), Cat.class);
|
|
||||||
classByDiscriminatorValue.put("Dog".toUpperCase(), Dog.class);
|
classByDiscriminatorValue.put("Dog".toUpperCase(), Dog.class);
|
||||||
|
classByDiscriminatorValue.put("Cat".toUpperCase(), Cat.class);
|
||||||
classByDiscriminatorValue.put("Animal".toUpperCase(), Animal.class);
|
classByDiscriminatorValue.put("Animal".toUpperCase(), Animal.class);
|
||||||
return getClassByDiscriminator(
|
return getClassByDiscriminator(
|
||||||
classByDiscriminatorValue,
|
classByDiscriminatorValue,
|
||||||
getDiscriminatorValue(readElement, ""));
|
getDiscriminatorValue(readElement, "className"));
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
;
|
;
|
||||||
GsonBuilder builder = fireBuilder.createGsonBuilder();
|
GsonBuilder builder = fireBuilder.createGsonBuilder();
|
||||||
return builder;
|
return builder;
|
||||||
|
|||||||
@@ -26,7 +26,8 @@ import io.swagger.annotations.ApiModelProperty;
|
|||||||
/**
|
/**
|
||||||
* Animal
|
* Animal
|
||||||
*/
|
*/
|
||||||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true )
|
|
||||||
|
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true)
|
||||||
@JsonSubTypes({
|
@JsonSubTypes({
|
||||||
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
|
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
|
||||||
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
|
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
|
||||||
|
|||||||
@@ -28,7 +28,8 @@ import javax.xml.bind.annotation.*;
|
|||||||
/**
|
/**
|
||||||
* Animal
|
* Animal
|
||||||
*/
|
*/
|
||||||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true )
|
|
||||||
|
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true)
|
||||||
@JsonSubTypes({
|
@JsonSubTypes({
|
||||||
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
|
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
|
||||||
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
|
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
|
||||||
|
|||||||
@@ -26,7 +26,8 @@ import io.swagger.annotations.ApiModelProperty;
|
|||||||
/**
|
/**
|
||||||
* Animal
|
* Animal
|
||||||
*/
|
*/
|
||||||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true )
|
|
||||||
|
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true)
|
||||||
@JsonSubTypes({
|
@JsonSubTypes({
|
||||||
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
|
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
|
||||||
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
|
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
|
||||||
|
|||||||
@@ -28,7 +28,8 @@ import javax.validation.Valid;
|
|||||||
/**
|
/**
|
||||||
* Animal
|
* Animal
|
||||||
*/
|
*/
|
||||||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true )
|
|
||||||
|
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true)
|
||||||
@JsonSubTypes({
|
@JsonSubTypes({
|
||||||
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
|
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
|
||||||
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
|
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
|
||||||
|
|||||||
@@ -28,7 +28,8 @@ import javax.validation.Valid;
|
|||||||
/**
|
/**
|
||||||
* Animal
|
* Animal
|
||||||
*/
|
*/
|
||||||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true )
|
|
||||||
|
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true)
|
||||||
@JsonSubTypes({
|
@JsonSubTypes({
|
||||||
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
|
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
|
||||||
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
|
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
|
||||||
|
|||||||
@@ -52,14 +52,15 @@ public class JSON {
|
|||||||
@Override
|
@Override
|
||||||
public Class getClassForElement(JsonElement readElement) {
|
public Class getClassForElement(JsonElement readElement) {
|
||||||
Map classByDiscriminatorValue = new HashMap();
|
Map classByDiscriminatorValue = new HashMap();
|
||||||
classByDiscriminatorValue.put("Cat".toUpperCase(), Cat.class);
|
|
||||||
classByDiscriminatorValue.put("Dog".toUpperCase(), Dog.class);
|
classByDiscriminatorValue.put("Dog".toUpperCase(), Dog.class);
|
||||||
|
classByDiscriminatorValue.put("Cat".toUpperCase(), Cat.class);
|
||||||
classByDiscriminatorValue.put("Animal".toUpperCase(), Animal.class);
|
classByDiscriminatorValue.put("Animal".toUpperCase(), Animal.class);
|
||||||
return getClassByDiscriminator(
|
return getClassByDiscriminator(
|
||||||
classByDiscriminatorValue,
|
classByDiscriminatorValue,
|
||||||
getDiscriminatorValue(readElement, ""));
|
getDiscriminatorValue(readElement, "className"));
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
;
|
;
|
||||||
return fireBuilder.createGsonBuilder();
|
return fireBuilder.createGsonBuilder();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,14 +52,15 @@ public class JSON {
|
|||||||
@Override
|
@Override
|
||||||
public Class getClassForElement(JsonElement readElement) {
|
public Class getClassForElement(JsonElement readElement) {
|
||||||
Map classByDiscriminatorValue = new HashMap();
|
Map classByDiscriminatorValue = new HashMap();
|
||||||
classByDiscriminatorValue.put("Cat".toUpperCase(), Cat.class);
|
|
||||||
classByDiscriminatorValue.put("Dog".toUpperCase(), Dog.class);
|
classByDiscriminatorValue.put("Dog".toUpperCase(), Dog.class);
|
||||||
|
classByDiscriminatorValue.put("Cat".toUpperCase(), Cat.class);
|
||||||
classByDiscriminatorValue.put("Animal".toUpperCase(), Animal.class);
|
classByDiscriminatorValue.put("Animal".toUpperCase(), Animal.class);
|
||||||
return getClassByDiscriminator(
|
return getClassByDiscriminator(
|
||||||
classByDiscriminatorValue,
|
classByDiscriminatorValue,
|
||||||
getDiscriminatorValue(readElement, ""));
|
getDiscriminatorValue(readElement, "className"));
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
;
|
;
|
||||||
return fireBuilder.createGsonBuilder();
|
return fireBuilder.createGsonBuilder();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,14 +52,15 @@ public class JSON {
|
|||||||
@Override
|
@Override
|
||||||
public Class getClassForElement(JsonElement readElement) {
|
public Class getClassForElement(JsonElement readElement) {
|
||||||
Map classByDiscriminatorValue = new HashMap();
|
Map classByDiscriminatorValue = new HashMap();
|
||||||
classByDiscriminatorValue.put("Cat".toUpperCase(), Cat.class);
|
|
||||||
classByDiscriminatorValue.put("Dog".toUpperCase(), Dog.class);
|
classByDiscriminatorValue.put("Dog".toUpperCase(), Dog.class);
|
||||||
|
classByDiscriminatorValue.put("Cat".toUpperCase(), Cat.class);
|
||||||
classByDiscriminatorValue.put("Animal".toUpperCase(), Animal.class);
|
classByDiscriminatorValue.put("Animal".toUpperCase(), Animal.class);
|
||||||
return getClassByDiscriminator(
|
return getClassByDiscriminator(
|
||||||
classByDiscriminatorValue,
|
classByDiscriminatorValue,
|
||||||
getDiscriminatorValue(readElement, ""));
|
getDiscriminatorValue(readElement, "className"));
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
;
|
;
|
||||||
return fireBuilder.createGsonBuilder();
|
return fireBuilder.createGsonBuilder();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,8 @@ import io.swagger.annotations.ApiModelProperty;
|
|||||||
/**
|
/**
|
||||||
* Animal
|
* Animal
|
||||||
*/
|
*/
|
||||||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true )
|
|
||||||
|
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true)
|
||||||
@JsonSubTypes({
|
@JsonSubTypes({
|
||||||
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
|
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
|
||||||
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
|
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
|
||||||
|
|||||||
@@ -26,7 +26,8 @@ import io.swagger.annotations.ApiModelProperty;
|
|||||||
/**
|
/**
|
||||||
* Animal
|
* Animal
|
||||||
*/
|
*/
|
||||||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true )
|
|
||||||
|
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true)
|
||||||
@JsonSubTypes({
|
@JsonSubTypes({
|
||||||
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
|
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
|
||||||
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
|
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
3.0.1-SNAPSHOT
|
3.1.1-SNAPSHOT
|
||||||
@@ -26,7 +26,7 @@ public class Cat extends Animal {
|
|||||||
|
|
||||||
@ApiModelProperty(value = "")
|
@ApiModelProperty(value = "")
|
||||||
@JsonProperty("declawed")
|
@JsonProperty("declawed")
|
||||||
public Boolean isDeclawed() {
|
public Boolean getDeclawed() {
|
||||||
return declawed;
|
return declawed;
|
||||||
}
|
}
|
||||||
public void setDeclawed(Boolean declawed) {
|
public void setDeclawed(Boolean declawed) {
|
||||||
|
|||||||
@@ -0,0 +1,98 @@
|
|||||||
|
package org.openapitools.model;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public class FileSchemaTestClass {
|
||||||
|
@JsonProperty("file")
|
||||||
|
private java.io.File file = null;
|
||||||
|
|
||||||
|
@JsonProperty("files")
|
||||||
|
private List<java.io.File> files = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
public FileSchemaTestClass file(java.io.File file) {
|
||||||
|
this.file = file;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "")
|
||||||
|
@JsonProperty("file")
|
||||||
|
public java.io.File getFile() {
|
||||||
|
return file;
|
||||||
|
}
|
||||||
|
public void setFile(java.io.File file) {
|
||||||
|
this.file = file;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
public FileSchemaTestClass files(List<java.io.File> files) {
|
||||||
|
this.files = files;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "")
|
||||||
|
@JsonProperty("files")
|
||||||
|
public List<java.io.File> getFiles() {
|
||||||
|
return files;
|
||||||
|
}
|
||||||
|
public void setFiles(List<java.io.File> files) {
|
||||||
|
this.files = files;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(java.lang.Object o) {
|
||||||
|
if (this == o) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (o == null || getClass() != o.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
FileSchemaTestClass fileSchemaTestClass = (FileSchemaTestClass) o;
|
||||||
|
return Objects.equals(file, fileSchemaTestClass.file) &&
|
||||||
|
Objects.equals(files, fileSchemaTestClass.files);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(file, files);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("class FileSchemaTestClass {\n");
|
||||||
|
|
||||||
|
sb.append(" file: ").append(toIndentedString(file)).append("\n");
|
||||||
|
sb.append(" files: ").append(toIndentedString(files)).append("\n");
|
||||||
|
sb.append("}");
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert the given object to string with each line indented by 4 spaces
|
||||||
|
* (except the first line).
|
||||||
|
*/
|
||||||
|
private String toIndentedString(java.lang.Object o) {
|
||||||
|
if (o == null) {
|
||||||
|
return "null";
|
||||||
|
}
|
||||||
|
return o.toString().replace("\n", "\n ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -9,6 +9,7 @@ import io.swagger.annotations.ApiModelProperty;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import org.openapitools.model.StringBooleanMap;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -53,6 +54,12 @@ public class MapTest {
|
|||||||
@JsonProperty("map_of_enum_string")
|
@JsonProperty("map_of_enum_string")
|
||||||
private Map<String, InnerEnum> mapOfEnumString = null;
|
private Map<String, InnerEnum> mapOfEnumString = null;
|
||||||
|
|
||||||
|
@JsonProperty("direct_map")
|
||||||
|
private Map<String, Boolean> directMap = null;
|
||||||
|
|
||||||
|
@JsonProperty("indirect_map")
|
||||||
|
private StringBooleanMap indirectMap = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
**/
|
**/
|
||||||
public MapTest mapMapOfString(Map<String, Map<String, String>> mapMapOfString) {
|
public MapTest mapMapOfString(Map<String, Map<String, String>> mapMapOfString) {
|
||||||
@@ -87,6 +94,40 @@ public class MapTest {
|
|||||||
this.mapOfEnumString = mapOfEnumString;
|
this.mapOfEnumString = mapOfEnumString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
public MapTest directMap(Map<String, Boolean> directMap) {
|
||||||
|
this.directMap = directMap;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "")
|
||||||
|
@JsonProperty("direct_map")
|
||||||
|
public Map<String, Boolean> getDirectMap() {
|
||||||
|
return directMap;
|
||||||
|
}
|
||||||
|
public void setDirectMap(Map<String, Boolean> directMap) {
|
||||||
|
this.directMap = directMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
public MapTest indirectMap(StringBooleanMap indirectMap) {
|
||||||
|
this.indirectMap = indirectMap;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "")
|
||||||
|
@JsonProperty("indirect_map")
|
||||||
|
public StringBooleanMap getIndirectMap() {
|
||||||
|
return indirectMap;
|
||||||
|
}
|
||||||
|
public void setIndirectMap(StringBooleanMap indirectMap) {
|
||||||
|
this.indirectMap = indirectMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(java.lang.Object o) {
|
public boolean equals(java.lang.Object o) {
|
||||||
@@ -98,12 +139,14 @@ public class MapTest {
|
|||||||
}
|
}
|
||||||
MapTest mapTest = (MapTest) o;
|
MapTest mapTest = (MapTest) o;
|
||||||
return Objects.equals(mapMapOfString, mapTest.mapMapOfString) &&
|
return Objects.equals(mapMapOfString, mapTest.mapMapOfString) &&
|
||||||
Objects.equals(mapOfEnumString, mapTest.mapOfEnumString);
|
Objects.equals(mapOfEnumString, mapTest.mapOfEnumString) &&
|
||||||
|
Objects.equals(directMap, mapTest.directMap) &&
|
||||||
|
Objects.equals(indirectMap, mapTest.indirectMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(mapMapOfString, mapOfEnumString);
|
return Objects.hash(mapMapOfString, mapOfEnumString, directMap, indirectMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -113,6 +156,8 @@ public class MapTest {
|
|||||||
|
|
||||||
sb.append(" mapMapOfString: ").append(toIndentedString(mapMapOfString)).append("\n");
|
sb.append(" mapMapOfString: ").append(toIndentedString(mapMapOfString)).append("\n");
|
||||||
sb.append(" mapOfEnumString: ").append(toIndentedString(mapOfEnumString)).append("\n");
|
sb.append(" mapOfEnumString: ").append(toIndentedString(mapOfEnumString)).append("\n");
|
||||||
|
sb.append(" directMap: ").append(toIndentedString(directMap)).append("\n");
|
||||||
|
sb.append(" indirectMap: ").append(toIndentedString(indirectMap)).append("\n");
|
||||||
sb.append("}");
|
sb.append("}");
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ public class Order {
|
|||||||
|
|
||||||
@ApiModelProperty(value = "")
|
@ApiModelProperty(value = "")
|
||||||
@JsonProperty("complete")
|
@JsonProperty("complete")
|
||||||
public Boolean isComplete() {
|
public Boolean getComplete() {
|
||||||
return complete;
|
return complete;
|
||||||
}
|
}
|
||||||
public void setComplete(Boolean complete) {
|
public void setComplete(Boolean complete) {
|
||||||
|
|||||||
@@ -0,0 +1,51 @@
|
|||||||
|
package org.openapitools.model;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public class StringBooleanMap extends HashMap<String, Boolean> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(java.lang.Object o) {
|
||||||
|
if (this == o) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (o == null || getClass() != o.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
StringBooleanMap stringBooleanMap = (StringBooleanMap) o;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("class StringBooleanMap {\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 String toIndentedString(java.lang.Object o) {
|
||||||
|
if (o == null) {
|
||||||
|
return "null";
|
||||||
|
}
|
||||||
|
return o.toString().replace("\n", "\n ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -14,7 +14,9 @@ import java.math.BigDecimal;
|
|||||||
import org.openapitools.model.Client;
|
import org.openapitools.model.Client;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import org.openapitools.model.FileSchemaTestClass;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import org.openapitools.model.ModelApiResponse;
|
||||||
import org.openapitools.model.OuterComposite;
|
import org.openapitools.model.OuterComposite;
|
||||||
import org.openapitools.model.User;
|
import org.openapitools.model.User;
|
||||||
|
|
||||||
@@ -50,6 +52,12 @@ public class FakeController {
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
public ResponseContext testBodyWithFileSchema(RequestContext request , FileSchemaTestClass fileSchemaTestClass) {
|
||||||
|
return new ResponseContext().status(Status.INTERNAL_SERVER_ERROR).entity( "Not implemented" );
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
public ResponseContext testBodyWithQueryParams(RequestContext request , String query, User user) {
|
public ResponseContext testBodyWithQueryParams(RequestContext request , String query, User user) {
|
||||||
return new ResponseContext().status(Status.INTERNAL_SERVER_ERROR).entity( "Not implemented" );
|
return new ResponseContext().status(Status.INTERNAL_SERVER_ERROR).entity( "Not implemented" );
|
||||||
@@ -86,5 +94,11 @@ public class FakeController {
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
public ResponseContext uploadFileWithRequiredFile(RequestContext request , Long petId, FormDataContentDisposition fileDetail, String additionalMetadata) {
|
||||||
|
return new ResponseContext().status(Status.INTERNAL_SERVER_ERROR).entity( "Not implemented" );
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1026,6 +1026,66 @@ paths:
|
|||||||
- $another-fake?
|
- $another-fake?
|
||||||
x-contentType: application/json
|
x-contentType: application/json
|
||||||
x-accepts: application/json
|
x-accepts: application/json
|
||||||
|
/fake/body-with-file-schema:
|
||||||
|
put:
|
||||||
|
description: For this test, the body for this request much reference a schema named `File`.
|
||||||
|
operationId: testBodyWithFileSchema
|
||||||
|
requestBody:
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/FileSchemaTestClass'
|
||||||
|
required: true
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
content: {}
|
||||||
|
description: Success
|
||||||
|
tags:
|
||||||
|
- fake
|
||||||
|
x-contentType: application/json
|
||||||
|
x-accepts: application/json
|
||||||
|
/fake/{petId}/uploadImageWithRequiredFile:
|
||||||
|
post:
|
||||||
|
operationId: uploadFileWithRequiredFile
|
||||||
|
parameters:
|
||||||
|
- description: ID of pet to update
|
||||||
|
in: path
|
||||||
|
name: petId
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
format: int64
|
||||||
|
type: integer
|
||||||
|
requestBody:
|
||||||
|
content:
|
||||||
|
multipart/form-data:
|
||||||
|
schema:
|
||||||
|
properties:
|
||||||
|
additionalMetadata:
|
||||||
|
description: Additional data to pass to server
|
||||||
|
type: string
|
||||||
|
file:
|
||||||
|
description: file to upload
|
||||||
|
format: binary
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- file
|
||||||
|
required: true
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/ApiResponse'
|
||||||
|
description: successful operation
|
||||||
|
security:
|
||||||
|
- petstore_auth:
|
||||||
|
- write:pets
|
||||||
|
- read:pets
|
||||||
|
summary: uploads an image (required)
|
||||||
|
tags:
|
||||||
|
- pet
|
||||||
|
x-contentType: multipart/form-data
|
||||||
|
x-accepts: application/json
|
||||||
components:
|
components:
|
||||||
schemas:
|
schemas:
|
||||||
Category:
|
Category:
|
||||||
@@ -1331,14 +1391,18 @@ components:
|
|||||||
type: array
|
type: array
|
||||||
type: object
|
type: object
|
||||||
OuterComposite:
|
OuterComposite:
|
||||||
example: {}
|
example:
|
||||||
|
my_string: my_string
|
||||||
|
my_number: 0.80082819046101150206595775671303272247314453125
|
||||||
|
my_boolean: true
|
||||||
properties:
|
properties:
|
||||||
my_number:
|
my_number:
|
||||||
$ref: '#/components/schemas/OuterNumber'
|
type: number
|
||||||
my_string:
|
my_string:
|
||||||
$ref: '#/components/schemas/OuterString'
|
type: string
|
||||||
my_boolean:
|
my_boolean:
|
||||||
$ref: '#/components/schemas/OuterBoolean'
|
type: boolean
|
||||||
|
x-codegen-body-parameter-name: boolean_post_body
|
||||||
type: object
|
type: object
|
||||||
format_test:
|
format_test:
|
||||||
properties:
|
properties:
|
||||||
@@ -1424,6 +1488,21 @@ components:
|
|||||||
OuterBoolean:
|
OuterBoolean:
|
||||||
type: boolean
|
type: boolean
|
||||||
x-codegen-body-parameter-name: boolean_post_body
|
x-codegen-body-parameter-name: boolean_post_body
|
||||||
|
FileSchemaTestClass:
|
||||||
|
example:
|
||||||
|
file:
|
||||||
|
sourceURI: sourceURI
|
||||||
|
files:
|
||||||
|
- sourceURI: sourceURI
|
||||||
|
- sourceURI: sourceURI
|
||||||
|
properties:
|
||||||
|
file:
|
||||||
|
$ref: '#/components/schemas/File'
|
||||||
|
files:
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/File'
|
||||||
|
type: array
|
||||||
|
type: object
|
||||||
Animal:
|
Animal:
|
||||||
discriminator:
|
discriminator:
|
||||||
propertyName: className
|
propertyName: className
|
||||||
@@ -1436,6 +1515,10 @@ components:
|
|||||||
required:
|
required:
|
||||||
- className
|
- className
|
||||||
type: object
|
type: object
|
||||||
|
StringBooleanMap:
|
||||||
|
additionalProperties:
|
||||||
|
type: boolean
|
||||||
|
type: object
|
||||||
Cat:
|
Cat:
|
||||||
allOf:
|
allOf:
|
||||||
- $ref: '#/components/schemas/Animal'
|
- $ref: '#/components/schemas/Animal'
|
||||||
@@ -1458,6 +1541,12 @@ components:
|
|||||||
- lower
|
- lower
|
||||||
type: string
|
type: string
|
||||||
type: object
|
type: object
|
||||||
|
direct_map:
|
||||||
|
additionalProperties:
|
||||||
|
type: boolean
|
||||||
|
type: object
|
||||||
|
indirect_map:
|
||||||
|
$ref: '#/components/schemas/StringBooleanMap'
|
||||||
type: object
|
type: object
|
||||||
Tag:
|
Tag:
|
||||||
example:
|
example:
|
||||||
@@ -1476,6 +1565,14 @@ components:
|
|||||||
items:
|
items:
|
||||||
$ref: '#/components/schemas/Animal'
|
$ref: '#/components/schemas/Animal'
|
||||||
type: array
|
type: array
|
||||||
|
File:
|
||||||
|
example:
|
||||||
|
sourceURI: sourceURI
|
||||||
|
properties:
|
||||||
|
sourceURI:
|
||||||
|
description: Test capitalization
|
||||||
|
type: string
|
||||||
|
type: object
|
||||||
Pet:
|
Pet:
|
||||||
example:
|
example:
|
||||||
photoUrls:
|
photoUrls:
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
3.0.0-SNAPSHOT
|
3.1.1-SNAPSHOT
|
||||||
@@ -158,7 +158,7 @@ public class Order {
|
|||||||
* Get complete
|
* Get complete
|
||||||
* @return complete
|
* @return complete
|
||||||
**/
|
**/
|
||||||
public Boolean isComplete() {
|
public Boolean getComplete() {
|
||||||
return complete;
|
return complete;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -108,13 +108,14 @@
|
|||||||
"in" : "query",
|
"in" : "query",
|
||||||
"description" : "Status values that need to be considered for filter",
|
"description" : "Status values that need to be considered for filter",
|
||||||
"required" : true,
|
"required" : true,
|
||||||
|
"style" : "form",
|
||||||
"explode" : false,
|
"explode" : false,
|
||||||
"schema" : {
|
"schema" : {
|
||||||
"type" : "array",
|
"type" : "array",
|
||||||
"items" : {
|
"items" : {
|
||||||
"type" : "string",
|
"type" : "string",
|
||||||
"default" : "available",
|
"enum" : [ "available", "pending", "sold" ],
|
||||||
"enum" : [ "available", "pending", "sold" ]
|
"default" : "available"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} ],
|
} ],
|
||||||
@@ -162,6 +163,7 @@
|
|||||||
"in" : "query",
|
"in" : "query",
|
||||||
"description" : "Tags to filter by",
|
"description" : "Tags to filter by",
|
||||||
"required" : true,
|
"required" : true,
|
||||||
|
"style" : "form",
|
||||||
"explode" : false,
|
"explode" : false,
|
||||||
"schema" : {
|
"schema" : {
|
||||||
"type" : "array",
|
"type" : "array",
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
3.0.0-SNAPSHOT
|
3.1.1-SNAPSHOT
|
||||||
@@ -158,7 +158,7 @@ public class Order {
|
|||||||
* Get complete
|
* Get complete
|
||||||
* @return complete
|
* @return complete
|
||||||
**/
|
**/
|
||||||
public Boolean isComplete() {
|
public Boolean getComplete() {
|
||||||
return complete;
|
return complete;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -108,13 +108,14 @@
|
|||||||
"in" : "query",
|
"in" : "query",
|
||||||
"description" : "Status values that need to be considered for filter",
|
"description" : "Status values that need to be considered for filter",
|
||||||
"required" : true,
|
"required" : true,
|
||||||
|
"style" : "form",
|
||||||
"explode" : false,
|
"explode" : false,
|
||||||
"schema" : {
|
"schema" : {
|
||||||
"type" : "array",
|
"type" : "array",
|
||||||
"items" : {
|
"items" : {
|
||||||
"type" : "string",
|
"type" : "string",
|
||||||
"default" : "available",
|
"enum" : [ "available", "pending", "sold" ],
|
||||||
"enum" : [ "available", "pending", "sold" ]
|
"default" : "available"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} ],
|
} ],
|
||||||
@@ -162,6 +163,7 @@
|
|||||||
"in" : "query",
|
"in" : "query",
|
||||||
"description" : "Tags to filter by",
|
"description" : "Tags to filter by",
|
||||||
"required" : true,
|
"required" : true,
|
||||||
|
"style" : "form",
|
||||||
"explode" : false,
|
"explode" : false,
|
||||||
"schema" : {
|
"schema" : {
|
||||||
"type" : "array",
|
"type" : "array",
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
3.0.0-SNAPSHOT
|
3.1.1-SNAPSHOT
|
||||||
@@ -158,7 +158,7 @@ public class Order {
|
|||||||
* Get complete
|
* Get complete
|
||||||
* @return complete
|
* @return complete
|
||||||
**/
|
**/
|
||||||
public Boolean isComplete() {
|
public Boolean getComplete() {
|
||||||
return complete;
|
return complete;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -108,13 +108,14 @@
|
|||||||
"in" : "query",
|
"in" : "query",
|
||||||
"description" : "Status values that need to be considered for filter",
|
"description" : "Status values that need to be considered for filter",
|
||||||
"required" : true,
|
"required" : true,
|
||||||
|
"style" : "form",
|
||||||
"explode" : false,
|
"explode" : false,
|
||||||
"schema" : {
|
"schema" : {
|
||||||
"type" : "array",
|
"type" : "array",
|
||||||
"items" : {
|
"items" : {
|
||||||
"type" : "string",
|
"type" : "string",
|
||||||
"default" : "available",
|
"enum" : [ "available", "pending", "sold" ],
|
||||||
"enum" : [ "available", "pending", "sold" ]
|
"default" : "available"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} ],
|
} ],
|
||||||
@@ -162,6 +163,7 @@
|
|||||||
"in" : "query",
|
"in" : "query",
|
||||||
"description" : "Tags to filter by",
|
"description" : "Tags to filter by",
|
||||||
"required" : true,
|
"required" : true,
|
||||||
|
"style" : "form",
|
||||||
"explode" : false,
|
"explode" : false,
|
||||||
"schema" : {
|
"schema" : {
|
||||||
"type" : "array",
|
"type" : "array",
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
3.0.0-SNAPSHOT
|
3.1.1-SNAPSHOT
|
||||||
@@ -24,7 +24,7 @@ public class Cat extends Animal {
|
|||||||
* Get declawed
|
* Get declawed
|
||||||
* @return declawed
|
* @return declawed
|
||||||
**/
|
**/
|
||||||
public Boolean isDeclawed() {
|
public Boolean getDeclawed() {
|
||||||
return declawed;
|
return declawed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ public class EnumArrays {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonProperty("array_enum")
|
@JsonProperty("array_enum")
|
||||||
private List<ArrayEnumEnum> arrayEnum = null;
|
private List<ArrayEnumEnum> arrayEnum = null;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,108 @@
|
|||||||
|
package apimodels;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import com.fasterxml.jackson.annotation.*;
|
||||||
|
import java.util.Set;
|
||||||
|
import javax.validation.*;
|
||||||
|
import java.util.Objects;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
/**
|
||||||
|
* FileSchemaTestClass
|
||||||
|
*/
|
||||||
|
|
||||||
|
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
|
||||||
|
public class FileSchemaTestClass {
|
||||||
|
@JsonProperty("file")
|
||||||
|
private java.io.File file = null;
|
||||||
|
|
||||||
|
@JsonProperty("files")
|
||||||
|
private List<java.io.File> files = null;
|
||||||
|
|
||||||
|
public FileSchemaTestClass file(java.io.File file) {
|
||||||
|
this.file = file;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get file
|
||||||
|
* @return file
|
||||||
|
**/
|
||||||
|
@Valid
|
||||||
|
public java.io.File getFile() {
|
||||||
|
return file;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFile(java.io.File file) {
|
||||||
|
this.file = file;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FileSchemaTestClass files(List<java.io.File> files) {
|
||||||
|
this.files = files;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FileSchemaTestClass addFilesItem(java.io.File filesItem) {
|
||||||
|
if (files == null) {
|
||||||
|
files = new ArrayList<>();
|
||||||
|
}
|
||||||
|
files.add(filesItem);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get files
|
||||||
|
* @return files
|
||||||
|
**/
|
||||||
|
@Valid
|
||||||
|
public List<java.io.File> getFiles() {
|
||||||
|
return files;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFiles(List<java.io.File> files) {
|
||||||
|
this.files = files;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(java.lang.Object o) {
|
||||||
|
if (this == o) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (o == null || getClass() != o.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
FileSchemaTestClass fileSchemaTestClass = (FileSchemaTestClass) o;
|
||||||
|
return Objects.equals(file, fileSchemaTestClass.file) &&
|
||||||
|
Objects.equals(files, fileSchemaTestClass.files);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(file, files);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("StringBufferReplaceableByString")
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("class FileSchemaTestClass {\n");
|
||||||
|
|
||||||
|
sb.append(" file: ").append(toIndentedString(file)).append("\n");
|
||||||
|
sb.append(" files: ").append(toIndentedString(files)).append("\n");
|
||||||
|
sb.append("}");
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert the given object to string with each line indented by 4 spaces
|
||||||
|
* (except the first line).
|
||||||
|
*/
|
||||||
|
private String toIndentedString(java.lang.Object o) {
|
||||||
|
if (o == null) {
|
||||||
|
return "null";
|
||||||
|
}
|
||||||
|
return o.toString().replace("\n", "\n ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package apimodels;
|
package apimodels;
|
||||||
|
|
||||||
|
import apimodels.StringBooleanMap;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -47,10 +48,16 @@ public class MapTest {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonProperty("map_of_enum_string")
|
@JsonProperty("map_of_enum_string")
|
||||||
private Map<String, InnerEnum> mapOfEnumString = null;
|
private Map<String, InnerEnum> mapOfEnumString = null;
|
||||||
|
|
||||||
|
@JsonProperty("direct_map")
|
||||||
|
private Map<String, Boolean> directMap = null;
|
||||||
|
|
||||||
|
@JsonProperty("indirect_map")
|
||||||
|
private StringBooleanMap indirectMap = null;
|
||||||
|
|
||||||
public MapTest mapMapOfString(Map<String, Map<String, String>> mapMapOfString) {
|
public MapTest mapMapOfString(Map<String, Map<String, String>> mapMapOfString) {
|
||||||
this.mapMapOfString = mapMapOfString;
|
this.mapMapOfString = mapMapOfString;
|
||||||
return this;
|
return this;
|
||||||
@@ -102,6 +109,49 @@ public class MapTest {
|
|||||||
this.mapOfEnumString = mapOfEnumString;
|
this.mapOfEnumString = mapOfEnumString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MapTest directMap(Map<String, Boolean> directMap) {
|
||||||
|
this.directMap = directMap;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MapTest putDirectMapItem(String key, Boolean directMapItem) {
|
||||||
|
if (this.directMap == null) {
|
||||||
|
this.directMap = new HashMap<>();
|
||||||
|
}
|
||||||
|
this.directMap.put(key, directMapItem);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get directMap
|
||||||
|
* @return directMap
|
||||||
|
**/
|
||||||
|
public Map<String, Boolean> getDirectMap() {
|
||||||
|
return directMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDirectMap(Map<String, Boolean> directMap) {
|
||||||
|
this.directMap = directMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MapTest indirectMap(StringBooleanMap indirectMap) {
|
||||||
|
this.indirectMap = indirectMap;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get indirectMap
|
||||||
|
* @return indirectMap
|
||||||
|
**/
|
||||||
|
@Valid
|
||||||
|
public StringBooleanMap getIndirectMap() {
|
||||||
|
return indirectMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIndirectMap(StringBooleanMap indirectMap) {
|
||||||
|
this.indirectMap = indirectMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(java.lang.Object o) {
|
public boolean equals(java.lang.Object o) {
|
||||||
@@ -113,12 +163,14 @@ public class MapTest {
|
|||||||
}
|
}
|
||||||
MapTest mapTest = (MapTest) o;
|
MapTest mapTest = (MapTest) o;
|
||||||
return Objects.equals(mapMapOfString, mapTest.mapMapOfString) &&
|
return Objects.equals(mapMapOfString, mapTest.mapMapOfString) &&
|
||||||
Objects.equals(mapOfEnumString, mapTest.mapOfEnumString);
|
Objects.equals(mapOfEnumString, mapTest.mapOfEnumString) &&
|
||||||
|
Objects.equals(directMap, mapTest.directMap) &&
|
||||||
|
Objects.equals(indirectMap, mapTest.indirectMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(mapMapOfString, mapOfEnumString);
|
return Objects.hash(mapMapOfString, mapOfEnumString, directMap, indirectMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("StringBufferReplaceableByString")
|
@SuppressWarnings("StringBufferReplaceableByString")
|
||||||
@@ -129,6 +181,8 @@ public class MapTest {
|
|||||||
|
|
||||||
sb.append(" mapMapOfString: ").append(toIndentedString(mapMapOfString)).append("\n");
|
sb.append(" mapMapOfString: ").append(toIndentedString(mapMapOfString)).append("\n");
|
||||||
sb.append(" mapOfEnumString: ").append(toIndentedString(mapOfEnumString)).append("\n");
|
sb.append(" mapOfEnumString: ").append(toIndentedString(mapOfEnumString)).append("\n");
|
||||||
|
sb.append(" directMap: ").append(toIndentedString(directMap)).append("\n");
|
||||||
|
sb.append(" indirectMap: ").append(toIndentedString(indirectMap)).append("\n");
|
||||||
sb.append("}");
|
sb.append("}");
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ public class Order {
|
|||||||
* Get complete
|
* Get complete
|
||||||
* @return complete
|
* @return complete
|
||||||
**/
|
**/
|
||||||
public Boolean isComplete() {
|
public Boolean getComplete() {
|
||||||
return complete;
|
return complete;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
package apimodels;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import com.fasterxml.jackson.annotation.*;
|
||||||
|
import java.util.Set;
|
||||||
|
import javax.validation.*;
|
||||||
|
import java.util.Objects;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
/**
|
||||||
|
* StringBooleanMap
|
||||||
|
*/
|
||||||
|
|
||||||
|
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
|
||||||
|
public class StringBooleanMap extends HashMap<String, Boolean> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(java.lang.Object o) {
|
||||||
|
if (this == o) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (o == null || getClass() != o.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(super.hashCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("StringBufferReplaceableByString")
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("class StringBooleanMap {\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 String toIndentedString(java.lang.Object o) {
|
||||||
|
if (o == null) {
|
||||||
|
return "null";
|
||||||
|
}
|
||||||
|
return o.toString().replace("\n", "\n ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -2,6 +2,7 @@ package controllers;
|
|||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import apimodels.Client;
|
import apimodels.Client;
|
||||||
|
import apimodels.FileSchemaTestClass;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -116,6 +117,22 @@ public class FakeApiController extends Controller {
|
|||||||
return ok(result);
|
return ok(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiAction
|
||||||
|
public Result testBodyWithFileSchema() throws Exception {
|
||||||
|
JsonNode nodefileSchemaTestClass = request().body().asJson();
|
||||||
|
FileSchemaTestClass fileSchemaTestClass;
|
||||||
|
if (nodefileSchemaTestClass != null) {
|
||||||
|
fileSchemaTestClass = mapper.readValue(nodefileSchemaTestClass.toString(), FileSchemaTestClass.class);
|
||||||
|
if (configuration.getBoolean("useInputBeanValidation")) {
|
||||||
|
OpenAPIUtils.validate(fileSchemaTestClass);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new IllegalArgumentException("'FileSchemaTestClass' parameter is required");
|
||||||
|
}
|
||||||
|
imp.testBodyWithFileSchema(fileSchemaTestClass);
|
||||||
|
return ok();
|
||||||
|
}
|
||||||
|
|
||||||
@ApiAction
|
@ApiAction
|
||||||
public Result testBodyWithQueryParams() throws Exception {
|
public Result testBodyWithQueryParams() throws Exception {
|
||||||
JsonNode nodeuser = request().body().asJson();
|
JsonNode nodeuser = request().body().asJson();
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package controllers;
|
|||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import apimodels.Client;
|
import apimodels.Client;
|
||||||
|
import apimodels.FileSchemaTestClass;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -41,6 +42,11 @@ public class FakeApiControllerImp implements FakeApiControllerImpInterface {
|
|||||||
return new String();
|
return new String();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass) throws Exception {
|
||||||
|
//Do your magic!!!
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void testBodyWithQueryParams( @NotNull String query, User user) throws Exception {
|
public void testBodyWithQueryParams( @NotNull String query, User user) throws Exception {
|
||||||
//Do your magic!!!
|
//Do your magic!!!
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package controllers;
|
|||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import apimodels.Client;
|
import apimodels.Client;
|
||||||
|
import apimodels.FileSchemaTestClass;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -26,6 +27,8 @@ public interface FakeApiControllerImpInterface {
|
|||||||
|
|
||||||
String fakeOuterStringSerialize(String body) throws Exception;
|
String fakeOuterStringSerialize(String body) throws Exception;
|
||||||
|
|
||||||
|
void testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass) throws Exception;
|
||||||
|
|
||||||
void testBodyWithQueryParams( @NotNull String query, User user) throws Exception;
|
void testBodyWithQueryParams( @NotNull String query, User user) throws Exception;
|
||||||
|
|
||||||
Client testClientModel(Client client) throws Exception;
|
Client testClientModel(Client client) throws Exception;
|
||||||
|
|||||||
@@ -177,4 +177,25 @@ public class PetApiController extends Controller {
|
|||||||
JsonNode result = mapper.valueToTree(obj);
|
JsonNode result = mapper.valueToTree(obj);
|
||||||
return ok(result);
|
return ok(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiAction
|
||||||
|
public Result uploadFileWithRequiredFile(Long petId) throws Exception {
|
||||||
|
String valueadditionalMetadata = (request().body().asMultipartFormData().asFormUrlEncoded().get("additionalMetadata"))[0];
|
||||||
|
String additionalMetadata;
|
||||||
|
if (valueadditionalMetadata != null) {
|
||||||
|
additionalMetadata = valueadditionalMetadata;
|
||||||
|
} else {
|
||||||
|
additionalMetadata = "null";
|
||||||
|
}
|
||||||
|
Http.MultipartFormData.FilePart file = request().body().asMultipartFormData().getFile("file");
|
||||||
|
if ((file == null || ((File) file.getFile()).length() == 0)) {
|
||||||
|
throw new IllegalArgumentException("'file' file cannot be empty");
|
||||||
|
}
|
||||||
|
ModelApiResponse obj = imp.uploadFileWithRequiredFile(petId, file, additionalMetadata);
|
||||||
|
if (configuration.getBoolean("useOutputBeanValidation")) {
|
||||||
|
OpenAPIUtils.validate(obj);
|
||||||
|
}
|
||||||
|
JsonNode result = mapper.valueToTree(obj);
|
||||||
|
return ok(result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,4 +56,10 @@ public class PetApiControllerImp implements PetApiControllerImpInterface {
|
|||||||
return new ModelApiResponse();
|
return new ModelApiResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ModelApiResponse uploadFileWithRequiredFile(Long petId, Http.MultipartFormData.FilePart file, String additionalMetadata) throws Exception {
|
||||||
|
//Do your magic!!!
|
||||||
|
return new ModelApiResponse();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,4 +29,6 @@ public interface PetApiControllerImpInterface {
|
|||||||
|
|
||||||
ModelApiResponse uploadFile(Long petId, String additionalMetadata, Http.MultipartFormData.FilePart file) throws Exception;
|
ModelApiResponse uploadFile(Long petId, String additionalMetadata, Http.MultipartFormData.FilePart file) throws Exception;
|
||||||
|
|
||||||
|
ModelApiResponse uploadFileWithRequiredFile(Long petId, Http.MultipartFormData.FilePart file, String additionalMetadata) throws Exception;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ POST /v2/fake/outer/boolean controllers.FakeApiControlle
|
|||||||
POST /v2/fake/outer/composite controllers.FakeApiController.fakeOuterCompositeSerialize()
|
POST /v2/fake/outer/composite controllers.FakeApiController.fakeOuterCompositeSerialize()
|
||||||
POST /v2/fake/outer/number controllers.FakeApiController.fakeOuterNumberSerialize()
|
POST /v2/fake/outer/number controllers.FakeApiController.fakeOuterNumberSerialize()
|
||||||
POST /v2/fake/outer/string controllers.FakeApiController.fakeOuterStringSerialize()
|
POST /v2/fake/outer/string controllers.FakeApiController.fakeOuterStringSerialize()
|
||||||
|
PUT /v2/fake/body-with-file-schema controllers.FakeApiController.testBodyWithFileSchema()
|
||||||
PUT /v2/fake/body-with-query-params controllers.FakeApiController.testBodyWithQueryParams()
|
PUT /v2/fake/body-with-query-params controllers.FakeApiController.testBodyWithQueryParams()
|
||||||
PATCH /v2/fake controllers.FakeApiController.testClientModel()
|
PATCH /v2/fake controllers.FakeApiController.testClientModel()
|
||||||
POST /v2/fake controllers.FakeApiController.testEndpointParameters()
|
POST /v2/fake controllers.FakeApiController.testEndpointParameters()
|
||||||
@@ -32,6 +33,7 @@ GET /v2/pet/:petId controllers.PetApiController.getPetBy
|
|||||||
PUT /v2/pet controllers.PetApiController.updatePet()
|
PUT /v2/pet controllers.PetApiController.updatePet()
|
||||||
POST /v2/pet/:petId controllers.PetApiController.updatePetWithForm(petId: Long)
|
POST /v2/pet/:petId controllers.PetApiController.updatePetWithForm(petId: Long)
|
||||||
POST /v2/pet/:petId/uploadImage controllers.PetApiController.uploadFile(petId: Long)
|
POST /v2/pet/:petId/uploadImage controllers.PetApiController.uploadFile(petId: Long)
|
||||||
|
POST /v2/fake/:petId/uploadImageWithRequiredFile controllers.PetApiController.uploadFileWithRequiredFile(petId: Long)
|
||||||
|
|
||||||
#Functions for Store API
|
#Functions for Store API
|
||||||
DELETE /v2/store/order/:orderId controllers.StoreApiController.deleteOrder(orderId: String)
|
DELETE /v2/store/order/:orderId controllers.StoreApiController.deleteOrder(orderId: String)
|
||||||
|
|||||||
@@ -108,13 +108,14 @@
|
|||||||
"in" : "query",
|
"in" : "query",
|
||||||
"description" : "Status values that need to be considered for filter",
|
"description" : "Status values that need to be considered for filter",
|
||||||
"required" : true,
|
"required" : true,
|
||||||
|
"style" : "form",
|
||||||
"explode" : false,
|
"explode" : false,
|
||||||
"schema" : {
|
"schema" : {
|
||||||
"type" : "array",
|
"type" : "array",
|
||||||
"items" : {
|
"items" : {
|
||||||
"type" : "string",
|
"type" : "string",
|
||||||
"default" : "available",
|
"enum" : [ "available", "pending", "sold" ],
|
||||||
"enum" : [ "available", "pending", "sold" ]
|
"default" : "available"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} ],
|
} ],
|
||||||
@@ -162,6 +163,7 @@
|
|||||||
"in" : "query",
|
"in" : "query",
|
||||||
"description" : "Tags to filter by",
|
"description" : "Tags to filter by",
|
||||||
"required" : true,
|
"required" : true,
|
||||||
|
"style" : "form",
|
||||||
"explode" : false,
|
"explode" : false,
|
||||||
"schema" : {
|
"schema" : {
|
||||||
"type" : "array",
|
"type" : "array",
|
||||||
@@ -833,12 +835,14 @@
|
|||||||
"name" : "enum_header_string_array",
|
"name" : "enum_header_string_array",
|
||||||
"in" : "header",
|
"in" : "header",
|
||||||
"description" : "Header parameter enum test (string array)",
|
"description" : "Header parameter enum test (string array)",
|
||||||
|
"style" : "simple",
|
||||||
|
"explode" : false,
|
||||||
"schema" : {
|
"schema" : {
|
||||||
"type" : "array",
|
"type" : "array",
|
||||||
"items" : {
|
"items" : {
|
||||||
"type" : "string",
|
"type" : "string",
|
||||||
"default" : "$",
|
"enum" : [ ">", "$" ],
|
||||||
"enum" : [ ">", "$" ]
|
"default" : "$"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
@@ -847,20 +851,21 @@
|
|||||||
"description" : "Header parameter enum test (string)",
|
"description" : "Header parameter enum test (string)",
|
||||||
"schema" : {
|
"schema" : {
|
||||||
"type" : "string",
|
"type" : "string",
|
||||||
"default" : "-efg",
|
"enum" : [ "_abc", "-efg", "(xyz)" ],
|
||||||
"enum" : [ "_abc", "-efg", "(xyz)" ]
|
"default" : "-efg"
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
"name" : "enum_query_string_array",
|
"name" : "enum_query_string_array",
|
||||||
"in" : "query",
|
"in" : "query",
|
||||||
"description" : "Query parameter enum test (string array)",
|
"description" : "Query parameter enum test (string array)",
|
||||||
|
"style" : "form",
|
||||||
"explode" : false,
|
"explode" : false,
|
||||||
"schema" : {
|
"schema" : {
|
||||||
"type" : "array",
|
"type" : "array",
|
||||||
"items" : {
|
"items" : {
|
||||||
"type" : "string",
|
"type" : "string",
|
||||||
"default" : "$",
|
"enum" : [ ">", "$" ],
|
||||||
"enum" : [ ">", "$" ]
|
"default" : "$"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
@@ -869,8 +874,8 @@
|
|||||||
"description" : "Query parameter enum test (string)",
|
"description" : "Query parameter enum test (string)",
|
||||||
"schema" : {
|
"schema" : {
|
||||||
"type" : "string",
|
"type" : "string",
|
||||||
"default" : "-efg",
|
"enum" : [ "_abc", "-efg", "(xyz)" ],
|
||||||
"enum" : [ "_abc", "-efg", "(xyz)" ]
|
"default" : "-efg"
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
"name" : "enum_query_integer",
|
"name" : "enum_query_integer",
|
||||||
@@ -901,15 +906,15 @@
|
|||||||
"description" : "Form parameter enum test (string array)",
|
"description" : "Form parameter enum test (string array)",
|
||||||
"items" : {
|
"items" : {
|
||||||
"type" : "string",
|
"type" : "string",
|
||||||
"default" : "$",
|
"enum" : [ ">", "$" ],
|
||||||
"enum" : [ ">", "$" ]
|
"default" : "$"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"enum_form_string" : {
|
"enum_form_string" : {
|
||||||
"type" : "string",
|
"type" : "string",
|
||||||
"description" : "Form parameter enum test (string)",
|
"description" : "Form parameter enum test (string)",
|
||||||
"default" : "-efg",
|
"enum" : [ "_abc", "-efg", "(xyz)" ],
|
||||||
"enum" : [ "_abc", "-efg", "(xyz)" ]
|
"default" : "-efg"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1328,6 +1333,86 @@
|
|||||||
"x-contentType" : "application/json",
|
"x-contentType" : "application/json",
|
||||||
"x-accepts" : "application/json"
|
"x-accepts" : "application/json"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"/fake/body-with-file-schema" : {
|
||||||
|
"put" : {
|
||||||
|
"tags" : [ "fake" ],
|
||||||
|
"description" : "For this test, the body for this request much reference a schema named `File`.",
|
||||||
|
"operationId" : "testBodyWithFileSchema",
|
||||||
|
"requestBody" : {
|
||||||
|
"content" : {
|
||||||
|
"application/json" : {
|
||||||
|
"schema" : {
|
||||||
|
"$ref" : "#/components/schemas/FileSchemaTestClass"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required" : true
|
||||||
|
},
|
||||||
|
"responses" : {
|
||||||
|
"200" : {
|
||||||
|
"description" : "Success",
|
||||||
|
"content" : { }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-contentType" : "application/json",
|
||||||
|
"x-accepts" : "application/json"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/fake/{petId}/uploadImageWithRequiredFile" : {
|
||||||
|
"post" : {
|
||||||
|
"tags" : [ "pet" ],
|
||||||
|
"summary" : "uploads an image (required)",
|
||||||
|
"operationId" : "uploadFileWithRequiredFile",
|
||||||
|
"parameters" : [ {
|
||||||
|
"name" : "petId",
|
||||||
|
"in" : "path",
|
||||||
|
"description" : "ID of pet to update",
|
||||||
|
"required" : true,
|
||||||
|
"schema" : {
|
||||||
|
"type" : "integer",
|
||||||
|
"format" : "int64"
|
||||||
|
}
|
||||||
|
} ],
|
||||||
|
"requestBody" : {
|
||||||
|
"content" : {
|
||||||
|
"multipart/form-data" : {
|
||||||
|
"schema" : {
|
||||||
|
"required" : [ "file" ],
|
||||||
|
"properties" : {
|
||||||
|
"additionalMetadata" : {
|
||||||
|
"type" : "string",
|
||||||
|
"description" : "Additional data to pass to server"
|
||||||
|
},
|
||||||
|
"file" : {
|
||||||
|
"type" : "string",
|
||||||
|
"description" : "file to upload",
|
||||||
|
"format" : "binary"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required" : true
|
||||||
|
},
|
||||||
|
"responses" : {
|
||||||
|
"200" : {
|
||||||
|
"description" : "successful operation",
|
||||||
|
"content" : {
|
||||||
|
"application/json" : {
|
||||||
|
"schema" : {
|
||||||
|
"$ref" : "#/components/schemas/ApiResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"security" : [ {
|
||||||
|
"petstore_auth" : [ "write:pets", "read:pets" ]
|
||||||
|
} ],
|
||||||
|
"x-contentType" : "multipart/form-data",
|
||||||
|
"x-accepts" : "application/json"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"components" : {
|
"components" : {
|
||||||
@@ -1502,8 +1587,8 @@
|
|||||||
},
|
},
|
||||||
"EnumClass" : {
|
"EnumClass" : {
|
||||||
"type" : "string",
|
"type" : "string",
|
||||||
"default" : "-efg",
|
"enum" : [ "_abc", "-efg", "(xyz)" ],
|
||||||
"enum" : [ "_abc", "-efg", "(xyz)" ]
|
"default" : "-efg"
|
||||||
},
|
},
|
||||||
"List" : {
|
"List" : {
|
||||||
"type" : "object",
|
"type" : "object",
|
||||||
@@ -1740,16 +1825,21 @@
|
|||||||
"type" : "object",
|
"type" : "object",
|
||||||
"properties" : {
|
"properties" : {
|
||||||
"my_number" : {
|
"my_number" : {
|
||||||
"$ref" : "#/components/schemas/OuterNumber"
|
"type" : "number"
|
||||||
},
|
},
|
||||||
"my_string" : {
|
"my_string" : {
|
||||||
"$ref" : "#/components/schemas/OuterString"
|
"type" : "string"
|
||||||
},
|
},
|
||||||
"my_boolean" : {
|
"my_boolean" : {
|
||||||
"$ref" : "#/components/schemas/OuterBoolean"
|
"type" : "boolean",
|
||||||
|
"x-codegen-body-parameter-name" : "boolean_post_body"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"example" : { }
|
"example" : {
|
||||||
|
"my_string" : "my_string",
|
||||||
|
"my_number" : 0.80082819046101150206595775671303272247314453125,
|
||||||
|
"my_boolean" : true
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"format_test" : {
|
"format_test" : {
|
||||||
"required" : [ "byte", "date", "number", "password" ],
|
"required" : [ "byte", "date", "number", "password" ],
|
||||||
@@ -1852,6 +1942,30 @@
|
|||||||
"type" : "boolean",
|
"type" : "boolean",
|
||||||
"x-codegen-body-parameter-name" : "boolean_post_body"
|
"x-codegen-body-parameter-name" : "boolean_post_body"
|
||||||
},
|
},
|
||||||
|
"FileSchemaTestClass" : {
|
||||||
|
"type" : "object",
|
||||||
|
"properties" : {
|
||||||
|
"file" : {
|
||||||
|
"$ref" : "#/components/schemas/File"
|
||||||
|
},
|
||||||
|
"files" : {
|
||||||
|
"type" : "array",
|
||||||
|
"items" : {
|
||||||
|
"$ref" : "#/components/schemas/File"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"example" : {
|
||||||
|
"file" : {
|
||||||
|
"sourceURI" : "sourceURI"
|
||||||
|
},
|
||||||
|
"files" : [ {
|
||||||
|
"sourceURI" : "sourceURI"
|
||||||
|
}, {
|
||||||
|
"sourceURI" : "sourceURI"
|
||||||
|
} ]
|
||||||
|
}
|
||||||
|
},
|
||||||
"Animal" : {
|
"Animal" : {
|
||||||
"required" : [ "className" ],
|
"required" : [ "className" ],
|
||||||
"type" : "object",
|
"type" : "object",
|
||||||
@@ -1868,6 +1982,12 @@
|
|||||||
"propertyName" : "className"
|
"propertyName" : "className"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"StringBooleanMap" : {
|
||||||
|
"type" : "object",
|
||||||
|
"additionalProperties" : {
|
||||||
|
"type" : "boolean"
|
||||||
|
}
|
||||||
|
},
|
||||||
"Cat" : {
|
"Cat" : {
|
||||||
"allOf" : [ {
|
"allOf" : [ {
|
||||||
"$ref" : "#/components/schemas/Animal"
|
"$ref" : "#/components/schemas/Animal"
|
||||||
@@ -1898,6 +2018,15 @@
|
|||||||
"type" : "string",
|
"type" : "string",
|
||||||
"enum" : [ "UPPER", "lower" ]
|
"enum" : [ "UPPER", "lower" ]
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"direct_map" : {
|
||||||
|
"type" : "object",
|
||||||
|
"additionalProperties" : {
|
||||||
|
"type" : "boolean"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indirect_map" : {
|
||||||
|
"$ref" : "#/components/schemas/StringBooleanMap"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -1926,6 +2055,18 @@
|
|||||||
"$ref" : "#/components/schemas/Animal"
|
"$ref" : "#/components/schemas/Animal"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"File" : {
|
||||||
|
"type" : "object",
|
||||||
|
"properties" : {
|
||||||
|
"sourceURI" : {
|
||||||
|
"type" : "string",
|
||||||
|
"description" : "Test capitalization"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"example" : {
|
||||||
|
"sourceURI" : "sourceURI"
|
||||||
|
}
|
||||||
|
},
|
||||||
"Pet" : {
|
"Pet" : {
|
||||||
"required" : [ "name", "photoUrls" ],
|
"required" : [ "name", "photoUrls" ],
|
||||||
"type" : "object",
|
"type" : "object",
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
3.0.0-SNAPSHOT
|
3.1.1-SNAPSHOT
|
||||||
@@ -156,7 +156,7 @@ public class Order {
|
|||||||
* Get complete
|
* Get complete
|
||||||
* @return complete
|
* @return complete
|
||||||
**/
|
**/
|
||||||
public Boolean isComplete() {
|
public Boolean getComplete() {
|
||||||
return complete;
|
return complete;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -108,13 +108,14 @@
|
|||||||
"in" : "query",
|
"in" : "query",
|
||||||
"description" : "Status values that need to be considered for filter",
|
"description" : "Status values that need to be considered for filter",
|
||||||
"required" : true,
|
"required" : true,
|
||||||
|
"style" : "form",
|
||||||
"explode" : false,
|
"explode" : false,
|
||||||
"schema" : {
|
"schema" : {
|
||||||
"type" : "array",
|
"type" : "array",
|
||||||
"items" : {
|
"items" : {
|
||||||
"type" : "string",
|
"type" : "string",
|
||||||
"default" : "available",
|
"enum" : [ "available", "pending", "sold" ],
|
||||||
"enum" : [ "available", "pending", "sold" ]
|
"default" : "available"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} ],
|
} ],
|
||||||
@@ -162,6 +163,7 @@
|
|||||||
"in" : "query",
|
"in" : "query",
|
||||||
"description" : "Tags to filter by",
|
"description" : "Tags to filter by",
|
||||||
"required" : true,
|
"required" : true,
|
||||||
|
"style" : "form",
|
||||||
"explode" : false,
|
"explode" : false,
|
||||||
"schema" : {
|
"schema" : {
|
||||||
"type" : "array",
|
"type" : "array",
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
3.0.0-SNAPSHOT
|
3.1.1-SNAPSHOT
|
||||||
@@ -158,7 +158,7 @@ public class Order {
|
|||||||
* Get complete
|
* Get complete
|
||||||
* @return complete
|
* @return complete
|
||||||
**/
|
**/
|
||||||
public Boolean isComplete() {
|
public Boolean getComplete() {
|
||||||
return complete;
|
return complete;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -108,13 +108,14 @@
|
|||||||
"in" : "query",
|
"in" : "query",
|
||||||
"description" : "Status values that need to be considered for filter",
|
"description" : "Status values that need to be considered for filter",
|
||||||
"required" : true,
|
"required" : true,
|
||||||
|
"style" : "form",
|
||||||
"explode" : false,
|
"explode" : false,
|
||||||
"schema" : {
|
"schema" : {
|
||||||
"type" : "array",
|
"type" : "array",
|
||||||
"items" : {
|
"items" : {
|
||||||
"type" : "string",
|
"type" : "string",
|
||||||
"default" : "available",
|
"enum" : [ "available", "pending", "sold" ],
|
||||||
"enum" : [ "available", "pending", "sold" ]
|
"default" : "available"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} ],
|
} ],
|
||||||
@@ -162,6 +163,7 @@
|
|||||||
"in" : "query",
|
"in" : "query",
|
||||||
"description" : "Tags to filter by",
|
"description" : "Tags to filter by",
|
||||||
"required" : true,
|
"required" : true,
|
||||||
|
"style" : "form",
|
||||||
"explode" : false,
|
"explode" : false,
|
||||||
"schema" : {
|
"schema" : {
|
||||||
"type" : "array",
|
"type" : "array",
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
3.0.0-SNAPSHOT
|
3.1.1-SNAPSHOT
|
||||||
@@ -158,7 +158,7 @@ public class Order {
|
|||||||
* Get complete
|
* Get complete
|
||||||
* @return complete
|
* @return complete
|
||||||
**/
|
**/
|
||||||
public Boolean isComplete() {
|
public Boolean getComplete() {
|
||||||
return complete;
|
return complete;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -108,13 +108,14 @@
|
|||||||
"in" : "query",
|
"in" : "query",
|
||||||
"description" : "Status values that need to be considered for filter",
|
"description" : "Status values that need to be considered for filter",
|
||||||
"required" : true,
|
"required" : true,
|
||||||
|
"style" : "form",
|
||||||
"explode" : false,
|
"explode" : false,
|
||||||
"schema" : {
|
"schema" : {
|
||||||
"type" : "array",
|
"type" : "array",
|
||||||
"items" : {
|
"items" : {
|
||||||
"type" : "string",
|
"type" : "string",
|
||||||
"default" : "available",
|
"enum" : [ "available", "pending", "sold" ],
|
||||||
"enum" : [ "available", "pending", "sold" ]
|
"default" : "available"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} ],
|
} ],
|
||||||
@@ -162,6 +163,7 @@
|
|||||||
"in" : "query",
|
"in" : "query",
|
||||||
"description" : "Tags to filter by",
|
"description" : "Tags to filter by",
|
||||||
"required" : true,
|
"required" : true,
|
||||||
|
"style" : "form",
|
||||||
"explode" : false,
|
"explode" : false,
|
||||||
"schema" : {
|
"schema" : {
|
||||||
"type" : "array",
|
"type" : "array",
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
3.0.0-SNAPSHOT
|
3.1.1-SNAPSHOT
|
||||||
@@ -158,7 +158,7 @@ public class Order {
|
|||||||
* Get complete
|
* Get complete
|
||||||
* @return complete
|
* @return complete
|
||||||
**/
|
**/
|
||||||
public Boolean isComplete() {
|
public Boolean getComplete() {
|
||||||
return complete;
|
return complete;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
3.0.0-SNAPSHOT
|
3.1.1-SNAPSHOT
|
||||||
@@ -158,7 +158,7 @@ public class Order {
|
|||||||
* Get complete
|
* Get complete
|
||||||
* @return complete
|
* @return complete
|
||||||
**/
|
**/
|
||||||
public Boolean isComplete() {
|
public Boolean getComplete() {
|
||||||
return complete;
|
return complete;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -108,13 +108,14 @@
|
|||||||
"in" : "query",
|
"in" : "query",
|
||||||
"description" : "Status values that need to be considered for filter",
|
"description" : "Status values that need to be considered for filter",
|
||||||
"required" : true,
|
"required" : true,
|
||||||
|
"style" : "form",
|
||||||
"explode" : false,
|
"explode" : false,
|
||||||
"schema" : {
|
"schema" : {
|
||||||
"type" : "array",
|
"type" : "array",
|
||||||
"items" : {
|
"items" : {
|
||||||
"type" : "string",
|
"type" : "string",
|
||||||
"default" : "available",
|
"enum" : [ "available", "pending", "sold" ],
|
||||||
"enum" : [ "available", "pending", "sold" ]
|
"default" : "available"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} ],
|
} ],
|
||||||
@@ -162,6 +163,7 @@
|
|||||||
"in" : "query",
|
"in" : "query",
|
||||||
"description" : "Tags to filter by",
|
"description" : "Tags to filter by",
|
||||||
"required" : true,
|
"required" : true,
|
||||||
|
"style" : "form",
|
||||||
"explode" : false,
|
"explode" : false,
|
||||||
"schema" : {
|
"schema" : {
|
||||||
"type" : "array",
|
"type" : "array",
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
3.0.0-SNAPSHOT
|
3.1.1-SNAPSHOT
|
||||||
@@ -158,7 +158,7 @@ public class Order {
|
|||||||
* Get complete
|
* Get complete
|
||||||
* @return complete
|
* @return complete
|
||||||
**/
|
**/
|
||||||
public Boolean isComplete() {
|
public Boolean getComplete() {
|
||||||
return complete;
|
return complete;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -108,13 +108,14 @@
|
|||||||
"in" : "query",
|
"in" : "query",
|
||||||
"description" : "Status values that need to be considered for filter",
|
"description" : "Status values that need to be considered for filter",
|
||||||
"required" : true,
|
"required" : true,
|
||||||
|
"style" : "form",
|
||||||
"explode" : false,
|
"explode" : false,
|
||||||
"schema" : {
|
"schema" : {
|
||||||
"type" : "array",
|
"type" : "array",
|
||||||
"items" : {
|
"items" : {
|
||||||
"type" : "string",
|
"type" : "string",
|
||||||
"default" : "available",
|
"enum" : [ "available", "pending", "sold" ],
|
||||||
"enum" : [ "available", "pending", "sold" ]
|
"default" : "available"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} ],
|
} ],
|
||||||
@@ -162,6 +163,7 @@
|
|||||||
"in" : "query",
|
"in" : "query",
|
||||||
"description" : "Tags to filter by",
|
"description" : "Tags to filter by",
|
||||||
"required" : true,
|
"required" : true,
|
||||||
|
"style" : "form",
|
||||||
"explode" : false,
|
"explode" : false,
|
||||||
"schema" : {
|
"schema" : {
|
||||||
"type" : "array",
|
"type" : "array",
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ import javax.validation.constraints.*;
|
|||||||
/**
|
/**
|
||||||
* Animal
|
* Animal
|
||||||
*/
|
*/
|
||||||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true )
|
|
||||||
|
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true)
|
||||||
@JsonSubTypes({
|
@JsonSubTypes({
|
||||||
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
|
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
|
||||||
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
|
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ import javax.validation.constraints.*;
|
|||||||
/**
|
/**
|
||||||
* Animal
|
* Animal
|
||||||
*/
|
*/
|
||||||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true )
|
|
||||||
|
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true)
|
||||||
@JsonSubTypes({
|
@JsonSubTypes({
|
||||||
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
|
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
|
||||||
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
|
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ import javax.validation.constraints.*;
|
|||||||
/**
|
/**
|
||||||
* Animal
|
* Animal
|
||||||
*/
|
*/
|
||||||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true )
|
|
||||||
|
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true)
|
||||||
@JsonSubTypes({
|
@JsonSubTypes({
|
||||||
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
|
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
|
||||||
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
|
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ import javax.validation.constraints.*;
|
|||||||
/**
|
/**
|
||||||
* Animal
|
* Animal
|
||||||
*/
|
*/
|
||||||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true )
|
|
||||||
|
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true)
|
||||||
@JsonSubTypes({
|
@JsonSubTypes({
|
||||||
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
|
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
|
||||||
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
|
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ import javax.validation.constraints.*;
|
|||||||
/**
|
/**
|
||||||
* Animal
|
* Animal
|
||||||
*/
|
*/
|
||||||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true )
|
|
||||||
|
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true)
|
||||||
@JsonSubTypes({
|
@JsonSubTypes({
|
||||||
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
|
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
|
||||||
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
|
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ import javax.validation.constraints.*;
|
|||||||
/**
|
/**
|
||||||
* Animal
|
* Animal
|
||||||
*/
|
*/
|
||||||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true )
|
|
||||||
|
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true)
|
||||||
@JsonSubTypes({
|
@JsonSubTypes({
|
||||||
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
|
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
|
||||||
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
|
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ import javax.validation.constraints.*;
|
|||||||
/**
|
/**
|
||||||
* Animal
|
* Animal
|
||||||
*/
|
*/
|
||||||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true )
|
|
||||||
|
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true)
|
||||||
@JsonSubTypes({
|
@JsonSubTypes({
|
||||||
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
|
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
|
||||||
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
|
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ import javax.validation.constraints.*;
|
|||||||
/**
|
/**
|
||||||
* Animal
|
* Animal
|
||||||
*/
|
*/
|
||||||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true )
|
|
||||||
|
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true)
|
||||||
@JsonSubTypes({
|
@JsonSubTypes({
|
||||||
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
|
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
|
||||||
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
|
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ import javax.validation.constraints.*;
|
|||||||
/**
|
/**
|
||||||
* Animal
|
* Animal
|
||||||
*/
|
*/
|
||||||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true )
|
|
||||||
|
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true)
|
||||||
@JsonSubTypes({
|
@JsonSubTypes({
|
||||||
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
|
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
|
||||||
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
|
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ import javax.validation.constraints.*;
|
|||||||
/**
|
/**
|
||||||
* Animal
|
* Animal
|
||||||
*/
|
*/
|
||||||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true )
|
|
||||||
|
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true)
|
||||||
@JsonSubTypes({
|
@JsonSubTypes({
|
||||||
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
|
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
|
||||||
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
|
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
|
||||||
|
|||||||
Reference in New Issue
Block a user