Prepare version 3.2.0 (#651)

This commit is contained in:
Jérémie Bresson 2018-07-25 20:27:16 +02:00 committed by GitHub
commit 60c81eae0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
507 changed files with 2515 additions and 1664 deletions

View File

@ -2,7 +2,7 @@
- [ ] Read the [contribution guidelines](https://github.com/openapitools/openapi-generator/blob/master/CONTRIBUTING.md).
- [ ] Ran the shell script under `./bin/` to update Petstore sample so that CIs can verify the change. (For instance, only need to run `./bin/{LANG}-petstore.sh` and `./bin/security/{LANG}-petstore.sh` if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in `.\bin\windows\`.
- [ ] Filed the PR against the [correct branch](https://github.com/OpenAPITools/openapi-generator/wiki/Git-Branches): `master`, `3.2.x`, `4.0.x`. Default: `master`.
- [ ] Filed the PR against the [correct branch](https://github.com/OpenAPITools/openapi-generator/wiki/Git-Branches): `master`, `4.0.x`. Default: `master`.
- [ ] Copied the [technical committee](https://github.com/openapitools/openapi-generator/#62---openapi-generator-technical-committee) to review the pull request if your PR is targeting a particular programming language.
### Description of the PR

View File

@ -123,7 +123,7 @@ after_success:
./gradlew -Psigning.keyId="$SIGNING_KEY" -Psigning.password="$SIGNING_PASSPHRASE" -Psigning.secretKeyRingFile="${TRAVIS_BUILD_DIR}/sec.gpg" -PossrhUsername="${SONATYPE_USERNAME}" -PossrhPassword="${SONATYPE_PASSWORD}" uploadArchives --no-daemon;
echo "Finished ./gradlew uploadArchives";
popd;
elif ([ "$TRAVIS_BRANCH" == "3.1.x" ] || [ "$TRAVIS_BRANCH" == "4.0.x" ]) ; then
elif ([ "$TRAVIS_BRANCH" == "4.0.x" ]) ; then
mvn clean deploy --settings CI/settings.xml;
echo "Finished mvn clean deploy for $TRAVIS_BRANCH";
pushd .;

View File

@ -9,7 +9,7 @@
<artifactId>openapi-generator-project</artifactId>
<packaging>pom</packaging>
<name>openapi-generator-project</name>
<version>3.1.2</version>
<version>3.2.0-SNAPSHOT</version>
<url>https://github.com/openapi-tools/openapi-generator</url>
<scm>
<connection>scm:git:git@github.com:openapi-tools/openapi-generator.git</connection>

View File

@ -10,7 +10,7 @@
<artifactId>openapi-generator-project</artifactId>
<packaging>pom</packaging>
<name>openapi-generator-project</name>
<version>3.1.2</version>
<version>3.2.0-SNAPSHOT</version>
<url>https://github.com/openapitools/openapi-generator</url>
<scm>
<connection>scm:git:git@github.com:openapitools/openapi-generator.git</connection>

View File

@ -10,7 +10,7 @@
<artifactId>openapi-generator-project</artifactId>
<packaging>pom</packaging>
<name>openapi-generator-project</name>
<version>3.1.2</version>
<version>3.2.0-SNAPSHOT</version>
<url>https://github.com/openapitools/openapi-generator</url>
<scm>
<connection>scm:git:git@github.com:openapitools/openapi-generator.git</connection>

View File

@ -9,7 +9,7 @@
<artifactId>openapi-generator-project</artifactId>
<packaging>pom</packaging>
<name>openapi-generator-project</name>
<version>3.1.2</version>
<version>3.2.0-SNAPSHOT</version>
<url>https://github.com/openapitools/openapi-generator</url>
<scm>
<connection>scm:git:git@github.com:openapitools/openapi-generator.git</connection>

View File

@ -2,16 +2,11 @@
<div align="center">
[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`3.1.2`): [![Build Status](https://img.shields.io/travis/OpenAPITools/openapi-generator/master.svg?label=Integration%20Test)](https://travis-ci.org/OpenAPITools/openapi-generator)
[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`3.2.0`): [![Build Status](https://img.shields.io/travis/OpenAPITools/openapi-generator/master.svg?label=Integration%20Test)](https://travis-ci.org/OpenAPITools/openapi-generator)
[![Integration Test2](https://circleci.com/gh/OpenAPITools/openapi-generator.svg?style=shield)](https://circleci.com/gh/OpenAPITools/openapi-generator)
[![Run Status](https://api.shippable.com/projects/5af6bf74e790f4070084a115/badge?branch=master)](https://app.shippable.com/github/OpenAPITools/openapi-generator)
[![Windows Test](https://ci.appveyor.com/api/projects/status/github/openapitools/openapi-generator?branch=master&svg=true&passingText=Windows%20Test%20-%20OK&failingText=Windows%20Test%20-%20Fails)](https://ci.appveyor.com/project/WilliamCheng/openapi-generator-wh2wu)
[`3.2.x`](https://github.com/OpenAPITools/openapi-generator/tree/3.2.x) branch: [![Build Status](https://img.shields.io/travis/OpenAPITools/openapi-generator/3.2.x.svg?label=Integration%20Test)](https://travis-ci.org/OpenAPITools/openapi-generator)
[![Integration Test2](https://circleci.com/gh/OpenAPITools/openapi-generator/tree/3.2.x.svg?style=shield)](https://circleci.com/gh/OpenAPITools/openapi-generator)
[![Run Status](https://api.shippable.com/projects/5af6bf74e790f4070084a115/badge?branch=3.2.x)](https://app.shippable.com/github/OpenAPITools/openapi-generator)
[![Windows Test](https://ci.appveyor.com/api/projects/status/github/openapitools/openapi-generator?branch=3.2.x&svg=true&passingText=Windows%20Test%20-%20OK&failingText=Windows%20Test%20-%20Fails)](https://ci.appveyor.com/project/WilliamCheng/openapi-generator-wh2wu)
[`4.0.x`](https://github.com/OpenAPITools/openapi-generator/tree/4.0.x) branch: [![Build Status](https://img.shields.io/travis/OpenAPITools/openapi-generator/4.0.x.svg?label=Integration%20Test)](https://travis-ci.org/OpenAPITools/openapi-generator)
[![Integration Test2](https://circleci.com/gh/OpenAPITools/openapi-generator/tree/4.0.x.svg?style=shield)](https://circleci.com/gh/OpenAPITools/openapi-generator)
[![Run Status](https://api.shippable.com/projects/5af6bf74e790f4070084a115/badge?branch=4.0.x)](https://app.shippable.com/github/OpenAPITools/openapi-generator)
@ -88,7 +83,7 @@ The OpenAPI Specification has undergone 3 revisions since initial creation in 20
OpenAPI Generator Version | Release Date | OpenAPI Spec compatibility | Notes
---------------------------- | ------------ | -------------------------- | -----
4.0.0 (upcoming major release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/4.0.0-SNAPSHOT/)| TBD | 1.0, 1.1, 1.2, 2.0, 3.0 | Major release with breaking changes (no fallback)
3.2.0 (upcoming minor release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/3.2.0-SNAPSHOT/)| TBD | 1.0, 1.1, 1.2, 2.0, 3.0 | Minor release with breaking changes (with fallbacks)
3.2.0 (current master, upcoming minor release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/3.2.0-SNAPSHOT/)| TBD | 1.0, 1.1, 1.2, 2.0, 3.0 | Minor release with breaking changes (with fallbacks)
[3.1.2](https://github.com/OpenAPITools/openapi-generator/releases/tag/v3.1.2) | 25.07.2018 | 1.0, 1.1, 1.2, 2.0, 3.0 | Bugfix release
[3.1.1](https://github.com/OpenAPITools/openapi-generator/releases/tag/v3.1.1) | 18.07.2018 | 1.0, 1.1, 1.2, 2.0, 3.0 | Bugfix release
[3.1.0](https://github.com/OpenAPITools/openapi-generator/releases/tag/v3.1.0) | 06.07.2018 | 1.0, 1.1, 1.2, 2.0, 3.0 | Minor release with breaking changes (with fallbacks)

View File

@ -11,6 +11,20 @@ Another approach to find breaking changes is to look at issue and pull requests
* link:https://github.com/OpenAPITools/openapi-generator/labels/Breaking%20change%20%28with%20fallback%29[Breaking change (with fallback)]
* link:https://github.com/OpenAPITools/openapi-generator/labels/Breaking%20change%20%28without%20fallback%29[Breaking change (without fallback)]
=== From 3.1.x to 3.2.0
Version `3.2.0` is a minor version of OpenAPI-Generator, in comparison to `3.1.x` it contains some breaking changes, but with the possibility to fallback to the old behavior.
The default value of some options might change.
Projects relying on generated code might need to be adapted.
==== Model (all languages)
In `CodegenModel` and in `CodegenOperation` we use now our own class `org.openapitools.codegen.CodegenDiscriminator` instead of `io.swagger.v3.oas.models.media.Discriminator`.
For the templates, this is not an API change, because the same values are available.
If you have your own `Codegen` class (to support your own generator for example) then you might get some compile error due to the change.
=== From 3.0.x to 3.1.0
Version `3.1.0` is the first minor version of OpenAPI-Generator, in comparison to `3.0.3` it contains some breaking changes, but with the possibility to fallback to the old behavior.

View File

@ -3,7 +3,7 @@
<parent>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-project</artifactId>
<version>3.1.2</version>
<version>3.2.0-SNAPSHOT</version>
<relativePath>../..</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -1,4 +1,4 @@
openApiGeneratorVersion=3.1.2
openApiGeneratorVersion=3.2.0-SNAPSHOT
# BEGIN placeholders
# these are just placeholders to allow contributors to build directly

View File

@ -3,7 +3,7 @@
<parent>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-project</artifactId>
<version>3.1.2</version>
<version>3.2.0-SNAPSHOT</version>
<relativePath>../..</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-project</artifactId>
<version>3.1.2</version>
<version>3.2.0-SNAPSHOT</version>
<relativePath>../..</relativePath>
</parent>
<artifactId>openapi-generator-maven-plugin</artifactId>

View File

@ -2,7 +2,7 @@ FROM openjdk:8-jre-alpine
WORKDIR /generator
COPY target/openapi-generator-online-3.1.2.jar /generator/openapi-generator-online.jar
COPY target/openapi-generator-online-3.2.0-SNAPSHOT.jar /generator/openapi-generator-online.jar
ENV GENERATOR_HOST=http://localhost

View File

@ -3,7 +3,7 @@
<parent>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-project</artifactId>
<version>3.1.2</version>
<version>3.2.0-SNAPSHOT</version>
<relativePath>../..</relativePath>
</parent>
<artifactId>openapi-generator-online</artifactId>

View File

@ -3,7 +3,7 @@
<parent>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-project</artifactId>
<version>3.1.2</version>
<version>3.2.0-SNAPSHOT</version>
<relativePath>../..</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -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);
}
}

View File

@ -18,15 +18,14 @@
package org.openapitools.codegen;
import io.swagger.v3.oas.models.ExternalDocumentation;
import io.swagger.v3.oas.models.media.Discriminator;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.TreeSet;
import java.util.Objects;
public class CodegenModel {
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 classFilename; // store the class file name, mainly used for import
public String unescapedDescription;
public Discriminator discriminator;
public CodegenDiscriminator discriminator;
public String defaultValue;
public String arrayModelType;
public boolean isAlias; // Is this effectively an alias of another simple type
@ -349,7 +348,7 @@ public class CodegenModel {
this.unescapedDescription = unescapedDescription;
}
public Discriminator getDiscriminator() {
public CodegenDiscriminator getDiscriminator() {
return discriminator;
}
@ -357,7 +356,7 @@ public class CodegenModel {
return discriminator == null ? null : discriminator.getPropertyName();
}
public void setDiscriminator(Discriminator discriminator) {
public void setDiscriminator(CodegenDiscriminator discriminator) {
this.discriminator = discriminator;
}

View File

@ -18,17 +18,15 @@
package org.openapitools.codegen;
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 java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Arrays;
public class CodegenOperation {
public final List<CodegenProperty> responseHeaders = new ArrayList<CodegenProperty>();
@ -40,7 +38,7 @@ public class CodegenOperation {
isRestful, isDeprecated;
public String path, operationId, returnType, httpMethod, returnBaseType,
returnContainer, summary, unescapedNotes, notes, baseName, defaultResponse;
public Discriminator discriminator;
public CodegenDiscriminator discriminator;
public List<Map<String, String>> consumes, produces, prioritizedContentTypes;
public CodegenParameter bodyParam;
public List<CodegenParameter> allParams = new ArrayList<CodegenParameter>();

View File

@ -26,7 +26,12 @@ import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.Operation;
import io.swagger.v3.oas.models.examples.Example;
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.HeaderParameter;
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.StringEscapeUtils;
import org.apache.commons.lang3.StringUtils;
import org.openapitools.codegen.CodegenDiscriminator.MappedModel;
import org.openapitools.codegen.examples.ExampleGenerator;
import org.openapitools.codegen.serializer.SerializerUtils;
import org.openapitools.codegen.utils.ModelUtils;
@ -66,6 +72,7 @@ import java.util.TreeSet;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class DefaultCodegen implements CodegenConfig {
private static final Logger LOGGER = LoggerFactory.getLogger(DefaultCodegen.class);
@ -1506,6 +1513,10 @@ public class DefaultCodegen implements CodegenConfig {
// unalias schema
schema = ModelUtils.unaliasSchema(allDefinitions, schema);
if (schema == null) {
LOGGER.warn("Schema {} not found", name);
return null;
}
CodegenModel m = CodegenModelFactory.newInstance(CodegenModelType.MODEL);
@ -1526,7 +1537,7 @@ public class DefaultCodegen implements CodegenConfig {
m.getVendorExtensions().putAll(schema.getExtensions());
}
m.isAlias = typeAliases.containsKey(name);
m.discriminator = schema.getDiscriminator();
m.discriminator = createDiscriminator(name, schema, allDefinitions);
if (schema.getXml() != null) {
m.xmlPrefix = schema.getXml().getPrefix();
@ -1553,7 +1564,7 @@ public class DefaultCodegen implements CodegenConfig {
int modelImplCnt = 0; // only one inline object allowed in a ComposedModel
for (Schema innerModel : composed.getAllOf()) {
if (m.discriminator == null) {
m.discriminator = schema.getDiscriminator();
m.discriminator = createDiscriminator(name, schema, allDefinitions);
}
if (innerModel.getXml() != null) {
m.xmlPrefix = innerModel.getXml().getPrefix();
@ -1668,6 +1679,34 @@ public class DefaultCodegen implements CodegenConfig {
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) {
addParentContainer(codegenModel, codegenModel.name, schema);
}

View File

@ -43,7 +43,7 @@ import java.util.Set;
public class CppPistacheServerCodegen extends AbstractCppCodegen {
protected String implFolder = "impl";
protected boolean isAddExternalLibs = false;
protected boolean isAddExternalLibs = true;
public static final String OPTIONAL_EXTERNAL_LIB = "addExternalLibs";
public static final String OPTIONAL_EXTERNAL_LIB_DESC = "Add the Possibility to fetch and compile external Libraries needed by this Framework.";
@Override

View File

@ -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
public Map<String, Object> postProcessModelsEnum(Map<String, Object> objs) {
objs = super.postProcessModelsEnum(objs);
@ -564,34 +545,6 @@ public class JavaClientCodegen extends AbstractJavaCodegen
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) {
this.useRxJava = useRxJava;
doNotUseRx = false;

View File

@ -60,21 +60,20 @@ public class JSON {
public static GsonBuilder createGson() {
GsonFireBuilder fireBuilder = new GsonFireBuilder()
{{#parent}}
.registerTypeSelector({{classname}}.class, new TypeSelector() {
{{#models}}{{#model}}{{#discriminator}} .registerTypeSelector({{classname}}.class, new TypeSelector() {
@Override
public Class getClassForElement(JsonElement readElement) {
Map classByDiscriminatorValue = new HashMap();
{{#children}}
classByDiscriminatorValue.put("{{name}}".toUpperCase(), {{classname}}.class);
{{/children}}
{{#mappedModels}}
classByDiscriminatorValue.put("{{mappingName}}".toUpperCase(), {{modelName}}.class);
{{/mappedModels}}
classByDiscriminatorValue.put("{{classname}}".toUpperCase(), {{classname}}.class);
return getClassByDiscriminator(
classByDiscriminatorValue,
getDiscriminatorValue(readElement, "{{{discriminatorName}}}"));
getDiscriminatorValue(readElement, "{{{propertyName}}}"));
}
})
{{/parent}}
{{/discriminator}}{{/model}}{{/models}}
;
GsonBuilder builder = fireBuilder.createGsonBuilder();
{{#disableHtmlEscaping}}

View File

@ -57,21 +57,20 @@ public class JSON {
public static GsonBuilder createGson() {
GsonFireBuilder fireBuilder = new GsonFireBuilder()
{{#parent}}
.registerTypeSelector({{classname}}.class, new TypeSelector() {
{{#models}}{{#model}}{{#discriminator}} .registerTypeSelector({{classname}}.class, new TypeSelector() {
@Override
public Class getClassForElement(JsonElement readElement) {
Map classByDiscriminatorValue = new HashMap();
{{#children}}
classByDiscriminatorValue.put("{{name}}".toUpperCase(), {{classname}}.class);
{{/children}}
{{#mappedModels}}
classByDiscriminatorValue.put("{{mappingName}}".toUpperCase(), {{modelName}}.class);
{{/mappedModels}}
classByDiscriminatorValue.put("{{classname}}".toUpperCase(), {{classname}}.class);
return getClassByDiscriminator(
classByDiscriminatorValue,
getDiscriminatorValue(readElement, "{{{discriminatorName}}}"));
getDiscriminatorValue(readElement, "{{{propertyName}}}"));
}
})
{{/parent}}
{{/discriminator}}{{/model}}{{/models}}
;
return fireBuilder.createGsonBuilder();
}

View File

@ -1,7 +1,8 @@
{{#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({
{{#children}}
@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}}"),
{{/children}}
{{#discriminator.mappedModels}}
@JsonSubTypes.Type(value = {{modelName}}.class, name = "{{^vendorExtensions.x-discriminator-value}}{{mappingName}}{{/vendorExtensions.x-discriminator-value}}{{#vendorExtensions.x-discriminator-value}}{{{vendorExtensions.x-discriminator-value}}}{{/vendorExtensions.x-discriminator-value}}"),
{{/discriminator.mappedModels}}
}){{/jackson}}

View File

@ -1,7 +1,8 @@
{{#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({
{{#children}}
@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}}"),
{{/children}}
{{#discriminator.mappedModels}}
@JsonSubTypes.Type(value = {{modelName}}.class, name = "{{^vendorExtensions.x-discriminator-value}}{{mappingName}}{{/vendorExtensions.x-discriminator-value}}{{#vendorExtensions.x-discriminator-value}}{{{vendorExtensions.x-discriminator-value}}}{{/vendorExtensions.x-discriminator-value}}"),
{{/discriminator.mappedModels}}
}){{/jackson}}

View File

@ -1,7 +1,8 @@
{{#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({
{{#children}}
@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}}"),
{{/children}}
{{#discriminator.mappedModels}}
@JsonSubTypes.Type(value = {{modelName}}.class, name = "{{^vendorExtensions.x-discriminator-value}}{{mappingName}}{{/vendorExtensions.x-discriminator-value}}{{#vendorExtensions.x-discriminator-value}}{{{vendorExtensions.x-discriminator-value}}}{{/vendorExtensions.x-discriminator-value}}"),
{{/discriminator.mappedModels}}
}){{/jackson}}

View File

@ -1,7 +1,8 @@
{{#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({
{{#children}}
@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}}"),
{{/children}}
{{#discriminator.mappedModels}}
@JsonSubTypes.Type(value = {{modelName}}.class, name = "{{^vendorExtensions.x-discriminator-value}}{{mappingName}}{{/vendorExtensions.x-discriminator-value}}{{#vendorExtensions.x-discriminator-value}}{{{vendorExtensions.x-discriminator-value}}}{{/vendorExtensions.x-discriminator-value}}"),
{{/discriminator.mappedModels}}
}){{/jackson}}

View File

@ -1,7 +1,8 @@
{{#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({
{{#children}}
@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}}"),
{{/children}}
{{#discriminator.mappedModels}}
@JsonSubTypes.Type(value = {{modelName}}.class, name = "{{^vendorExtensions.x-discriminator-value}}{{mappingName}}{{/vendorExtensions.x-discriminator-value}}{{#vendorExtensions.x-discriminator-value}}{{{vendorExtensions.x-discriminator-value}}}{{/vendorExtensions.x-discriminator-value}}"),
{{/discriminator.mappedModels}}
}){{/jackson}}

View File

@ -1,7 +1,8 @@
{{#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({
{{#children}}
@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}}"),
{{/children}}
{{#discriminator.mappedModels}}
@JsonSubTypes.Type(value = {{modelName}}.class, name = "{{^vendorExtensions.x-discriminator-value}}{{mappingName}}{{/vendorExtensions.x-discriminator-value}}{{#vendorExtensions.x-discriminator-value}}{{{vendorExtensions.x-discriminator-value}}}{{/vendorExtensions.x-discriminator-value}}"),
{{/discriminator.mappedModels}}
}){{/jackson}}

View File

@ -33,16 +33,16 @@ class {{classname}}(object):
{{{notes}}} # noqa: E501
{{/notes}}
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
asynchronous HTTP request, please pass async_req=True
{{#sortParamsByRequiredFlag}}
>>> thread = api.{{operationId}}({{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}async=True)
>>> thread = api.{{operationId}}({{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}async_req=True)
{{/sortParamsByRequiredFlag}}
{{^sortParamsByRequiredFlag}}
>>> thread = api.{{operationId}}({{#allParams}}{{#required}}{{paramName}}={{paramName}}_value, {{/required}}{{/allParams}}async=True)
>>> thread = api.{{operationId}}({{#allParams}}{{#required}}{{paramName}}={{paramName}}_value, {{/required}}{{/allParams}}async_req=True)
{{/sortParamsByRequiredFlag}}
>>> result = thread.get()
:param async bool
:param async_req bool
{{#allParams}}
:param {{dataType}} {{paramName}}:{{#description}} {{{description}}}{{/description}}{{#required}} (required){{/required}}{{#optional}}(optional){{/optional}}
{{/allParams}}
@ -51,7 +51,7 @@ class {{classname}}(object):
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async'):
if kwargs.get('async_req'):
return self.{{operationId}}_with_http_info({{#sortParamsByRequiredFlag}}{{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}{{/sortParamsByRequiredFlag}}**kwargs) # noqa: E501
else:
(data) = self.{{operationId}}_with_http_info({{#sortParamsByRequiredFlag}}{{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}{{/sortParamsByRequiredFlag}}**kwargs) # noqa: E501
@ -64,16 +64,16 @@ class {{classname}}(object):
{{{notes}}} # noqa: E501
{{/notes}}
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
asynchronous HTTP request, please pass async_req=True
{{#sortParamsByRequiredFlag}}
>>> thread = api.{{operationId}}_with_http_info({{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}async=True)
>>> thread = api.{{operationId}}_with_http_info({{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}async_req=True)
{{/sortParamsByRequiredFlag}}
{{^sortParamsByRequiredFlag}}
>>> thread = api.{{operationId}}_with_http_info({{#allParams}}{{#required}}{{paramName}}={{paramName}}_value, {{/required}}{{/allParams}}async=True)
>>> thread = api.{{operationId}}_with_http_info({{#allParams}}{{#required}}{{paramName}}={{paramName}}_value, {{/required}}{{/allParams}}async_req=True)
{{/sortParamsByRequiredFlag}}
>>> result = thread.get()
:param async bool
:param async_req bool
{{#allParams}}
:param {{dataType}} {{paramName}}:{{#description}} {{{description}}}{{/description}}{{#required}} (required){{/required}}{{#optional}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/optional}}
{{/allParams}}
@ -85,7 +85,7 @@ class {{classname}}(object):
local_var_params = locals()
all_params = [{{#allParams}}'{{paramName}}'{{#hasMore}}, {{/hasMore}}{{/allParams}}] # noqa: E501
all_params.append('async')
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
@ -206,7 +206,7 @@ class {{classname}}(object):
files=local_var_files,
response_type={{#returnType}}'{{returnType}}'{{/returnType}}{{^returnType}}None{{/returnType}}, # noqa: E501
auth_settings=auth_settings,
async=local_var_params.get('async'),
async_req=local_var_params.get('async_req'),
_return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
_preload_content=local_var_params.get('_preload_content', True),
_request_timeout=local_var_params.get('_request_timeout'),

View File

@ -280,12 +280,12 @@ class ApiClient(object):
def call_api(self, resource_path, method,
path_params=None, query_params=None, header_params=None,
body=None, post_params=None, files=None,
response_type=None, auth_settings=None, async=None,
response_type=None, auth_settings=None, async_req=None,
_return_http_data_only=None, collection_formats=None,
_preload_content=True, _request_timeout=None):
"""Makes the HTTP request (synchronous) and returns deserialized data.
To make an async request, set the async parameter.
To make an async_req request, set the async_req parameter.
:param resource_path: Path to method endpoint.
:param method: Method to call.
@ -300,7 +300,7 @@ class ApiClient(object):
:param response: Response data type.
:param files dict: key -> filename, value -> filepath,
for `multipart/form-data`.
:param async bool: execute request asynchronously
:param async_req bool: execute request asynchronously
:param _return_http_data_only: response data without head status code
and headers
:param collection_formats: dict of collection formats for path, query,
@ -313,13 +313,13 @@ class ApiClient(object):
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:return:
If async parameter is True,
If async_req parameter is True,
the request will be called asynchronously.
The method will return the request thread.
If parameter async is False or missing,
If parameter async_req is False or missing,
then the method will return the response directly.
"""
if not async:
if not async_req:
return self.__call_api(resource_path, method,
path_params, query_params, header_params,
body, post_params, files,

View File

@ -356,6 +356,47 @@ public class DefaultCodegenTest {
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() {
CodegenProperty array = new CodegenProperty();
final CodegenProperty items = new CodegenProperty();

View File

@ -64,111 +64,6 @@ import java.util.stream.Collectors;
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
public void arraysInRequestBody() throws Exception {
final JavaClientCodegen codegen = new JavaClientCodegen();

View 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

View File

@ -9,7 +9,7 @@
<artifactId>openapi-generator-project</artifactId>
<packaging>pom</packaging>
<name>openapi-generator-project</name>
<version>3.1.2</version>
<version>3.2.0-SNAPSHOT</version>
<url>https://github.com/openapitools/openapi-generator</url>
<scm>
<connection>scm:git:git@github.com:openapitools/openapi-generator.git</connection>

View File

@ -1 +1 @@
3.1.2-SNAPSHOT
3.2.0-SNAPSHOT

View File

@ -26,7 +26,8 @@ import io.swagger.annotations.ApiModelProperty;
/**
* 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.Type(value = Dog.class, name = "Dog"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),

View File

@ -1 +1 @@
3.1.2-SNAPSHOT
3.2.0-SNAPSHOT

View File

@ -26,7 +26,8 @@ import io.swagger.annotations.ApiModelProperty;
/**
* 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.Type(value = Dog.class, name = "Dog"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),

View File

@ -1 +1 @@
3.1.2-SNAPSHOT
3.2.0-SNAPSHOT

View File

@ -26,7 +26,8 @@ import io.swagger.annotations.ApiModelProperty;
/**
* 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.Type(value = Dog.class, name = "Dog"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),

View File

@ -1 +1 @@
3.1.2-SNAPSHOT
3.2.0-SNAPSHOT

View File

@ -25,7 +25,8 @@ import io.swagger.annotations.ApiModelProperty;
/**
* 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.Type(value = Dog.class, name = "Dog"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),

View File

@ -1 +1 @@
3.1.2-SNAPSHOT
3.2.0-SNAPSHOT

View File

@ -26,7 +26,8 @@ import io.swagger.annotations.ApiModelProperty;
/**
* 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.Type(value = Dog.class, name = "Dog"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),

View File

@ -1 +1 @@
3.1.2-SNAPSHOT
3.2.0-SNAPSHOT

View File

@ -26,7 +26,8 @@ import io.swagger.annotations.ApiModelProperty;
/**
* 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.Type(value = Dog.class, name = "Dog"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),

View File

@ -1 +1 @@
3.1.2-SNAPSHOT
3.2.0-SNAPSHOT

View File

@ -55,14 +55,15 @@ public class JSON {
@Override
public Class getClassForElement(JsonElement readElement) {
Map classByDiscriminatorValue = new HashMap();
classByDiscriminatorValue.put("Cat".toUpperCase(), Cat.class);
classByDiscriminatorValue.put("Dog".toUpperCase(), Dog.class);
classByDiscriminatorValue.put("Cat".toUpperCase(), Cat.class);
classByDiscriminatorValue.put("Animal".toUpperCase(), Animal.class);
return getClassByDiscriminator(
classByDiscriminatorValue,
getDiscriminatorValue(readElement, ""));
getDiscriminatorValue(readElement, "className"));
}
})
;
GsonBuilder builder = fireBuilder.createGsonBuilder();
return builder;

View File

@ -1 +1 @@
3.1.2-SNAPSHOT
3.2.0-SNAPSHOT

View File

@ -55,14 +55,15 @@ public class JSON {
@Override
public Class getClassForElement(JsonElement readElement) {
Map classByDiscriminatorValue = new HashMap();
classByDiscriminatorValue.put("Cat".toUpperCase(), Cat.class);
classByDiscriminatorValue.put("Dog".toUpperCase(), Dog.class);
classByDiscriminatorValue.put("Cat".toUpperCase(), Cat.class);
classByDiscriminatorValue.put("Animal".toUpperCase(), Animal.class);
return getClassByDiscriminator(
classByDiscriminatorValue,
getDiscriminatorValue(readElement, ""));
getDiscriminatorValue(readElement, "className"));
}
})
;
GsonBuilder builder = fireBuilder.createGsonBuilder();
return builder;

View File

@ -1 +1 @@
3.1.2-SNAPSHOT
3.2.0-SNAPSHOT

View File

@ -55,14 +55,15 @@ public class JSON {
@Override
public Class getClassForElement(JsonElement readElement) {
Map classByDiscriminatorValue = new HashMap();
classByDiscriminatorValue.put("Cat".toUpperCase(), Cat.class);
classByDiscriminatorValue.put("Dog".toUpperCase(), Dog.class);
classByDiscriminatorValue.put("Cat".toUpperCase(), Cat.class);
classByDiscriminatorValue.put("Animal".toUpperCase(), Animal.class);
return getClassByDiscriminator(
classByDiscriminatorValue,
getDiscriminatorValue(readElement, ""));
getDiscriminatorValue(readElement, "className"));
}
})
;
GsonBuilder builder = fireBuilder.createGsonBuilder();
return builder;

View File

@ -1 +1 @@
3.1.2-SNAPSHOT
3.2.0-SNAPSHOT

View File

@ -26,7 +26,8 @@ import io.swagger.annotations.ApiModelProperty;
/**
* 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.Type(value = Dog.class, name = "Dog"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),

View File

@ -1 +1 @@
3.1.2-SNAPSHOT
3.2.0-SNAPSHOT

View File

@ -28,7 +28,8 @@ import javax.xml.bind.annotation.*;
/**
* 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.Type(value = Dog.class, name = "Dog"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),

View File

@ -1 +1 @@
3.1.2-SNAPSHOT
3.2.0-SNAPSHOT

View File

@ -26,7 +26,8 @@ import io.swagger.annotations.ApiModelProperty;
/**
* 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.Type(value = Dog.class, name = "Dog"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),

View File

@ -1 +1 @@
3.1.2-SNAPSHOT
3.2.0-SNAPSHOT

View File

@ -1 +1 @@
3.1.2-SNAPSHOT
3.2.0-SNAPSHOT

View File

@ -28,7 +28,8 @@ import javax.validation.Valid;
/**
* 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.Type(value = Dog.class, name = "Dog"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),

View File

@ -1 +1 @@
3.1.2-SNAPSHOT
3.2.0-SNAPSHOT

View File

@ -28,7 +28,8 @@ import javax.validation.Valid;
/**
* 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.Type(value = Dog.class, name = "Dog"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),

View File

@ -1 +1 @@
3.1.2-SNAPSHOT
3.2.0-SNAPSHOT

View File

@ -52,14 +52,15 @@ public class JSON {
@Override
public Class getClassForElement(JsonElement readElement) {
Map classByDiscriminatorValue = new HashMap();
classByDiscriminatorValue.put("Cat".toUpperCase(), Cat.class);
classByDiscriminatorValue.put("Dog".toUpperCase(), Dog.class);
classByDiscriminatorValue.put("Cat".toUpperCase(), Cat.class);
classByDiscriminatorValue.put("Animal".toUpperCase(), Animal.class);
return getClassByDiscriminator(
classByDiscriminatorValue,
getDiscriminatorValue(readElement, ""));
getDiscriminatorValue(readElement, "className"));
}
})
;
return fireBuilder.createGsonBuilder();
}

View File

@ -1 +1 @@
3.1.2-SNAPSHOT
3.2.0-SNAPSHOT

View File

@ -52,14 +52,15 @@ public class JSON {
@Override
public Class getClassForElement(JsonElement readElement) {
Map classByDiscriminatorValue = new HashMap();
classByDiscriminatorValue.put("Cat".toUpperCase(), Cat.class);
classByDiscriminatorValue.put("Dog".toUpperCase(), Dog.class);
classByDiscriminatorValue.put("Cat".toUpperCase(), Cat.class);
classByDiscriminatorValue.put("Animal".toUpperCase(), Animal.class);
return getClassByDiscriminator(
classByDiscriminatorValue,
getDiscriminatorValue(readElement, ""));
getDiscriminatorValue(readElement, "className"));
}
})
;
return fireBuilder.createGsonBuilder();
}

View File

@ -1 +1 @@
3.1.2-SNAPSHOT
3.2.0-SNAPSHOT

View File

@ -52,14 +52,15 @@ public class JSON {
@Override
public Class getClassForElement(JsonElement readElement) {
Map classByDiscriminatorValue = new HashMap();
classByDiscriminatorValue.put("Cat".toUpperCase(), Cat.class);
classByDiscriminatorValue.put("Dog".toUpperCase(), Dog.class);
classByDiscriminatorValue.put("Cat".toUpperCase(), Cat.class);
classByDiscriminatorValue.put("Animal".toUpperCase(), Animal.class);
return getClassByDiscriminator(
classByDiscriminatorValue,
getDiscriminatorValue(readElement, ""));
getDiscriminatorValue(readElement, "className"));
}
})
;
return fireBuilder.createGsonBuilder();
}

View File

@ -1 +1 @@
3.1.2-SNAPSHOT
3.2.0-SNAPSHOT

View File

@ -26,7 +26,8 @@ import io.swagger.annotations.ApiModelProperty;
/**
* 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.Type(value = Dog.class, name = "Dog"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),

View File

@ -1 +1 @@
3.1.2-SNAPSHOT
3.2.0-SNAPSHOT

View File

@ -26,7 +26,8 @@ import io.swagger.annotations.ApiModelProperty;
/**
* 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.Type(value = Dog.class, name = "Dog"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),

View File

@ -1 +1 @@
3.1.2-SNAPSHOT
3.2.0-SNAPSHOT

View File

@ -1 +1 @@
3.1.2-SNAPSHOT
3.2.0-SNAPSHOT

View File

@ -1 +1 @@
3.1.2-SNAPSHOT
3.2.0-SNAPSHOT

View File

@ -1 +1 @@
3.1.2-SNAPSHOT
3.2.0-SNAPSHOT

View File

@ -17,7 +17,7 @@
* OpenAPI spec version: 1.0.0
*
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 3.1.2-SNAPSHOT
* OpenAPI Generator version: 3.2.0-SNAPSHOT
*/
/**

View File

@ -17,7 +17,7 @@
* OpenAPI spec version: 1.0.0
*
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 3.1.2-SNAPSHOT
* OpenAPI Generator version: 3.2.0-SNAPSHOT
*/
/**

View File

@ -17,7 +17,7 @@
* OpenAPI spec version: 1.0.0
*
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 3.1.2-SNAPSHOT
* OpenAPI Generator version: 3.2.0-SNAPSHOT
*/
/**

View File

@ -17,7 +17,7 @@
* OpenAPI spec version: 1.0.0
*
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 3.1.2-SNAPSHOT
* OpenAPI Generator version: 3.2.0-SNAPSHOT
*/
/**

View File

@ -17,7 +17,7 @@
* OpenAPI spec version: 1.0.0
*
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 3.1.2-SNAPSHOT
* OpenAPI Generator version: 3.2.0-SNAPSHOT
*/
/**

View File

@ -17,7 +17,7 @@
* OpenAPI spec version: 1.0.0
*
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 3.1.2-SNAPSHOT
* OpenAPI Generator version: 3.2.0-SNAPSHOT
*/
/**

View File

@ -17,7 +17,7 @@
* OpenAPI spec version: 1.0.0
*
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 3.1.2-SNAPSHOT
* OpenAPI Generator version: 3.2.0-SNAPSHOT
*/
/**

View File

@ -17,7 +17,7 @@
* OpenAPI spec version: 1.0.0
*
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 3.1.2-SNAPSHOT
* OpenAPI Generator version: 3.2.0-SNAPSHOT
*/
/**

View File

@ -17,7 +17,7 @@
* OpenAPI spec version: 1.0.0
*
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 3.1.2-SNAPSHOT
* OpenAPI Generator version: 3.2.0-SNAPSHOT
*/
/**

View File

@ -18,7 +18,7 @@
* OpenAPI spec version: 1.0.0
*
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 3.1.2-SNAPSHOT
* OpenAPI Generator version: 3.2.0-SNAPSHOT
*/
/**

View File

@ -18,7 +18,7 @@
* OpenAPI spec version: 1.0.0
*
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 3.1.2-SNAPSHOT
* OpenAPI Generator version: 3.2.0-SNAPSHOT
*/
/**

View File

@ -18,7 +18,7 @@
* OpenAPI spec version: 1.0.0
*
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 3.1.2-SNAPSHOT
* OpenAPI Generator version: 3.2.0-SNAPSHOT
*/
/**

View File

@ -18,7 +18,7 @@
* OpenAPI spec version: 1.0.0
*
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 3.1.2-SNAPSHOT
* OpenAPI Generator version: 3.2.0-SNAPSHOT
*/
/**

View File

@ -18,7 +18,7 @@
* OpenAPI spec version: 1.0.0
*
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 3.1.2-SNAPSHOT
* OpenAPI Generator version: 3.2.0-SNAPSHOT
*/
/**

View File

@ -18,7 +18,7 @@
* OpenAPI spec version: 1.0.0
*
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 3.1.2-SNAPSHOT
* OpenAPI Generator version: 3.2.0-SNAPSHOT
*/
/**

View File

@ -18,7 +18,7 @@
* OpenAPI spec version: 1.0.0
*
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 3.1.2-SNAPSHOT
* OpenAPI Generator version: 3.2.0-SNAPSHOT
*/
/**

View File

@ -18,7 +18,7 @@
* OpenAPI spec version: 1.0.0
*
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 3.1.2-SNAPSHOT
* OpenAPI Generator version: 3.2.0-SNAPSHOT
*/
/**

View File

@ -18,7 +18,7 @@
* OpenAPI spec version: 1.0.0
*
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 3.1.2-SNAPSHOT
* OpenAPI Generator version: 3.2.0-SNAPSHOT
*/
/**

View File

@ -18,7 +18,7 @@
* OpenAPI spec version: 1.0.0
*
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 3.1.2-SNAPSHOT
* OpenAPI Generator version: 3.2.0-SNAPSHOT
*/
/**

View File

@ -18,7 +18,7 @@
* OpenAPI spec version: 1.0.0
*
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 3.1.2-SNAPSHOT
* OpenAPI Generator version: 3.2.0-SNAPSHOT
*/
/**

View File

@ -18,7 +18,7 @@
* OpenAPI spec version: 1.0.0
*
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 3.1.2-SNAPSHOT
* OpenAPI Generator version: 3.2.0-SNAPSHOT
*/
/**

View File

@ -18,7 +18,7 @@
* OpenAPI spec version: 1.0.0
*
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 3.1.2-SNAPSHOT
* OpenAPI Generator version: 3.2.0-SNAPSHOT
*/
/**

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