Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
updated samples and tests
  • Loading branch information
alexsuperdev committed Feb 21, 2020
1 parent 7fadec8 commit fb7fd72
Show file tree
Hide file tree
Showing 957 changed files with 3,772 additions and 3,301 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -976,9 +976,6 @@ public String toOperationId(String operationId) {
public CodegenModel fromModel(String name, Schema model) {
Map<String, Schema> allDefinitions = ModelUtils.getSchemas(this.openAPI);
CodegenModel codegenModel = super.fromModel(name, model);
if (codegenModel.description != null) {
codegenModel.imports.add("ApiModel");
}
if (codegenModel.discriminator != null && additionalProperties.containsKey("jackson")) {
codegenModel.imports.add("JsonSubTypes");
codegenModel.imports.add("JsonTypeInfo");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import java.io.Serializable;
{{/serializableModel}}
{{#jackson}}
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import io.swagger.v3.oas.annotations.media.Schema;
{{#withXml}}
import com.fasterxml.jackson.dataformat.xml.annotation.*;
{{/withXml}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* {{#description}}{{.}}{{/description}}{{^description}}{{classname}}{{/description}}
*/{{#description}}
@ApiModel(description = "{{{description}}}"){{/description}}
@Schema(description = "{{{description}}}"){{/description}}
{{#jackson}}
@JsonPropertyOrder({
{{#vars}}
Expand Down Expand Up @@ -178,7 +178,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#vendorE
{{^required}}
@javax.annotation.Nullable
{{/required}}
{{#useBeanValidation}}{{>beanValidation}}{{/useBeanValidation}} @ApiModelProperty({{#example}}example = "{{{example}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}")
{{#useBeanValidation}}{{>beanValidation}}{{/useBeanValidation}} @Schema({{#example}}example = "{{{example}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}description = "{{{description}}}")
{{#vendorExtensions.x-extra-annotation}}
{{{vendorExtensions.x-extra-annotation}}}
{{/vendorExtensions.x-extra-annotation}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* {{#description}}{{.}}{{/description}}{{^description}}{{classname}}{{/description}}
*/{{#description}}
@ApiModel(description = "{{{description}}}"){{/description}}
@Schema(description = "{{{description}}}"){{/description}}
{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}{{>xmlAnnotation}}{{>additionalModelTypeAnnotations}}
public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}}{{^parent}}{{#hateoas}}extends RepresentationModel<{{classname}}> {{/hateoas}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} {
{{#serializableModel}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,8 +397,8 @@ public void arrayModelTest() {
Assert.assertEquals(cm.description, "an array model");
Assert.assertEquals(cm.vars.size(), 0);
Assert.assertEquals(cm.parent, "ArrayList<Children>");
Assert.assertEquals(cm.imports.size(), 4);
Assert.assertEquals(Sets.intersection(cm.imports, Sets.newHashSet("ApiModel", "List", "ArrayList", "Children")).size(), 4);
Assert.assertEquals(cm.imports.size(), 3);
Assert.assertEquals(Sets.intersection(cm.imports, Sets.newHashSet("List", "ArrayList", "Children")).size(), 3);
}

@Test(description = "convert a map model")
Expand All @@ -416,8 +416,8 @@ public void mapModelTest() {
Assert.assertEquals(cm.description, "a map model");
Assert.assertEquals(cm.vars.size(), 0);
Assert.assertEquals(cm.parent, "HashMap<String, Children>");
Assert.assertEquals(cm.imports.size(), 4);
Assert.assertEquals(Sets.intersection(cm.imports, Sets.newHashSet("ApiModel", "Map", "HashMap", "Children")).size(), 4);
Assert.assertEquals(cm.imports.size(), 3);
Assert.assertEquals(Sets.intersection(cm.imports, Sets.newHashSet("Map", "HashMap", "Children")).size(), 3);
}

@Test(description = "convert a model with upper-case property names")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.util.HashMap;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import io.swagger.v3.oas.annotations.media.Schema;

/**
* AdditionalPropertiesAnyType
Expand All @@ -47,7 +48,7 @@ public AdditionalPropertiesAnyType name(String name) {
* @return name
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
@Schema(description = "")
@JsonProperty(JSON_PROPERTY_NAME)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import io.swagger.v3.oas.annotations.media.Schema;

/**
* AdditionalPropertiesArray
Expand All @@ -48,7 +49,7 @@ public AdditionalPropertiesArray name(String name) {
* @return name
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
@Schema(description = "")
@JsonProperty(JSON_PROPERTY_NAME)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.util.HashMap;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import io.swagger.v3.oas.annotations.media.Schema;

/**
* AdditionalPropertiesBoolean
Expand All @@ -47,7 +48,7 @@ public AdditionalPropertiesBoolean name(String name) {
* @return name
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
@Schema(description = "")
@JsonProperty(JSON_PROPERTY_NAME)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import io.swagger.v3.oas.annotations.media.Schema;

/**
* AdditionalPropertiesClass
Expand Down Expand Up @@ -97,7 +98,7 @@ public AdditionalPropertiesClass putMapStringItem(String key, String mapStringIt
* @return mapString
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
@Schema(description = "")
@JsonProperty(JSON_PROPERTY_MAP_STRING)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

Expand Down Expand Up @@ -130,7 +131,7 @@ public AdditionalPropertiesClass putMapNumberItem(String key, BigDecimal mapNumb
* @return mapNumber
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
@Schema(description = "")
@JsonProperty(JSON_PROPERTY_MAP_NUMBER)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

Expand Down Expand Up @@ -163,7 +164,7 @@ public AdditionalPropertiesClass putMapIntegerItem(String key, Integer mapIntege
* @return mapInteger
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
@Schema(description = "")
@JsonProperty(JSON_PROPERTY_MAP_INTEGER)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

Expand Down Expand Up @@ -196,7 +197,7 @@ public AdditionalPropertiesClass putMapBooleanItem(String key, Boolean mapBoolea
* @return mapBoolean
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
@Schema(description = "")
@JsonProperty(JSON_PROPERTY_MAP_BOOLEAN)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

Expand Down Expand Up @@ -229,7 +230,7 @@ public AdditionalPropertiesClass putMapArrayIntegerItem(String key, List<Integer
* @return mapArrayInteger
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
@Schema(description = "")
@JsonProperty(JSON_PROPERTY_MAP_ARRAY_INTEGER)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

Expand Down Expand Up @@ -262,7 +263,7 @@ public AdditionalPropertiesClass putMapArrayAnytypeItem(String key, List<Object>
* @return mapArrayAnytype
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
@Schema(description = "")
@JsonProperty(JSON_PROPERTY_MAP_ARRAY_ANYTYPE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

Expand Down Expand Up @@ -295,7 +296,7 @@ public AdditionalPropertiesClass putMapMapStringItem(String key, Map<String, Str
* @return mapMapString
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
@Schema(description = "")
@JsonProperty(JSON_PROPERTY_MAP_MAP_STRING)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

Expand Down Expand Up @@ -328,7 +329,7 @@ public AdditionalPropertiesClass putMapMapAnytypeItem(String key, Map<String, Ob
* @return mapMapAnytype
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
@Schema(description = "")
@JsonProperty(JSON_PROPERTY_MAP_MAP_ANYTYPE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

Expand All @@ -353,7 +354,7 @@ public AdditionalPropertiesClass anytype1(Object anytype1) {
* @return anytype1
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
@Schema(description = "")
@JsonProperty(JSON_PROPERTY_ANYTYPE1)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

Expand All @@ -378,7 +379,7 @@ public AdditionalPropertiesClass anytype2(Object anytype2) {
* @return anytype2
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
@Schema(description = "")
@JsonProperty(JSON_PROPERTY_ANYTYPE2)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

Expand All @@ -403,7 +404,7 @@ public AdditionalPropertiesClass anytype3(Object anytype3) {
* @return anytype3
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
@Schema(description = "")
@JsonProperty(JSON_PROPERTY_ANYTYPE3)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.util.HashMap;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import io.swagger.v3.oas.annotations.media.Schema;

/**
* AdditionalPropertiesInteger
Expand All @@ -47,7 +48,7 @@ public AdditionalPropertiesInteger name(String name) {
* @return name
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
@Schema(description = "")
@JsonProperty(JSON_PROPERTY_NAME)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.util.HashMap;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import io.swagger.v3.oas.annotations.media.Schema;

/**
* AdditionalPropertiesNumber
Expand All @@ -48,7 +49,7 @@ public AdditionalPropertiesNumber name(String name) {
* @return name
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
@Schema(description = "")
@JsonProperty(JSON_PROPERTY_NAME)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.util.HashMap;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import io.swagger.v3.oas.annotations.media.Schema;

/**
* AdditionalPropertiesObject
Expand All @@ -47,7 +48,7 @@ public AdditionalPropertiesObject name(String name) {
* @return name
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
@Schema(description = "")
@JsonProperty(JSON_PROPERTY_NAME)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.util.HashMap;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import io.swagger.v3.oas.annotations.media.Schema;

/**
* AdditionalPropertiesString
Expand All @@ -47,7 +48,7 @@ public AdditionalPropertiesString name(String name) {
* @return name
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
@Schema(description = "")
@JsonProperty(JSON_PROPERTY_NAME)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import io.swagger.v3.oas.annotations.media.Schema;

/**
* Animal
Expand Down Expand Up @@ -57,7 +58,7 @@ public Animal className(String className) {
* Get className
* @return className
**/
@ApiModelProperty(required = true, value = "")
@Schema(required = true, description = "")
@JsonProperty(JSON_PROPERTY_CLASS_NAME)
@JsonInclude(value = JsonInclude.Include.ALWAYS)

Expand All @@ -82,7 +83,7 @@ public Animal color(String color) {
* @return color
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
@Schema(description = "")
@JsonProperty(JSON_PROPERTY_COLOR)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.util.ArrayList;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import io.swagger.v3.oas.annotations.media.Schema;

/**
* ArrayOfArrayOfNumberOnly
Expand Down Expand Up @@ -56,7 +57,7 @@ public ArrayOfArrayOfNumberOnly addArrayArrayNumberItem(List<BigDecimal> arrayAr
* @return arrayArrayNumber
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
@Schema(description = "")
@JsonProperty(JSON_PROPERTY_ARRAY_ARRAY_NUMBER)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.util.ArrayList;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import io.swagger.v3.oas.annotations.media.Schema;

/**
* ArrayOfNumberOnly
Expand Down Expand Up @@ -56,7 +57,7 @@ public ArrayOfNumberOnly addArrayNumberItem(BigDecimal arrayNumberItem) {
* @return arrayNumber
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
@Schema(description = "")
@JsonProperty(JSON_PROPERTY_ARRAY_NUMBER)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.util.List;
import org.openapitools.client.model.ReadOnlyFirst;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import io.swagger.v3.oas.annotations.media.Schema;

/**
* ArrayTest
Expand Down Expand Up @@ -64,7 +65,7 @@ public ArrayTest addArrayOfStringItem(String arrayOfStringItem) {
* @return arrayOfString
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
@Schema(description = "")
@JsonProperty(JSON_PROPERTY_ARRAY_OF_STRING)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

Expand Down Expand Up @@ -97,7 +98,7 @@ public ArrayTest addArrayArrayOfIntegerItem(List<Long> arrayArrayOfIntegerItem)
* @return arrayArrayOfInteger
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
@Schema(description = "")
@JsonProperty(JSON_PROPERTY_ARRAY_ARRAY_OF_INTEGER)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

Expand Down Expand Up @@ -130,7 +131,7 @@ public ArrayTest addArrayArrayOfModelItem(List<ReadOnlyFirst> arrayArrayOfModelI
* @return arrayArrayOfModel
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
@Schema(description = "")
@JsonProperty(JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

Expand Down
Loading

0 comments on commit fb7fd72

Please sign in to comment.