[spring] fix default value for nullable containers (#14959)

* fix default value, update spec to 3.0

* add tests for container default value

* update java camel samples

* remove samples/openapi3/server/petstore/springboot-beanvalidation-no-nullable

* remove ./bin/configs/spring-boot-beanvalidation-no-nullable-oas3.yaml

* remove samples/openapi3/server/petstore/springboot-useoptional

* remove samples/openapi3/server/petstore/springboot-reactive

* update github workflow

* fix default in add, put operation
This commit is contained in:
William Cheng
2023-03-17 10:16:17 +08:00
committed by GitHub
parent e626b43e27
commit d0f7bd18ba
669 changed files with 8763 additions and 40246 deletions

View File

@@ -35,7 +35,7 @@ public interface AnotherFakeApi {
* PATCH /another-fake/dummy : To test special tags
* To test special tags and operation ID starting with number
*
* @param body client model (required)
* @param client client model (required)
* @return successful operation (status code 200)
*/
@ApiOperation(
@@ -55,7 +55,7 @@ public interface AnotherFakeApi {
consumes = { "application/json" }
)
default ResponseEntity<Client> call123testSpecialTags(
@ApiParam(value = "client model", required = true) @Valid @RequestBody Client body
@ApiParam(value = "client model", required = true) @Valid @RequestBody Client client
) {
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {

View File

@@ -90,7 +90,8 @@ public interface FakeApi {
@RequestMapping(
method = RequestMethod.POST,
value = "/fake/outer/boolean",
produces = { "*/*" }
produces = { "*/*" },
consumes = { "application/json" }
)
default ResponseEntity<Boolean> fakeOuterBooleanSerialize(
@ApiParam(value = "Input boolean as post body") @Valid @RequestBody(required = false) Boolean body
@@ -104,7 +105,7 @@ public interface FakeApi {
* POST /fake/outer/composite
* Test serialization of object with outer number type
*
* @param body Input composite as post body (optional)
* @param outerComposite Input composite as post body (optional)
* @return Output composite (status code 200)
*/
@ApiOperation(
@@ -120,10 +121,11 @@ public interface FakeApi {
@RequestMapping(
method = RequestMethod.POST,
value = "/fake/outer/composite",
produces = { "*/*" }
produces = { "*/*" },
consumes = { "application/json" }
)
default ResponseEntity<OuterComposite> fakeOuterCompositeSerialize(
@ApiParam(value = "Input composite as post body") @Valid @RequestBody(required = false) OuterComposite body
@ApiParam(value = "Input composite as post body") @Valid @RequestBody(required = false) OuterComposite outerComposite
) {
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
@@ -159,7 +161,8 @@ public interface FakeApi {
@RequestMapping(
method = RequestMethod.POST,
value = "/fake/outer/number",
produces = { "*/*" }
produces = { "*/*" },
consumes = { "application/json" }
)
default ResponseEntity<BigDecimal> fakeOuterNumberSerialize(
@ApiParam(value = "Input number as post body") @Valid @RequestBody(required = false) BigDecimal body
@@ -189,7 +192,8 @@ public interface FakeApi {
@RequestMapping(
method = RequestMethod.POST,
value = "/fake/outer/string",
produces = { "*/*" }
produces = { "*/*" },
consumes = { "application/json" }
)
default ResponseEntity<String> fakeOuterStringSerialize(
@ApiParam(value = "Input string as post body") @Valid @RequestBody(required = false) String body
@@ -203,7 +207,7 @@ public interface FakeApi {
* PUT /fake/body-with-file-schema
* For this test, the body for this request much reference a schema named &#x60;File&#x60;.
*
* @param body (required)
* @param fileSchemaTestClass (required)
* @return Success (status code 200)
*/
@ApiOperation(
@@ -221,7 +225,7 @@ public interface FakeApi {
consumes = { "application/json" }
)
default ResponseEntity<Void> testBodyWithFileSchema(
@ApiParam(value = "", required = true) @Valid @RequestBody FileSchemaTestClass body
@ApiParam(value = "", required = true) @Valid @RequestBody FileSchemaTestClass fileSchemaTestClass
) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
@@ -232,7 +236,7 @@ public interface FakeApi {
* PUT /fake/body-with-query-params
*
* @param query (required)
* @param body (required)
* @param user (required)
* @return Success (status code 200)
*/
@ApiOperation(
@@ -251,7 +255,7 @@ public interface FakeApi {
)
default ResponseEntity<Void> testBodyWithQueryParams(
@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "query", required = true) String query,
@ApiParam(value = "", required = true) @Valid @RequestBody User body
@ApiParam(value = "", required = true) @Valid @RequestBody User user
) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
@@ -262,7 +266,7 @@ public interface FakeApi {
* PATCH /fake : To test \&quot;client\&quot; model
* To test \&quot;client\&quot; model
*
* @param body client model (required)
* @param client client model (required)
* @return successful operation (status code 200)
*/
@ApiOperation(
@@ -282,7 +286,7 @@ public interface FakeApi {
consumes = { "application/json" }
)
default ResponseEntity<Client> testClientModel(
@ApiParam(value = "client model", required = true) @Valid @RequestBody Client body
@ApiParam(value = "client model", required = true) @Valid @RequestBody Client client
) {
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
@@ -443,8 +447,9 @@ public interface FakeApi {
/**
* POST /fake/inline-additionalProperties : test inline additionalProperties
*
*
* @param param request body (required)
* @param requestBody request body (required)
* @return successful operation (status code 200)
*/
@ApiOperation(
@@ -462,7 +467,7 @@ public interface FakeApi {
consumes = { "application/json" }
)
default ResponseEntity<Void> testInlineAdditionalProperties(
@ApiParam(value = "request body", required = true) @Valid @RequestBody Map<String, String> param
@ApiParam(value = "request body", required = true) @Valid @RequestBody Map<String, String> requestBody
) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
@@ -471,6 +476,7 @@ public interface FakeApi {
/**
* GET /fake/jsonFormData : test json serialization of form data
*
*
* @param param field1 (required)
* @param param2 field2 (required)
@@ -504,7 +510,6 @@ public interface FakeApi {
* To test the collection format in query parameters
*
* @param pipe (required)
* @param ioutil (required)
* @param http (required)
* @param url (required)
* @param context (required)
@@ -525,7 +530,6 @@ public interface FakeApi {
)
default ResponseEntity<Void> testQueryParameterCollectionFormat(
@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "pipe", required = true) List<String> pipe,
@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "ioutil", required = true) List<String> ioutil,
@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "http", required = true) List<String> http,
@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "url", required = true) List<String> url,
@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "context", required = true) List<String> context
@@ -537,6 +541,7 @@ public interface FakeApi {
/**
* POST /fake/{petId}/uploadImageWithRequiredFile : uploads an image (required)
*
*
* @param petId ID of pet to update (required)
* @param requiredFile file to upload (required)

View File

@@ -35,7 +35,7 @@ public interface FakeClassnameTestApi {
* PATCH /fake_classname_test : To test class name in snake case
* To test class name in snake case
*
* @param body client model (required)
* @param client client model (required)
* @return successful operation (status code 200)
*/
@ApiOperation(
@@ -58,7 +58,7 @@ public interface FakeClassnameTestApi {
consumes = { "application/json" }
)
default ResponseEntity<Client> testClassname(
@ApiParam(value = "client model", required = true) @Valid @RequestBody Client body
@ApiParam(value = "client model", required = true) @Valid @RequestBody Client client
) {
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {

View File

@@ -35,8 +35,9 @@ public interface PetApi {
/**
* POST /pet : Add a new pet to the store
*
*
* @param body Pet object that needs to be added to the store (required)
* @param pet Pet object that needs to be added to the store (required)
* @return successful operation (status code 200)
* or Invalid input (status code 405)
*/
@@ -62,7 +63,7 @@ public interface PetApi {
consumes = { "application/json", "application/xml" }
)
default ResponseEntity<Void> addPet(
@ApiParam(value = "Pet object that needs to be added to the store", required = true) @Valid @RequestBody Pet body
@ApiParam(value = "Pet object that needs to be added to the store", required = true) @Valid @RequestBody Pet pet
) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
@@ -71,6 +72,7 @@ public interface PetApi {
/**
* DELETE /pet/{petId} : Deletes a pet
*
*
* @param petId Pet id to delete (required)
* @param apiKey (optional)
@@ -267,8 +269,9 @@ public interface PetApi {
/**
* PUT /pet : Update an existing pet
*
*
* @param body Pet object that needs to be added to the store (required)
* @param pet Pet object that needs to be added to the store (required)
* @return successful operation (status code 200)
* or Invalid ID supplied (status code 400)
* or Pet not found (status code 404)
@@ -298,7 +301,7 @@ public interface PetApi {
consumes = { "application/json", "application/xml" }
)
default ResponseEntity<Void> updatePet(
@ApiParam(value = "Pet object that needs to be added to the store", required = true) @Valid @RequestBody Pet body
@ApiParam(value = "Pet object that needs to be added to the store", required = true) @Valid @RequestBody Pet pet
) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
@@ -307,6 +310,7 @@ public interface PetApi {
/**
* POST /pet/{petId} : Updates a pet in the store with form data
*
*
* @param petId ID of pet that needs to be updated (required)
* @param name Updated name of the pet (optional)
@@ -345,6 +349,7 @@ public interface PetApi {
/**
* POST /pet/{petId}/uploadImage : uploads an image
*
*
* @param petId ID of pet to update (required)
* @param additionalMetadata Additional data to pass to server (optional)

View File

@@ -145,8 +145,9 @@ public interface StoreApi {
/**
* POST /store/order : Place an order for a pet
*
*
* @param body order placed for purchasing the pet (required)
* @param order order placed for purchasing the pet (required)
* @return successful operation (status code 200)
* or Invalid Order (status code 400)
*/
@@ -164,10 +165,11 @@ public interface StoreApi {
@RequestMapping(
method = RequestMethod.POST,
value = "/store/order",
produces = { "application/xml", "application/json" }
produces = { "application/xml", "application/json" },
consumes = { "application/json" }
)
default ResponseEntity<Order> placeOrder(
@ApiParam(value = "order placed for purchasing the pet", required = true) @Valid @RequestBody Order body
@ApiParam(value = "order placed for purchasing the pet", required = true) @Valid @RequestBody Order order
) {
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {

View File

@@ -37,7 +37,7 @@ public interface UserApi {
* POST /user : Create user
* This can only be done by the logged in user.
*
* @param body Created user object (required)
* @param user Created user object (required)
* @return successful operation (status code 200)
*/
@ApiOperation(
@@ -51,10 +51,11 @@ public interface UserApi {
})
@RequestMapping(
method = RequestMethod.POST,
value = "/user"
value = "/user",
consumes = { "application/json" }
)
default ResponseEntity<Void> createUser(
@ApiParam(value = "Created user object", required = true) @Valid @RequestBody User body
@ApiParam(value = "Created user object", required = true) @Valid @RequestBody User user
) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
@@ -63,8 +64,9 @@ public interface UserApi {
/**
* POST /user/createWithArray : Creates list of users with given input array
*
*
* @param body List of user object (required)
* @param user List of user object (required)
* @return successful operation (status code 200)
*/
@ApiOperation(
@@ -78,10 +80,11 @@ public interface UserApi {
})
@RequestMapping(
method = RequestMethod.POST,
value = "/user/createWithArray"
value = "/user/createWithArray",
consumes = { "application/json" }
)
default ResponseEntity<Void> createUsersWithArrayInput(
@ApiParam(value = "List of user object", required = true) @Valid @RequestBody List<User> body
@ApiParam(value = "List of user object", required = true) @Valid @RequestBody List<User> user
) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
@@ -90,8 +93,9 @@ public interface UserApi {
/**
* POST /user/createWithList : Creates list of users with given input array
*
*
* @param body List of user object (required)
* @param user List of user object (required)
* @return successful operation (status code 200)
*/
@ApiOperation(
@@ -105,10 +109,11 @@ public interface UserApi {
})
@RequestMapping(
method = RequestMethod.POST,
value = "/user/createWithList"
value = "/user/createWithList",
consumes = { "application/json" }
)
default ResponseEntity<Void> createUsersWithListInput(
@ApiParam(value = "List of user object", required = true) @Valid @RequestBody List<User> body
@ApiParam(value = "List of user object", required = true) @Valid @RequestBody List<User> user
) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
@@ -147,6 +152,7 @@ public interface UserApi {
/**
* GET /user/{username} : Get user by user name
*
*
* @param username The name that needs to be fetched. Use user1 for testing. (required)
* @return successful operation (status code 200)
@@ -194,6 +200,7 @@ public interface UserApi {
/**
* GET /user/login : Logs user into the system
*
*
* @param username The user name for login (required)
* @param password The password for login in clear text (required)
@@ -227,6 +234,7 @@ public interface UserApi {
/**
* GET /user/logout : Logs out current logged in user session
*
*
* @return successful operation (status code 200)
*/
@@ -256,7 +264,7 @@ public interface UserApi {
* This can only be done by the logged in user.
*
* @param username name that need to be deleted (required)
* @param body Updated user object (required)
* @param user Updated user object (required)
* @return Invalid user supplied (status code 400)
* or User not found (status code 404)
*/
@@ -272,11 +280,12 @@ public interface UserApi {
})
@RequestMapping(
method = RequestMethod.PUT,
value = "/user/{username}"
value = "/user/{username}",
consumes = { "application/json" }
)
default ResponseEntity<Void> updateUser(
@ApiParam(value = "name that need to be deleted", required = true) @PathVariable("username") String username,
@ApiParam(value = "Updated user object", required = true) @Valid @RequestBody User body
@ApiParam(value = "Updated user object", required = true) @Valid @RequestBody User user
) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);

View File

@@ -27,41 +27,41 @@ public class AdditionalPropertiesClass {
@JsonProperty("map_string")
@Valid
private Map<String, String> mapString = null;
private Map<String, String> mapString = new HashMap<>();
@JsonProperty("map_number")
@Valid
private Map<String, BigDecimal> mapNumber = null;
private Map<String, BigDecimal> mapNumber = new HashMap<>();
@JsonProperty("map_integer")
@Valid
private Map<String, Integer> mapInteger = null;
private Map<String, Integer> mapInteger = new HashMap<>();
@JsonProperty("map_boolean")
@Valid
private Map<String, Boolean> mapBoolean = null;
private Map<String, Boolean> mapBoolean = new HashMap<>();
@JsonProperty("map_array_integer")
@Valid
private Map<String, List<Integer>> mapArrayInteger = null;
private Map<String, List<Integer>> mapArrayInteger = new HashMap<>();
@JsonProperty("map_array_anytype")
@Valid
private Map<String, List<Object>> mapArrayAnytype = null;
private Map<String, List<Object>> mapArrayAnytype = new HashMap<>();
@JsonProperty("map_map_string")
@Valid
private Map<String, Map<String, String>> mapMapString = null;
private Map<String, Map<String, String>> mapMapString = new HashMap<>();
@JsonProperty("map_map_anytype")
@Valid
private Map<String, Map<String, Object>> mapMapAnytype = null;
private Map<String, Map<String, Object>> mapMapAnytype = new HashMap<>();
@JsonProperty("anytype_1")
private Object anytype1;
@JsonProperty("anytype_2")
private Object anytype2;
private Object anytype2 = null;
@JsonProperty("anytype_3")
private Object anytype3;

View File

@@ -26,7 +26,7 @@ public class ArrayOfArrayOfNumberOnly {
@JsonProperty("ArrayArrayNumber")
@Valid
private List<List<BigDecimal>> arrayArrayNumber = null;
private List<List<BigDecimal>> arrayArrayNumber = new ArrayList<>();
public ArrayOfArrayOfNumberOnly arrayArrayNumber(List<List<BigDecimal>> arrayArrayNumber) {
this.arrayArrayNumber = arrayArrayNumber;

View File

@@ -26,7 +26,7 @@ public class ArrayOfNumberOnly {
@JsonProperty("ArrayNumber")
@Valid
private List<BigDecimal> arrayNumber = null;
private List<BigDecimal> arrayNumber = new ArrayList<>();
public ArrayOfNumberOnly arrayNumber(List<BigDecimal> arrayNumber) {
this.arrayNumber = arrayNumber;

View File

@@ -26,15 +26,15 @@ public class ArrayTest {
@JsonProperty("array_of_string")
@Valid
private List<String> arrayOfString = null;
private List<String> arrayOfString = new ArrayList<>();
@JsonProperty("array_array_of_integer")
@Valid
private List<List<Long>> arrayArrayOfInteger = null;
private List<List<Long>> arrayArrayOfInteger = new ArrayList<>();
@JsonProperty("array_array_of_model")
@Valid
private List<List<ReadOnlyFirst>> arrayArrayOfModel = null;
private List<List<ReadOnlyFirst>> arrayArrayOfModel = new ArrayList<>();
public ArrayTest arrayOfString(List<String> arrayOfString) {
this.arrayOfString = arrayOfString;

View File

@@ -0,0 +1,210 @@
package org.openapitools.model;
import java.net.URI;
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;
import java.time.OffsetDateTime;
import javax.validation.Valid;
import javax.validation.constraints.*;
import java.util.*;
import javax.annotation.Generated;
/**
* ContainerDefaultValue
*/
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class ContainerDefaultValue {
@JsonProperty("nullable_array")
@Valid
private List<String> nullableArray;
@JsonProperty("nullable_required_array")
@Valid
private List<String> nullableRequiredArray;
@JsonProperty("required_array")
@Valid
private List<String> requiredArray = new ArrayList<>();
@JsonProperty("nullable_array_with_default")
@Valid
private List<String> nullableArrayWithDefault = new ArrayList<>(Arrays.asList("foo", "bar"));
/**
* Default constructor
* @deprecated Use {@link ContainerDefaultValue#ContainerDefaultValue(List<String>, List<String>)}
*/
@Deprecated
public ContainerDefaultValue() {
super();
}
/**
* Constructor with only required parameters
*/
public ContainerDefaultValue(List<String> nullableRequiredArray, List<String> requiredArray) {
this.nullableRequiredArray = nullableRequiredArray;
this.requiredArray = requiredArray;
}
public ContainerDefaultValue nullableArray(List<String> nullableArray) {
this.nullableArray = nullableArray;
return this;
}
public ContainerDefaultValue addNullableArrayItem(String nullableArrayItem) {
if (this.nullableArray == null) {
this.nullableArray = new ArrayList<>();
}
this.nullableArray.add(nullableArrayItem);
return this;
}
/**
* Get nullableArray
* @return nullableArray
*/
@ApiModelProperty(value = "")
public List<String> getNullableArray() {
return nullableArray;
}
public void setNullableArray(List<String> nullableArray) {
this.nullableArray = nullableArray;
}
public ContainerDefaultValue nullableRequiredArray(List<String> nullableRequiredArray) {
this.nullableRequiredArray = nullableRequiredArray;
return this;
}
public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequiredArrayItem) {
if (this.nullableRequiredArray == null) {
this.nullableRequiredArray = new ArrayList<>();
}
this.nullableRequiredArray.add(nullableRequiredArrayItem);
return this;
}
/**
* Get nullableRequiredArray
* @return nullableRequiredArray
*/
@NotNull
@ApiModelProperty(required = true, value = "")
public List<String> getNullableRequiredArray() {
return nullableRequiredArray;
}
public void setNullableRequiredArray(List<String> nullableRequiredArray) {
this.nullableRequiredArray = nullableRequiredArray;
}
public ContainerDefaultValue requiredArray(List<String> requiredArray) {
this.requiredArray = requiredArray;
return this;
}
public ContainerDefaultValue addRequiredArrayItem(String requiredArrayItem) {
if (this.requiredArray == null) {
this.requiredArray = new ArrayList<>();
}
this.requiredArray.add(requiredArrayItem);
return this;
}
/**
* Get requiredArray
* @return requiredArray
*/
@NotNull
@ApiModelProperty(required = true, value = "")
public List<String> getRequiredArray() {
return requiredArray;
}
public void setRequiredArray(List<String> requiredArray) {
this.requiredArray = requiredArray;
}
public ContainerDefaultValue nullableArrayWithDefault(List<String> nullableArrayWithDefault) {
this.nullableArrayWithDefault = nullableArrayWithDefault;
return this;
}
public ContainerDefaultValue addNullableArrayWithDefaultItem(String nullableArrayWithDefaultItem) {
if (this.nullableArrayWithDefault == null) {
this.nullableArrayWithDefault = new ArrayList<>(Arrays.asList("foo", "bar"));
}
this.nullableArrayWithDefault.add(nullableArrayWithDefaultItem);
return this;
}
/**
* Get nullableArrayWithDefault
* @return nullableArrayWithDefault
*/
@ApiModelProperty(value = "")
public List<String> getNullableArrayWithDefault() {
return nullableArrayWithDefault;
}
public void setNullableArrayWithDefault(List<String> nullableArrayWithDefault) {
this.nullableArrayWithDefault = nullableArrayWithDefault;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ContainerDefaultValue containerDefaultValue = (ContainerDefaultValue) o;
return Objects.equals(this.nullableArray, containerDefaultValue.nullableArray) &&
Objects.equals(this.nullableRequiredArray, containerDefaultValue.nullableRequiredArray) &&
Objects.equals(this.requiredArray, containerDefaultValue.requiredArray) &&
Objects.equals(this.nullableArrayWithDefault, containerDefaultValue.nullableArrayWithDefault);
}
@Override
public int hashCode() {
return Objects.hash(nullableArray, nullableRequiredArray, requiredArray, nullableArrayWithDefault);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ContainerDefaultValue {\n");
sb.append(" nullableArray: ").append(toIndentedString(nullableArray)).append("\n");
sb.append(" nullableRequiredArray: ").append(toIndentedString(nullableRequiredArray)).append("\n");
sb.append(" requiredArray: ").append(toIndentedString(requiredArray)).append("\n");
sb.append(" nullableArrayWithDefault: ").append(toIndentedString(nullableArrayWithDefault)).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(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -99,7 +99,7 @@ public class EnumArrays {
@JsonProperty("array_enum")
@Valid
private List<ArrayEnumEnum> arrayEnum = null;
private List<ArrayEnumEnum> arrayEnum = new ArrayList<>();
public EnumArrays justSymbol(JustSymbolEnum justSymbol) {
this.justSymbol = justSymbol;

View File

@@ -29,7 +29,7 @@ public class FileSchemaTestClass {
@JsonProperty("files")
@Valid
private List<@Valid File> files = null;
private List<@Valid File> files = new ArrayList<>();
public FileSchemaTestClass file(File file) {
this.file = file;

View File

@@ -26,7 +26,7 @@ public class MapTest {
@JsonProperty("map_map_of_string")
@Valid
private Map<String, Map<String, String>> mapMapOfString = null;
private Map<String, Map<String, String>> mapMapOfString = new HashMap<>();
/**
* Gets or Sets inner
@@ -65,15 +65,15 @@ public class MapTest {
@JsonProperty("map_of_enum_string")
@Valid
private Map<String, InnerEnum> mapOfEnumString = null;
private Map<String, InnerEnum> mapOfEnumString = new HashMap<>();
@JsonProperty("direct_map")
@Valid
private Map<String, Boolean> directMap = null;
private Map<String, Boolean> directMap = new HashMap<>();
@JsonProperty("indirect_map")
@Valid
private Map<String, Boolean> indirectMap = null;
private Map<String, Boolean> indirectMap = new HashMap<>();
public MapTest mapMapOfString(Map<String, Map<String, String>> mapMapOfString) {
this.mapMapOfString = mapMapOfString;

View File

@@ -36,7 +36,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass {
@JsonProperty("map")
@Valid
private Map<String, Animal> map = null;
private Map<String, Animal> map = new HashMap<>();
public MixedPropertiesAndAdditionalPropertiesClass uuid(UUID uuid) {
this.uuid = uuid;

View File

@@ -44,7 +44,7 @@ public class Pet {
@JsonProperty("tags")
@Valid
private List<@Valid Tag> tags = null;
private List<@Valid Tag> tags = new ArrayList<>();
/**
* pet status in the store

View File

@@ -19,7 +19,7 @@ import javax.annotation.Generated;
* SpecialModelName
*/
@JsonTypeName("$special[model.name]")
@JsonTypeName("_special_model.name_")
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class SpecialModelName {
@@ -53,8 +53,8 @@ public class SpecialModelName {
if (o == null || getClass() != o.getClass()) {
return false;
}
SpecialModelName $specialModelName = (SpecialModelName) o;
return Objects.equals(this.$specialPropertyName, $specialModelName.$specialPropertyName);
SpecialModelName specialModelName = (SpecialModelName) o;
return Objects.equals(this.$specialPropertyName, specialModelName.$specialPropertyName);
}
@Override

View File

@@ -28,17 +28,17 @@ public class TypeHolderDefault {
private String stringItem = "what";
@JsonProperty("number_item")
private BigDecimal numberItem;
private BigDecimal numberItem = new BigDecimal("1.234");
@JsonProperty("integer_item")
private Integer integerItem;
private Integer integerItem = -2;
@JsonProperty("bool_item")
private Boolean boolItem = true;
@JsonProperty("array_item")
@Valid
private List<Integer> arrayItem = new ArrayList<>();
private List<Integer> arrayItem = new ArrayList<>(Arrays.asList(0, 1, 2, 3));
/**
* Default constructor
@@ -143,7 +143,7 @@ public class TypeHolderDefault {
public TypeHolderDefault addArrayItemItem(Integer arrayItemItem) {
if (this.arrayItem == null) {
this.arrayItem = new ArrayList<>();
this.arrayItem = new ArrayList<>(Arrays.asList(0, 1, 2, 3));
}
this.arrayItem.add(arrayItemItem);
return this;

View File

@@ -177,7 +177,7 @@ public class TypeHolderExample {
* @return arrayItem
*/
@NotNull
@ApiModelProperty(example = "[0, 1, 2, 3]", required = true, value = "")
@ApiModelProperty(example = "[0,1,2,3]", required = true, value = "")
public List<Integer> getArrayItem() {
return arrayItem;
}

View File

@@ -38,7 +38,7 @@ public class XmlItem {
@JsonProperty("wrapped_array")
@Valid
private List<Integer> wrappedArray = null;
private List<Integer> wrappedArray = new ArrayList<>();
@JsonProperty("name_string")
private String nameString;
@@ -54,11 +54,11 @@ public class XmlItem {
@JsonProperty("name_array")
@Valid
private List<Integer> nameArray = null;
private List<Integer> nameArray = new ArrayList<>();
@JsonProperty("name_wrapped_array")
@Valid
private List<Integer> nameWrappedArray = null;
private List<Integer> nameWrappedArray = new ArrayList<>();
@JsonProperty("prefix_string")
private String prefixString;
@@ -74,11 +74,11 @@ public class XmlItem {
@JsonProperty("prefix_array")
@Valid
private List<Integer> prefixArray = null;
private List<Integer> prefixArray = new ArrayList<>();
@JsonProperty("prefix_wrapped_array")
@Valid
private List<Integer> prefixWrappedArray = null;
private List<Integer> prefixWrappedArray = new ArrayList<>();
@JsonProperty("namespace_string")
private String namespaceString;
@@ -94,11 +94,11 @@ public class XmlItem {
@JsonProperty("namespace_array")
@Valid
private List<Integer> namespaceArray = null;
private List<Integer> namespaceArray = new ArrayList<>();
@JsonProperty("namespace_wrapped_array")
@Valid
private List<Integer> namespaceWrappedArray = null;
private List<Integer> namespaceWrappedArray = new ArrayList<>();
@JsonProperty("prefix_ns_string")
private String prefixNsString;
@@ -114,11 +114,11 @@ public class XmlItem {
@JsonProperty("prefix_ns_array")
@Valid
private List<Integer> prefixNsArray = null;
private List<Integer> prefixNsArray = new ArrayList<>();
@JsonProperty("prefix_ns_wrapped_array")
@Valid
private List<Integer> prefixNsWrappedArray = null;
private List<Integer> prefixNsWrappedArray = new ArrayList<>();
public XmlItem attributeString(String attributeString) {
this.attributeString = attributeString;