[Play Framework] Update the bean validation to use version 2.0. (#8354)

* Update the bean validation to use version 2.0. For a reason I don't know, it was not working anymore with version 1.

* better format

Co-authored-by: William Cheng <wing328hk@gmail.com>
This commit is contained in:
Jean-François Côté 2021-01-22 21:58:36 -05:00 committed by GitHub
parent 96da7aaf9d
commit 030b75b012
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
117 changed files with 849 additions and 448 deletions

View File

@ -10,6 +10,6 @@ scalaVersion := "2.12.6"
libraryDependencies += "org.webjars" % "swagger-ui" % "3.32.5"
{{/useSwaggerUI}}
{{#useBeanValidation}}
libraryDependencies += "javax.validation" % "validation-api" % "1.1.0.Final"
libraryDependencies += "javax.validation" % "validation-api" % "2.0.1.Final"
{{/useBeanValidation}}
libraryDependencies += guice

View File

@ -26,9 +26,15 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali
@SerializedName("{{baseName}}")
{{/gson}}
{{#isContainer}}
{{#useBeanValidation}}
{{>beanValidation}}
{{/useBeanValidation}}
private {{{datatypeWithEnum}}} {{name}}{{#required}} = {{{defaultValue}}}{{/required}}{{^required}} = null{{/required}};
{{/isContainer}}
{{^isContainer}}
{{#useBeanValidation}}
{{>beanValidation}}
{{/useBeanValidation}}
private {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};
{{/isContainer}}
@ -81,7 +87,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali
{{#vendorExtensions.x-extra-annotation}}
{{{vendorExtensions.x-extra-annotation}}}
{{/vendorExtensions.x-extra-annotation}}
{{#useBeanValidation}}{{>beanValidation}}{{/useBeanValidation}} public {{{datatypeWithEnum}}} {{getter}}() {
public {{{datatypeWithEnum}}} {{getter}}() {
return {{name}};
}

View File

@ -12,9 +12,11 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class Category {
@JsonProperty("id")
private Long id;
@JsonProperty("name")
private String name;
public Category id(Long id) {

View File

@ -12,12 +12,15 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class ModelApiResponse {
@JsonProperty("code")
private Integer code;
@JsonProperty("type")
private String type;
@JsonProperty("message")
private String message;
public ModelApiResponse code(Integer code) {

View File

@ -13,15 +13,20 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class Order {
@JsonProperty("id")
private Long id;
@JsonProperty("petId")
private Long petId;
@JsonProperty("quantity")
private Integer quantity;
@JsonProperty("shipDate")
@Valid
private OffsetDateTime shipDate;
/**
@ -58,9 +63,11 @@ public class Order {
}
@JsonProperty("status")
private StatusEnum status;
@JsonProperty("complete")
private Boolean complete = false;
public Order id(Long id) {
@ -123,7 +130,6 @@ public class Order {
* Get shipDate
* @return shipDate
**/
@Valid
public OffsetDateTime getShipDate() {
return shipDate;
}

View File

@ -16,18 +16,27 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class Pet {
@JsonProperty("id")
private Long id;
@JsonProperty("category")
@Valid
private Category category;
@JsonProperty("name")
@NotNull
private String name;
@JsonProperty("photoUrls")
@NotNull
private List<String> photoUrls = new ArrayList<>();
@JsonProperty("tags")
@Valid
private List<Tag> tags = null;
/**
@ -64,6 +73,7 @@ public class Pet {
}
@JsonProperty("status")
private StatusEnum status;
public Pet id(Long id) {
@ -92,7 +102,6 @@ public class Pet {
* Get category
* @return category
**/
@Valid
public Category getCategory() {
return category;
}
@ -110,7 +119,6 @@ public class Pet {
* Get name
* @return name
**/
@NotNull
public String getName() {
return name;
}
@ -133,7 +141,6 @@ public class Pet {
* Get photoUrls
* @return photoUrls
**/
@NotNull
public List<String> getPhotoUrls() {
return photoUrls;
}
@ -159,7 +166,6 @@ public class Pet {
* Get tags
* @return tags
**/
@Valid
public List<Tag> getTags() {
return tags;
}

View File

@ -12,9 +12,11 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class Tag {
@JsonProperty("id")
private Long id;
@JsonProperty("name")
private String name;
public Tag id(Long id) {

View File

@ -12,27 +12,35 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class User {
@JsonProperty("id")
private Long id;
@JsonProperty("username")
private String username;
@JsonProperty("firstName")
private String firstName;
@JsonProperty("lastName")
private String lastName;
@JsonProperty("email")
private String email;
@JsonProperty("password")
private String password;
@JsonProperty("phone")
private String phone;
@JsonProperty("userStatus")
private Integer userStatus;
public User id(Long id) {

View File

@ -7,5 +7,5 @@ lazy val root = (project in file(".")).enablePlugins(PlayJava)
scalaVersion := "2.12.6"
libraryDependencies += "org.webjars" % "swagger-ui" % "3.32.5"
libraryDependencies += "javax.validation" % "validation-api" % "1.1.0.Final"
libraryDependencies += "javax.validation" % "validation-api" % "2.0.1.Final"
libraryDependencies += guice

View File

@ -12,9 +12,11 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class Category {
@JsonProperty("id")
private Long id;
@JsonProperty("name")
private String name;
public Category id(Long id) {

View File

@ -12,12 +12,15 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class ModelApiResponse {
@JsonProperty("code")
private Integer code;
@JsonProperty("type")
private String type;
@JsonProperty("message")
private String message;
public ModelApiResponse code(Integer code) {

View File

@ -13,15 +13,20 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class Order {
@JsonProperty("id")
private Long id;
@JsonProperty("petId")
private Long petId;
@JsonProperty("quantity")
private Integer quantity;
@JsonProperty("shipDate")
@Valid
private OffsetDateTime shipDate;
/**
@ -58,9 +63,11 @@ public class Order {
}
@JsonProperty("status")
private StatusEnum status;
@JsonProperty("complete")
private Boolean complete = false;
public Order id(Long id) {
@ -123,7 +130,6 @@ public class Order {
* Get shipDate
* @return shipDate
**/
@Valid
public OffsetDateTime getShipDate() {
return shipDate;
}

View File

@ -16,18 +16,27 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class Pet {
@JsonProperty("id")
private Long id;
@JsonProperty("category")
@Valid
private Category category;
@JsonProperty("name")
@NotNull
private String name;
@JsonProperty("photoUrls")
@NotNull
private List<String> photoUrls = new ArrayList<>();
@JsonProperty("tags")
@Valid
private List<Tag> tags = null;
/**
@ -64,6 +73,7 @@ public class Pet {
}
@JsonProperty("status")
private StatusEnum status;
public Pet id(Long id) {
@ -92,7 +102,6 @@ public class Pet {
* Get category
* @return category
**/
@Valid
public Category getCategory() {
return category;
}
@ -110,7 +119,6 @@ public class Pet {
* Get name
* @return name
**/
@NotNull
public String getName() {
return name;
}
@ -133,7 +141,6 @@ public class Pet {
* Get photoUrls
* @return photoUrls
**/
@NotNull
public List<String> getPhotoUrls() {
return photoUrls;
}
@ -159,7 +166,6 @@ public class Pet {
* Get tags
* @return tags
**/
@Valid
public List<Tag> getTags() {
return tags;
}

View File

@ -12,9 +12,11 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class Tag {
@JsonProperty("id")
private Long id;
@JsonProperty("name")
private String name;
public Tag id(Long id) {

View File

@ -12,27 +12,35 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class User {
@JsonProperty("id")
private Long id;
@JsonProperty("username")
private String username;
@JsonProperty("firstName")
private String firstName;
@JsonProperty("lastName")
private String lastName;
@JsonProperty("email")
private String email;
@JsonProperty("password")
private String password;
@JsonProperty("phone")
private String phone;
@JsonProperty("userStatus")
private Integer userStatus;
public User id(Long id) {

View File

@ -7,5 +7,5 @@ lazy val root = (project in file(".")).enablePlugins(PlayJava)
scalaVersion := "2.12.6"
libraryDependencies += "org.webjars" % "swagger-ui" % "3.32.5"
libraryDependencies += "javax.validation" % "validation-api" % "1.1.0.Final"
libraryDependencies += "javax.validation" % "validation-api" % "2.0.1.Final"
libraryDependencies += guice

View File

@ -12,9 +12,11 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class Category {
@JsonProperty("id")
private Long id;
@JsonProperty("name")
private String name;
public Category id(Long id) {

View File

@ -12,12 +12,15 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class ModelApiResponse {
@JsonProperty("code")
private Integer code;
@JsonProperty("type")
private String type;
@JsonProperty("message")
private String message;
public ModelApiResponse code(Integer code) {

View File

@ -13,15 +13,20 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class Order {
@JsonProperty("id")
private Long id;
@JsonProperty("petId")
private Long petId;
@JsonProperty("quantity")
private Integer quantity;
@JsonProperty("shipDate")
@Valid
private OffsetDateTime shipDate;
/**
@ -58,9 +63,11 @@ public class Order {
}
@JsonProperty("status")
private StatusEnum status;
@JsonProperty("complete")
private Boolean complete = false;
public Order id(Long id) {
@ -123,7 +130,6 @@ public class Order {
* Get shipDate
* @return shipDate
**/
@Valid
public OffsetDateTime getShipDate() {
return shipDate;
}

View File

@ -16,18 +16,27 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class Pet {
@JsonProperty("id")
private Long id;
@JsonProperty("category")
@Valid
private Category category;
@JsonProperty("name")
@NotNull
private String name;
@JsonProperty("photoUrls")
@NotNull
private List<String> photoUrls = new ArrayList<>();
@JsonProperty("tags")
@Valid
private List<Tag> tags = null;
/**
@ -64,6 +73,7 @@ public class Pet {
}
@JsonProperty("status")
private StatusEnum status;
public Pet id(Long id) {
@ -92,7 +102,6 @@ public class Pet {
* Get category
* @return category
**/
@Valid
public Category getCategory() {
return category;
}
@ -110,7 +119,6 @@ public class Pet {
* Get name
* @return name
**/
@NotNull
public String getName() {
return name;
}
@ -133,7 +141,6 @@ public class Pet {
* Get photoUrls
* @return photoUrls
**/
@NotNull
public List<String> getPhotoUrls() {
return photoUrls;
}
@ -159,7 +166,6 @@ public class Pet {
* Get tags
* @return tags
**/
@Valid
public List<Tag> getTags() {
return tags;
}

View File

@ -12,9 +12,11 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class Tag {
@JsonProperty("id")
private Long id;
@JsonProperty("name")
private String name;
public Tag id(Long id) {

View File

@ -12,27 +12,35 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class User {
@JsonProperty("id")
private Long id;
@JsonProperty("username")
private String username;
@JsonProperty("firstName")
private String firstName;
@JsonProperty("lastName")
private String lastName;
@JsonProperty("email")
private String email;
@JsonProperty("password")
private String password;
@JsonProperty("phone")
private String phone;
@JsonProperty("userStatus")
private Integer userStatus;
public User id(Long id) {

View File

@ -7,5 +7,5 @@ lazy val root = (project in file(".")).enablePlugins(PlayJava)
scalaVersion := "2.12.6"
libraryDependencies += "org.webjars" % "swagger-ui" % "3.32.5"
libraryDependencies += "javax.validation" % "validation-api" % "1.1.0.Final"
libraryDependencies += "javax.validation" % "validation-api" % "2.0.1.Final"
libraryDependencies += guice

View File

@ -14,6 +14,7 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class AdditionalPropertiesAnyType extends HashMap<String, Object> {
@JsonProperty("name")
private String name;
public AdditionalPropertiesAnyType name(String name) {

View File

@ -15,6 +15,7 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class AdditionalPropertiesArray extends HashMap<String, List> {
@JsonProperty("name")
private String name;
public AdditionalPropertiesArray name(String name) {

View File

@ -14,6 +14,7 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class AdditionalPropertiesBoolean extends HashMap<String, Boolean> {
@JsonProperty("name")
private String name;
public AdditionalPropertiesBoolean name(String name) {

View File

@ -16,36 +16,52 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class AdditionalPropertiesClass {
@JsonProperty("map_string")
private Map<String, String> mapString = null;
@JsonProperty("map_number")
@Valid
private Map<String, BigDecimal> mapNumber = null;
@JsonProperty("map_integer")
private Map<String, Integer> mapInteger = null;
@JsonProperty("map_boolean")
private Map<String, Boolean> mapBoolean = null;
@JsonProperty("map_array_integer")
@Valid
private Map<String, List<Integer>> mapArrayInteger = null;
@JsonProperty("map_array_anytype")
@Valid
private Map<String, List<Object>> mapArrayAnytype = null;
@JsonProperty("map_map_string")
@Valid
private Map<String, Map<String, String>> mapMapString = null;
@JsonProperty("map_map_anytype")
@Valid
private Map<String, Map<String, Object>> mapMapAnytype = null;
@JsonProperty("anytype_1")
private Object anytype1;
@JsonProperty("anytype_2")
private Object anytype2;
@JsonProperty("anytype_3")
private Object anytype3;
public AdditionalPropertiesClass mapString(Map<String, String> mapString) {
@ -90,7 +106,6 @@ public class AdditionalPropertiesClass {
* Get mapNumber
* @return mapNumber
**/
@Valid
public Map<String, BigDecimal> getMapNumber() {
return mapNumber;
}
@ -166,7 +181,6 @@ public class AdditionalPropertiesClass {
* Get mapArrayInteger
* @return mapArrayInteger
**/
@Valid
public Map<String, List<Integer>> getMapArrayInteger() {
return mapArrayInteger;
}
@ -192,7 +206,6 @@ public class AdditionalPropertiesClass {
* Get mapArrayAnytype
* @return mapArrayAnytype
**/
@Valid
public Map<String, List<Object>> getMapArrayAnytype() {
return mapArrayAnytype;
}
@ -218,7 +231,6 @@ public class AdditionalPropertiesClass {
* Get mapMapString
* @return mapMapString
**/
@Valid
public Map<String, Map<String, String>> getMapMapString() {
return mapMapString;
}
@ -244,7 +256,6 @@ public class AdditionalPropertiesClass {
* Get mapMapAnytype
* @return mapMapAnytype
**/
@Valid
public Map<String, Map<String, Object>> getMapMapAnytype() {
return mapMapAnytype;
}

View File

@ -14,6 +14,7 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class AdditionalPropertiesInteger extends HashMap<String, Integer> {
@JsonProperty("name")
private String name;
public AdditionalPropertiesInteger name(String name) {

View File

@ -15,6 +15,7 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class AdditionalPropertiesNumber extends HashMap<String, BigDecimal> {
@JsonProperty("name")
private String name;
public AdditionalPropertiesNumber name(String name) {

View File

@ -14,6 +14,7 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class AdditionalPropertiesObject extends HashMap<String, Map> {
@JsonProperty("name")
private String name;
public AdditionalPropertiesObject name(String name) {

View File

@ -14,6 +14,7 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class AdditionalPropertiesString extends HashMap<String, String> {
@JsonProperty("name")
private String name;
public AdditionalPropertiesString name(String name) {

View File

@ -14,9 +14,12 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class Animal {
@JsonProperty("className")
@NotNull
private String className;
@JsonProperty("color")
private String color = "red";
public Animal className(String className) {
@ -28,7 +31,6 @@ public class Animal {
* Get className
* @return className
**/
@NotNull
public String getClassName() {
return className;
}

View File

@ -15,6 +15,8 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class ArrayOfArrayOfNumberOnly {
@JsonProperty("ArrayArrayNumber")
@Valid
private List<List<BigDecimal>> arrayArrayNumber = null;
public ArrayOfArrayOfNumberOnly arrayArrayNumber(List<List<BigDecimal>> arrayArrayNumber) {
@ -34,7 +36,6 @@ public class ArrayOfArrayOfNumberOnly {
* Get arrayArrayNumber
* @return arrayArrayNumber
**/
@Valid
public List<List<BigDecimal>> getArrayArrayNumber() {
return arrayArrayNumber;
}

View File

@ -15,6 +15,8 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class ArrayOfNumberOnly {
@JsonProperty("ArrayNumber")
@Valid
private List<BigDecimal> arrayNumber = null;
public ArrayOfNumberOnly arrayNumber(List<BigDecimal> arrayNumber) {
@ -34,7 +36,6 @@ public class ArrayOfNumberOnly {
* Get arrayNumber
* @return arrayNumber
**/
@Valid
public List<BigDecimal> getArrayNumber() {
return arrayNumber;
}

View File

@ -15,12 +15,17 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class ArrayTest {
@JsonProperty("array_of_string")
private List<String> arrayOfString = null;
@JsonProperty("array_array_of_integer")
@Valid
private List<List<Long>> arrayArrayOfInteger = null;
@JsonProperty("array_array_of_model")
@Valid
private List<List<ReadOnlyFirst>> arrayArrayOfModel = null;
public ArrayTest arrayOfString(List<String> arrayOfString) {
@ -65,7 +70,6 @@ public class ArrayTest {
* Get arrayArrayOfInteger
* @return arrayArrayOfInteger
**/
@Valid
public List<List<Long>> getArrayArrayOfInteger() {
return arrayArrayOfInteger;
}
@ -91,7 +95,6 @@ public class ArrayTest {
* Get arrayArrayOfModel
* @return arrayArrayOfModel
**/
@Valid
public List<List<ReadOnlyFirst>> getArrayArrayOfModel() {
return arrayArrayOfModel;
}

View File

@ -49,6 +49,7 @@ public class BigCat extends Cat {
}
@JsonProperty("kind")
private KindEnum kind;
public BigCat kind(KindEnum kind) {

View File

@ -47,6 +47,7 @@ public class BigCatAllOf {
}
@JsonProperty("kind")
private KindEnum kind;
public BigCatAllOf kind(KindEnum kind) {

View File

@ -12,21 +12,27 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class Capitalization {
@JsonProperty("smallCamel")
private String smallCamel;
@JsonProperty("CapitalCamel")
private String capitalCamel;
@JsonProperty("small_Snake")
private String smallSnake;
@JsonProperty("Capital_Snake")
private String capitalSnake;
@JsonProperty("SCA_ETH_Flow_Points")
private String scAETHFlowPoints;
@JsonProperty("ATT_NAME")
private String ATT_NAME;
public Capitalization smallCamel(String smallCamel) {

View File

@ -14,6 +14,7 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class Cat extends Animal {
@JsonProperty("declawed")
private Boolean declawed;
public Cat declawed(Boolean declawed) {

View File

@ -12,6 +12,7 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class CatAllOf {
@JsonProperty("declawed")
private Boolean declawed;
public CatAllOf declawed(Boolean declawed) {

View File

@ -12,9 +12,12 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class Category {
@JsonProperty("id")
private Long id;
@JsonProperty("name")
@NotNull
private String name = "default-name";
public Category id(Long id) {
@ -43,7 +46,6 @@ public class Category {
* Get name
* @return name
**/
@NotNull
public String getName() {
return name;
}

View File

@ -12,6 +12,7 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class ClassModel {
@JsonProperty("_class")
private String propertyClass;
public ClassModel propertyClass(String propertyClass) {

View File

@ -12,6 +12,7 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class Client {
@JsonProperty("client")
private String client;
public Client client(String client) {

View File

@ -14,6 +14,7 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class Dog extends Animal {
@JsonProperty("breed")
private String breed;
public Dog breed(String breed) {

View File

@ -12,6 +12,7 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class DogAllOf {
@JsonProperty("breed")
private String breed;
public DogAllOf breed(String breed) {

View File

@ -45,6 +45,7 @@ public class EnumArrays {
}
@JsonProperty("just_symbol")
private JustSymbolEnum justSymbol;
/**
@ -79,6 +80,7 @@ public class EnumArrays {
}
@JsonProperty("array_enum")
private List<ArrayEnumEnum> arrayEnum = null;
public EnumArrays justSymbol(JustSymbolEnum justSymbol) {

View File

@ -46,6 +46,7 @@ public class EnumTest {
}
@JsonProperty("enum_string")
private EnumStringEnum enumString;
/**
@ -82,6 +83,8 @@ public class EnumTest {
}
@JsonProperty("enum_string_required")
@NotNull
private EnumStringRequiredEnum enumStringRequired;
/**
@ -116,6 +119,7 @@ public class EnumTest {
}
@JsonProperty("enum_integer")
private EnumIntegerEnum enumInteger;
/**
@ -150,9 +154,12 @@ public class EnumTest {
}
@JsonProperty("enum_number")
private EnumNumberEnum enumNumber;
@JsonProperty("outerEnum")
@Valid
private OuterEnum outerEnum;
public EnumTest enumString(EnumStringEnum enumString) {
@ -181,7 +188,6 @@ public class EnumTest {
* Get enumStringRequired
* @return enumStringRequired
**/
@NotNull
public EnumStringRequiredEnum getEnumStringRequired() {
return enumStringRequired;
}
@ -233,7 +239,6 @@ public class EnumTest {
* Get outerEnum
* @return outerEnum
**/
@Valid
public OuterEnum getOuterEnum() {
return outerEnum;
}

View File

@ -14,9 +14,13 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class FileSchemaTestClass {
@JsonProperty("file")
@Valid
private java.io.File file;
@JsonProperty("files")
@Valid
private List<java.io.File> files = null;
public FileSchemaTestClass file(java.io.File file) {
@ -28,7 +32,6 @@ public class FileSchemaTestClass {
* Get file
* @return file
**/
@Valid
public java.io.File getFile() {
return file;
}
@ -54,7 +57,6 @@ public class FileSchemaTestClass {
* Get files
* @return files
**/
@Valid
public List<java.io.File> getFiles() {
return files;
}

View File

@ -17,45 +17,82 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class FormatTest {
@JsonProperty("integer")
@Min(10)
@Max(100)
private Integer integer;
@JsonProperty("int32")
@Min(20)
@Max(200)
private Integer int32;
@JsonProperty("int64")
private Long int64;
@JsonProperty("number")
@NotNull
@DecimalMin("32.1")
@DecimalMax("543.2")
@Valid
private BigDecimal number;
@JsonProperty("float")
@DecimalMin("54.3")
@DecimalMax("987.6")
private Float _float;
@JsonProperty("double")
@DecimalMin("67.8")
@DecimalMax("123.4")
private Double _double;
@JsonProperty("string")
@Pattern(regexp="/[a-z]/i")
private String string;
@JsonProperty("byte")
@NotNull
@Pattern(regexp="^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$")
private byte[] _byte;
@JsonProperty("binary")
@Valid
private InputStream binary;
@JsonProperty("date")
@NotNull
@Valid
private LocalDate date;
@JsonProperty("dateTime")
@Valid
private OffsetDateTime dateTime;
@JsonProperty("uuid")
@Valid
private UUID uuid;
@JsonProperty("password")
@NotNull
@Size(min=10,max=64)
private String password;
@JsonProperty("BigDecimal")
@Valid
private BigDecimal bigDecimal;
public FormatTest integer(Integer integer) {
@ -69,8 +106,6 @@ public class FormatTest {
* maximum: 100
* @return integer
**/
@Min(10)
@Max(100)
public Integer getInteger() {
return integer;
}
@ -90,8 +125,6 @@ public class FormatTest {
* maximum: 200
* @return int32
**/
@Min(20)
@Max(200)
public Integer getInt32() {
return int32;
}
@ -128,10 +161,6 @@ public class FormatTest {
* maximum: 543.2
* @return number
**/
@NotNull
@DecimalMin("32.1")
@DecimalMax("543.2")
@Valid
public BigDecimal getNumber() {
return number;
}
@ -151,8 +180,6 @@ public class FormatTest {
* maximum: 987.6
* @return _float
**/
@DecimalMin("54.3")
@DecimalMax("987.6")
public Float getFloat() {
return _float;
}
@ -172,8 +199,6 @@ public class FormatTest {
* maximum: 123.4
* @return _double
**/
@DecimalMin("67.8")
@DecimalMax("123.4")
public Double getDouble() {
return _double;
}
@ -191,7 +216,6 @@ public class FormatTest {
* Get string
* @return string
**/
@Pattern(regexp="/[a-z]/i")
public String getString() {
return string;
}
@ -209,8 +233,6 @@ public class FormatTest {
* Get _byte
* @return _byte
**/
@NotNull
@Pattern(regexp="^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$")
public byte[] getByte() {
return _byte;
}
@ -228,7 +250,6 @@ public class FormatTest {
* Get binary
* @return binary
**/
@Valid
public InputStream getBinary() {
return binary;
}
@ -246,8 +267,6 @@ public class FormatTest {
* Get date
* @return date
**/
@NotNull
@Valid
public LocalDate getDate() {
return date;
}
@ -265,7 +284,6 @@ public class FormatTest {
* Get dateTime
* @return dateTime
**/
@Valid
public OffsetDateTime getDateTime() {
return dateTime;
}
@ -283,7 +301,6 @@ public class FormatTest {
* Get uuid
* @return uuid
**/
@Valid
public UUID getUuid() {
return uuid;
}
@ -301,8 +318,6 @@ public class FormatTest {
* Get password
* @return password
**/
@NotNull
@Size(min=10,max=64)
public String getPassword() {
return password;
}
@ -320,7 +335,6 @@ public class FormatTest {
* Get bigDecimal
* @return bigDecimal
**/
@Valid
public BigDecimal getBigDecimal() {
return bigDecimal;
}

View File

@ -12,9 +12,11 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class HasOnlyReadOnly {
@JsonProperty("bar")
private String bar;
@JsonProperty("foo")
private String foo;
public HasOnlyReadOnly bar(String bar) {

View File

@ -15,6 +15,8 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class MapTest {
@JsonProperty("map_map_of_string")
@Valid
private Map<String, Map<String, String>> mapMapOfString = null;
/**
@ -49,12 +51,15 @@ public class MapTest {
}
@JsonProperty("map_of_enum_string")
private Map<String, InnerEnum> mapOfEnumString = null;
@JsonProperty("direct_map")
private Map<String, Boolean> directMap = null;
@JsonProperty("indirect_map")
private Map<String, Boolean> indirectMap = null;
public MapTest mapMapOfString(Map<String, Map<String, String>> mapMapOfString) {
@ -74,7 +79,6 @@ public class MapTest {
* Get mapMapOfString
* @return mapMapOfString
**/
@Valid
public Map<String, Map<String, String>> getMapMapOfString() {
return mapMapOfString;
}

View File

@ -18,12 +18,18 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class MixedPropertiesAndAdditionalPropertiesClass {
@JsonProperty("uuid")
@Valid
private UUID uuid;
@JsonProperty("dateTime")
@Valid
private OffsetDateTime dateTime;
@JsonProperty("map")
@Valid
private Map<String, Animal> map = null;
public MixedPropertiesAndAdditionalPropertiesClass uuid(UUID uuid) {
@ -35,7 +41,6 @@ public class MixedPropertiesAndAdditionalPropertiesClass {
* Get uuid
* @return uuid
**/
@Valid
public UUID getUuid() {
return uuid;
}
@ -53,7 +58,6 @@ public class MixedPropertiesAndAdditionalPropertiesClass {
* Get dateTime
* @return dateTime
**/
@Valid
public OffsetDateTime getDateTime() {
return dateTime;
}
@ -79,7 +83,6 @@ public class MixedPropertiesAndAdditionalPropertiesClass {
* Get map
* @return map
**/
@Valid
public Map<String, Animal> getMap() {
return map;
}

View File

@ -12,9 +12,11 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class Model200Response {
@JsonProperty("name")
private Integer name;
@JsonProperty("class")
private String propertyClass;
public Model200Response name(Integer name) {

View File

@ -12,12 +12,15 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class ModelApiResponse {
@JsonProperty("code")
private Integer code;
@JsonProperty("type")
private String type;
@JsonProperty("message")
private String message;
public ModelApiResponse code(Integer code) {

View File

@ -12,6 +12,7 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class ModelReturn {
@JsonProperty("return")
private Integer _return;
public ModelReturn _return(Integer _return) {

View File

@ -12,15 +12,20 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class Name {
@JsonProperty("name")
@NotNull
private Integer name;
@JsonProperty("snake_case")
private Integer snakeCase;
@JsonProperty("property")
private String property;
@JsonProperty("123Number")
private Integer _123number;
public Name name(Integer name) {
@ -32,7 +37,6 @@ public class Name {
* Get name
* @return name
**/
@NotNull
public Integer getName() {
return name;
}

View File

@ -13,6 +13,8 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class NumberOnly {
@JsonProperty("JustNumber")
@Valid
private BigDecimal justNumber;
public NumberOnly justNumber(BigDecimal justNumber) {
@ -24,7 +26,6 @@ public class NumberOnly {
* Get justNumber
* @return justNumber
**/
@Valid
public BigDecimal getJustNumber() {
return justNumber;
}

View File

@ -13,15 +13,20 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class Order {
@JsonProperty("id")
private Long id;
@JsonProperty("petId")
private Long petId;
@JsonProperty("quantity")
private Integer quantity;
@JsonProperty("shipDate")
@Valid
private OffsetDateTime shipDate;
/**
@ -58,9 +63,11 @@ public class Order {
}
@JsonProperty("status")
private StatusEnum status;
@JsonProperty("complete")
private Boolean complete = false;
public Order id(Long id) {
@ -123,7 +130,6 @@ public class Order {
* Get shipDate
* @return shipDate
**/
@Valid
public OffsetDateTime getShipDate() {
return shipDate;
}

View File

@ -13,12 +13,16 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class OuterComposite {
@JsonProperty("my_number")
@Valid
private BigDecimal myNumber;
@JsonProperty("my_string")
private String myString;
@JsonProperty("my_boolean")
private Boolean myBoolean;
public OuterComposite myNumber(BigDecimal myNumber) {
@ -30,7 +34,6 @@ public class OuterComposite {
* Get myNumber
* @return myNumber
**/
@Valid
public BigDecimal getMyNumber() {
return myNumber;
}

View File

@ -18,18 +18,27 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class Pet {
@JsonProperty("id")
private Long id;
@JsonProperty("category")
@Valid
private Category category;
@JsonProperty("name")
@NotNull
private String name;
@JsonProperty("photoUrls")
@NotNull
private Set<String> photoUrls = new LinkedHashSet<>();
@JsonProperty("tags")
@Valid
private List<Tag> tags = null;
/**
@ -66,6 +75,7 @@ public class Pet {
}
@JsonProperty("status")
private StatusEnum status;
public Pet id(Long id) {
@ -94,7 +104,6 @@ public class Pet {
* Get category
* @return category
**/
@Valid
public Category getCategory() {
return category;
}
@ -112,7 +121,6 @@ public class Pet {
* Get name
* @return name
**/
@NotNull
public String getName() {
return name;
}
@ -135,7 +143,6 @@ public class Pet {
* Get photoUrls
* @return photoUrls
**/
@NotNull
public Set<String> getPhotoUrls() {
return photoUrls;
}
@ -161,7 +168,6 @@ public class Pet {
* Get tags
* @return tags
**/
@Valid
public List<Tag> getTags() {
return tags;
}

View File

@ -12,9 +12,11 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class ReadOnlyFirst {
@JsonProperty("bar")
private String bar;
@JsonProperty("baz")
private String baz;
public ReadOnlyFirst bar(String bar) {

View File

@ -12,6 +12,7 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class SpecialModelName {
@JsonProperty("$special[property.name]")
private Long $specialPropertyName;
public SpecialModelName $specialPropertyName(Long $specialPropertyName) {

View File

@ -12,9 +12,11 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class Tag {
@JsonProperty("id")
private Long id;
@JsonProperty("name")
private String name;
public Tag id(Long id) {

View File

@ -15,18 +15,29 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class TypeHolderDefault {
@JsonProperty("string_item")
@NotNull
private String stringItem = "what";
@JsonProperty("number_item")
@NotNull
@Valid
private BigDecimal numberItem;
@JsonProperty("integer_item")
@NotNull
private Integer integerItem;
@JsonProperty("bool_item")
@NotNull
private Boolean boolItem = true;
@JsonProperty("array_item")
@NotNull
private List<Integer> arrayItem = new ArrayList<>();
public TypeHolderDefault stringItem(String stringItem) {
@ -38,7 +49,6 @@ public class TypeHolderDefault {
* Get stringItem
* @return stringItem
**/
@NotNull
public String getStringItem() {
return stringItem;
}
@ -56,8 +66,6 @@ public class TypeHolderDefault {
* Get numberItem
* @return numberItem
**/
@NotNull
@Valid
public BigDecimal getNumberItem() {
return numberItem;
}
@ -75,7 +83,6 @@ public class TypeHolderDefault {
* Get integerItem
* @return integerItem
**/
@NotNull
public Integer getIntegerItem() {
return integerItem;
}
@ -93,7 +100,6 @@ public class TypeHolderDefault {
* Get boolItem
* @return boolItem
**/
@NotNull
public Boolean getBoolItem() {
return boolItem;
}
@ -116,7 +122,6 @@ public class TypeHolderDefault {
* Get arrayItem
* @return arrayItem
**/
@NotNull
public List<Integer> getArrayItem() {
return arrayItem;
}

View File

@ -15,21 +15,34 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class TypeHolderExample {
@JsonProperty("string_item")
@NotNull
private String stringItem;
@JsonProperty("number_item")
@NotNull
@Valid
private BigDecimal numberItem;
@JsonProperty("float_item")
@NotNull
private Float floatItem;
@JsonProperty("integer_item")
@NotNull
private Integer integerItem;
@JsonProperty("bool_item")
@NotNull
private Boolean boolItem;
@JsonProperty("array_item")
@NotNull
private List<Integer> arrayItem = new ArrayList<>();
public TypeHolderExample stringItem(String stringItem) {
@ -41,7 +54,6 @@ public class TypeHolderExample {
* Get stringItem
* @return stringItem
**/
@NotNull
public String getStringItem() {
return stringItem;
}
@ -59,8 +71,6 @@ public class TypeHolderExample {
* Get numberItem
* @return numberItem
**/
@NotNull
@Valid
public BigDecimal getNumberItem() {
return numberItem;
}
@ -78,7 +88,6 @@ public class TypeHolderExample {
* Get floatItem
* @return floatItem
**/
@NotNull
public Float getFloatItem() {
return floatItem;
}
@ -96,7 +105,6 @@ public class TypeHolderExample {
* Get integerItem
* @return integerItem
**/
@NotNull
public Integer getIntegerItem() {
return integerItem;
}
@ -114,7 +122,6 @@ public class TypeHolderExample {
* Get boolItem
* @return boolItem
**/
@NotNull
public Boolean getBoolItem() {
return boolItem;
}
@ -137,7 +144,6 @@ public class TypeHolderExample {
* Get arrayItem
* @return arrayItem
**/
@NotNull
public List<Integer> getArrayItem() {
return arrayItem;
}

View File

@ -12,27 +12,35 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class User {
@JsonProperty("id")
private Long id;
@JsonProperty("username")
private String username;
@JsonProperty("firstName")
private String firstName;
@JsonProperty("lastName")
private String lastName;
@JsonProperty("email")
private String email;
@JsonProperty("password")
private String password;
@JsonProperty("phone")
private String phone;
@JsonProperty("userStatus")
private Integer userStatus;
public User id(Long id) {

View File

@ -15,90 +15,124 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class XmlItem {
@JsonProperty("attribute_string")
private String attributeString;
@JsonProperty("attribute_number")
@Valid
private BigDecimal attributeNumber;
@JsonProperty("attribute_integer")
private Integer attributeInteger;
@JsonProperty("attribute_boolean")
private Boolean attributeBoolean;
@JsonProperty("wrapped_array")
private List<Integer> wrappedArray = null;
@JsonProperty("name_string")
private String nameString;
@JsonProperty("name_number")
@Valid
private BigDecimal nameNumber;
@JsonProperty("name_integer")
private Integer nameInteger;
@JsonProperty("name_boolean")
private Boolean nameBoolean;
@JsonProperty("name_array")
private List<Integer> nameArray = null;
@JsonProperty("name_wrapped_array")
private List<Integer> nameWrappedArray = null;
@JsonProperty("prefix_string")
private String prefixString;
@JsonProperty("prefix_number")
@Valid
private BigDecimal prefixNumber;
@JsonProperty("prefix_integer")
private Integer prefixInteger;
@JsonProperty("prefix_boolean")
private Boolean prefixBoolean;
@JsonProperty("prefix_array")
private List<Integer> prefixArray = null;
@JsonProperty("prefix_wrapped_array")
private List<Integer> prefixWrappedArray = null;
@JsonProperty("namespace_string")
private String namespaceString;
@JsonProperty("namespace_number")
@Valid
private BigDecimal namespaceNumber;
@JsonProperty("namespace_integer")
private Integer namespaceInteger;
@JsonProperty("namespace_boolean")
private Boolean namespaceBoolean;
@JsonProperty("namespace_array")
private List<Integer> namespaceArray = null;
@JsonProperty("namespace_wrapped_array")
private List<Integer> namespaceWrappedArray = null;
@JsonProperty("prefix_ns_string")
private String prefixNsString;
@JsonProperty("prefix_ns_number")
@Valid
private BigDecimal prefixNsNumber;
@JsonProperty("prefix_ns_integer")
private Integer prefixNsInteger;
@JsonProperty("prefix_ns_boolean")
private Boolean prefixNsBoolean;
@JsonProperty("prefix_ns_array")
private List<Integer> prefixNsArray = null;
@JsonProperty("prefix_ns_wrapped_array")
private List<Integer> prefixNsWrappedArray = null;
public XmlItem attributeString(String attributeString) {
@ -127,7 +161,6 @@ public class XmlItem {
* Get attributeNumber
* @return attributeNumber
**/
@Valid
public BigDecimal getAttributeNumber() {
return attributeNumber;
}
@ -221,7 +254,6 @@ public class XmlItem {
* Get nameNumber
* @return nameNumber
**/
@Valid
public BigDecimal getNameNumber() {
return nameNumber;
}
@ -340,7 +372,6 @@ public class XmlItem {
* Get prefixNumber
* @return prefixNumber
**/
@Valid
public BigDecimal getPrefixNumber() {
return prefixNumber;
}
@ -459,7 +490,6 @@ public class XmlItem {
* Get namespaceNumber
* @return namespaceNumber
**/
@Valid
public BigDecimal getNamespaceNumber() {
return namespaceNumber;
}
@ -578,7 +608,6 @@ public class XmlItem {
* Get prefixNsNumber
* @return prefixNsNumber
**/
@Valid
public BigDecimal getPrefixNsNumber() {
return prefixNsNumber;
}

View File

@ -7,5 +7,5 @@ lazy val root = (project in file(".")).enablePlugins(PlayJava)
scalaVersion := "2.12.6"
libraryDependencies += "org.webjars" % "swagger-ui" % "3.32.5"
libraryDependencies += "javax.validation" % "validation-api" % "1.1.0.Final"
libraryDependencies += "javax.validation" % "validation-api" % "2.0.1.Final"
libraryDependencies += guice

View File

@ -12,9 +12,11 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class Category {
@JsonProperty("id")
private Long id;
@JsonProperty("name")
private String name;
public Category id(Long id) {

View File

@ -12,12 +12,15 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class ModelApiResponse {
@JsonProperty("code")
private Integer code;
@JsonProperty("type")
private String type;
@JsonProperty("message")
private String message;
public ModelApiResponse code(Integer code) {

View File

@ -13,15 +13,20 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class Order {
@JsonProperty("id")
private Long id;
@JsonProperty("petId")
private Long petId;
@JsonProperty("quantity")
private Integer quantity;
@JsonProperty("shipDate")
@Valid
private OffsetDateTime shipDate;
/**
@ -58,9 +63,11 @@ public class Order {
}
@JsonProperty("status")
private StatusEnum status;
@JsonProperty("complete")
private Boolean complete = false;
public Order id(Long id) {
@ -123,7 +130,6 @@ public class Order {
* Get shipDate
* @return shipDate
**/
@Valid
public OffsetDateTime getShipDate() {
return shipDate;
}

View File

@ -16,18 +16,27 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class Pet {
@JsonProperty("id")
private Long id;
@JsonProperty("category")
@Valid
private Category category;
@JsonProperty("name")
@NotNull
private String name;
@JsonProperty("photoUrls")
@NotNull
private List<String> photoUrls = new ArrayList<>();
@JsonProperty("tags")
@Valid
private List<Tag> tags = null;
/**
@ -64,6 +73,7 @@ public class Pet {
}
@JsonProperty("status")
private StatusEnum status;
public Pet id(Long id) {
@ -92,7 +102,6 @@ public class Pet {
* Get category
* @return category
**/
@Valid
public Category getCategory() {
return category;
}
@ -110,7 +119,6 @@ public class Pet {
* Get name
* @return name
**/
@NotNull
public String getName() {
return name;
}
@ -133,7 +141,6 @@ public class Pet {
* Get photoUrls
* @return photoUrls
**/
@NotNull
public List<String> getPhotoUrls() {
return photoUrls;
}
@ -159,7 +166,6 @@ public class Pet {
* Get tags
* @return tags
**/
@Valid
public List<Tag> getTags() {
return tags;
}

View File

@ -12,9 +12,11 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class Tag {
@JsonProperty("id")
private Long id;
@JsonProperty("name")
private String name;
public Tag id(Long id) {

View File

@ -12,27 +12,35 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class User {
@JsonProperty("id")
private Long id;
@JsonProperty("username")
private String username;
@JsonProperty("firstName")
private String firstName;
@JsonProperty("lastName")
private String lastName;
@JsonProperty("email")
private String email;
@JsonProperty("password")
private String password;
@JsonProperty("phone")
private String phone;
@JsonProperty("userStatus")
private Integer userStatus;
public User id(Long id) {

View File

@ -7,5 +7,5 @@ lazy val root = (project in file(".")).enablePlugins(PlayJava)
scalaVersion := "2.12.6"
libraryDependencies += "org.webjars" % "swagger-ui" % "3.32.5"
libraryDependencies += "javax.validation" % "validation-api" % "1.1.0.Final"
libraryDependencies += "javax.validation" % "validation-api" % "2.0.1.Final"
libraryDependencies += guice

View File

@ -12,9 +12,11 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class Category {
@JsonProperty("id")
private Long id;
@JsonProperty("name")
private String name;
public Category id(Long id) {

View File

@ -12,12 +12,15 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class ModelApiResponse {
@JsonProperty("code")
private Integer code;
@JsonProperty("type")
private String type;
@JsonProperty("message")
private String message;
public ModelApiResponse code(Integer code) {

View File

@ -13,15 +13,20 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class Order {
@JsonProperty("id")
private Long id;
@JsonProperty("petId")
private Long petId;
@JsonProperty("quantity")
private Integer quantity;
@JsonProperty("shipDate")
@Valid
private OffsetDateTime shipDate;
/**
@ -58,9 +63,11 @@ public class Order {
}
@JsonProperty("status")
private StatusEnum status;
@JsonProperty("complete")
private Boolean complete = false;
public Order id(Long id) {
@ -123,7 +130,6 @@ public class Order {
* Get shipDate
* @return shipDate
**/
@Valid
public OffsetDateTime getShipDate() {
return shipDate;
}

View File

@ -16,18 +16,27 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class Pet {
@JsonProperty("id")
private Long id;
@JsonProperty("category")
@Valid
private Category category;
@JsonProperty("name")
@NotNull
private String name;
@JsonProperty("photoUrls")
@NotNull
private List<String> photoUrls = new ArrayList<>();
@JsonProperty("tags")
@Valid
private List<Tag> tags = null;
/**
@ -64,6 +73,7 @@ public class Pet {
}
@JsonProperty("status")
private StatusEnum status;
public Pet id(Long id) {
@ -92,7 +102,6 @@ public class Pet {
* Get category
* @return category
**/
@Valid
public Category getCategory() {
return category;
}
@ -110,7 +119,6 @@ public class Pet {
* Get name
* @return name
**/
@NotNull
public String getName() {
return name;
}
@ -133,7 +141,6 @@ public class Pet {
* Get photoUrls
* @return photoUrls
**/
@NotNull
public List<String> getPhotoUrls() {
return photoUrls;
}
@ -159,7 +166,6 @@ public class Pet {
* Get tags
* @return tags
**/
@Valid
public List<Tag> getTags() {
return tags;
}

View File

@ -12,9 +12,11 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class Tag {
@JsonProperty("id")
private Long id;
@JsonProperty("name")
private String name;
public Tag id(Long id) {

View File

@ -12,27 +12,35 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class User {
@JsonProperty("id")
private Long id;
@JsonProperty("username")
private String username;
@JsonProperty("firstName")
private String firstName;
@JsonProperty("lastName")
private String lastName;
@JsonProperty("email")
private String email;
@JsonProperty("password")
private String password;
@JsonProperty("phone")
private String phone;
@JsonProperty("userStatus")
private Integer userStatus;
public User id(Long id) {

View File

@ -7,5 +7,5 @@ lazy val root = (project in file(".")).enablePlugins(PlayJava)
scalaVersion := "2.12.6"
libraryDependencies += "org.webjars" % "swagger-ui" % "3.32.5"
libraryDependencies += "javax.validation" % "validation-api" % "1.1.0.Final"
libraryDependencies += "javax.validation" % "validation-api" % "2.0.1.Final"
libraryDependencies += guice

View File

@ -12,9 +12,11 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class Category {
@JsonProperty("id")
private Long id;
@JsonProperty("name")
private String name;
public Category id(Long id) {

View File

@ -12,12 +12,15 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class ModelApiResponse {
@JsonProperty("code")
private Integer code;
@JsonProperty("type")
private String type;
@JsonProperty("message")
private String message;
public ModelApiResponse code(Integer code) {

View File

@ -13,15 +13,20 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class Order {
@JsonProperty("id")
private Long id;
@JsonProperty("petId")
private Long petId;
@JsonProperty("quantity")
private Integer quantity;
@JsonProperty("shipDate")
@Valid
private OffsetDateTime shipDate;
/**
@ -58,9 +63,11 @@ public class Order {
}
@JsonProperty("status")
private StatusEnum status;
@JsonProperty("complete")
private Boolean complete = false;
public Order id(Long id) {
@ -123,7 +130,6 @@ public class Order {
* Get shipDate
* @return shipDate
**/
@Valid
public OffsetDateTime getShipDate() {
return shipDate;
}

View File

@ -16,18 +16,27 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class Pet {
@JsonProperty("id")
private Long id;
@JsonProperty("category")
@Valid
private Category category;
@JsonProperty("name")
@NotNull
private String name;
@JsonProperty("photoUrls")
@NotNull
private List<String> photoUrls = new ArrayList<>();
@JsonProperty("tags")
@Valid
private List<Tag> tags = null;
/**
@ -64,6 +73,7 @@ public class Pet {
}
@JsonProperty("status")
private StatusEnum status;
public Pet id(Long id) {
@ -92,7 +102,6 @@ public class Pet {
* Get category
* @return category
**/
@Valid
public Category getCategory() {
return category;
}
@ -110,7 +119,6 @@ public class Pet {
* Get name
* @return name
**/
@NotNull
public String getName() {
return name;
}
@ -133,7 +141,6 @@ public class Pet {
* Get photoUrls
* @return photoUrls
**/
@NotNull
public List<String> getPhotoUrls() {
return photoUrls;
}
@ -159,7 +166,6 @@ public class Pet {
* Get tags
* @return tags
**/
@Valid
public List<Tag> getTags() {
return tags;
}

View File

@ -12,9 +12,11 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class Tag {
@JsonProperty("id")
private Long id;
@JsonProperty("name")
private String name;
public Tag id(Long id) {

View File

@ -12,27 +12,35 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class User {
@JsonProperty("id")
private Long id;
@JsonProperty("username")
private String username;
@JsonProperty("firstName")
private String firstName;
@JsonProperty("lastName")
private String lastName;
@JsonProperty("email")
private String email;
@JsonProperty("password")
private String password;
@JsonProperty("phone")
private String phone;
@JsonProperty("userStatus")
private Integer userStatus;
public User id(Long id) {

View File

@ -7,5 +7,5 @@ lazy val root = (project in file(".")).enablePlugins(PlayJava)
scalaVersion := "2.12.6"
libraryDependencies += "org.webjars" % "swagger-ui" % "3.32.5"
libraryDependencies += "javax.validation" % "validation-api" % "1.1.0.Final"
libraryDependencies += "javax.validation" % "validation-api" % "2.0.1.Final"
libraryDependencies += guice

View File

@ -12,9 +12,11 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class Category {
@JsonProperty("id")
private Long id;
@JsonProperty("name")
private String name;
public Category id(Long id) {

View File

@ -12,12 +12,15 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class ModelApiResponse {
@JsonProperty("code")
private Integer code;
@JsonProperty("type")
private String type;
@JsonProperty("message")
private String message;
public ModelApiResponse code(Integer code) {

View File

@ -13,15 +13,20 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class Order {
@JsonProperty("id")
private Long id;
@JsonProperty("petId")
private Long petId;
@JsonProperty("quantity")
private Integer quantity;
@JsonProperty("shipDate")
@Valid
private OffsetDateTime shipDate;
/**
@ -58,9 +63,11 @@ public class Order {
}
@JsonProperty("status")
private StatusEnum status;
@JsonProperty("complete")
private Boolean complete = false;
public Order id(Long id) {
@ -123,7 +130,6 @@ public class Order {
* Get shipDate
* @return shipDate
**/
@Valid
public OffsetDateTime getShipDate() {
return shipDate;
}

View File

@ -16,18 +16,27 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class Pet {
@JsonProperty("id")
private Long id;
@JsonProperty("category")
@Valid
private Category category;
@JsonProperty("name")
@NotNull
private String name;
@JsonProperty("photoUrls")
@NotNull
private List<String> photoUrls = new ArrayList<>();
@JsonProperty("tags")
@Valid
private List<Tag> tags = null;
/**
@ -64,6 +73,7 @@ public class Pet {
}
@JsonProperty("status")
private StatusEnum status;
public Pet id(Long id) {
@ -92,7 +102,6 @@ public class Pet {
* Get category
* @return category
**/
@Valid
public Category getCategory() {
return category;
}
@ -110,7 +119,6 @@ public class Pet {
* Get name
* @return name
**/
@NotNull
public String getName() {
return name;
}
@ -133,7 +141,6 @@ public class Pet {
* Get photoUrls
* @return photoUrls
**/
@NotNull
public List<String> getPhotoUrls() {
return photoUrls;
}
@ -159,7 +166,6 @@ public class Pet {
* Get tags
* @return tags
**/
@Valid
public List<Tag> getTags() {
return tags;
}

View File

@ -12,9 +12,11 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class Tag {
@JsonProperty("id")
private Long id;
@JsonProperty("name")
private String name;
public Tag id(Long id) {

View File

@ -12,27 +12,35 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class User {
@JsonProperty("id")
private Long id;
@JsonProperty("username")
private String username;
@JsonProperty("firstName")
private String firstName;
@JsonProperty("lastName")
private String lastName;
@JsonProperty("email")
private String email;
@JsonProperty("password")
private String password;
@JsonProperty("phone")
private String phone;
@JsonProperty("userStatus")
private Integer userStatus;
public User id(Long id) {

View File

@ -6,5 +6,5 @@ lazy val root = (project in file(".")).enablePlugins(PlayJava)
scalaVersion := "2.12.6"
libraryDependencies += "javax.validation" % "validation-api" % "1.1.0.Final"
libraryDependencies += "javax.validation" % "validation-api" % "2.0.1.Final"
libraryDependencies += guice

View File

@ -12,9 +12,11 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class Category {
@JsonProperty("id")
private Long id;
@JsonProperty("name")
private String name;
public Category id(Long id) {

View File

@ -12,12 +12,15 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class ModelApiResponse {
@JsonProperty("code")
private Integer code;
@JsonProperty("type")
private String type;
@JsonProperty("message")
private String message;
public ModelApiResponse code(Integer code) {

View File

@ -13,15 +13,20 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class Order {
@JsonProperty("id")
private Long id;
@JsonProperty("petId")
private Long petId;
@JsonProperty("quantity")
private Integer quantity;
@JsonProperty("shipDate")
@Valid
private OffsetDateTime shipDate;
/**
@ -58,9 +63,11 @@ public class Order {
}
@JsonProperty("status")
private StatusEnum status;
@JsonProperty("complete")
private Boolean complete = false;
public Order id(Long id) {
@ -123,7 +130,6 @@ public class Order {
* Get shipDate
* @return shipDate
**/
@Valid
public OffsetDateTime getShipDate() {
return shipDate;
}

View File

@ -16,18 +16,27 @@ import javax.validation.constraints.*;
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class Pet {
@JsonProperty("id")
private Long id;
@JsonProperty("category")
@Valid
private Category category;
@JsonProperty("name")
@NotNull
private String name;
@JsonProperty("photoUrls")
@NotNull
private List<String> photoUrls = new ArrayList<>();
@JsonProperty("tags")
@Valid
private List<Tag> tags = null;
/**
@ -64,6 +73,7 @@ public class Pet {
}
@JsonProperty("status")
private StatusEnum status;
public Pet id(Long id) {
@ -92,7 +102,6 @@ public class Pet {
* Get category
* @return category
**/
@Valid
public Category getCategory() {
return category;
}
@ -110,7 +119,6 @@ public class Pet {
* Get name
* @return name
**/
@NotNull
public String getName() {
return name;
}
@ -133,7 +141,6 @@ public class Pet {
* Get photoUrls
* @return photoUrls
**/
@NotNull
public List<String> getPhotoUrls() {
return photoUrls;
}
@ -159,7 +166,6 @@ public class Pet {
* Get tags
* @return tags
**/
@Valid
public List<Tag> getTags() {
return tags;
}

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