[Java] Add @javax.annotation.Nonnull to required getters (#9593)

* Add @javax.annotation.Nonnull to required getters

* Add updated samples

* Consider the nullable constraint
This commit is contained in:
Marcel Stör
2021-07-19 04:48:58 +02:00
committed by GitHub
parent bd070308d9
commit c5f5d3dd6a
231 changed files with 554 additions and 0 deletions

View File

@@ -70,6 +70,7 @@ public class Animal {
* Get className
* @return className
**/
@javax.annotation.Nonnull
@ApiModelProperty(required = true, value = "")
@JsonProperty(JSON_PROPERTY_CLASS_NAME)
@JsonInclude(value = JsonInclude.Include.ALWAYS)

View File

@@ -87,6 +87,7 @@ public class Category {
* Get name
* @return name
**/
@javax.annotation.Nonnull
@ApiModelProperty(required = true, value = "")
@JsonProperty(JSON_PROPERTY_NAME)
@JsonInclude(value = JsonInclude.Include.ALWAYS)

View File

@@ -265,6 +265,7 @@ public class EnumTest {
* Get enumStringRequired
* @return enumStringRequired
**/
@javax.annotation.Nonnull
@ApiModelProperty(required = true, value = "")
@JsonProperty(JSON_PROPERTY_ENUM_STRING_REQUIRED)
@JsonInclude(value = JsonInclude.Include.ALWAYS)

View File

@@ -216,6 +216,7 @@ public class FormatTest {
* maximum: 543.2
* @return number
**/
@javax.annotation.Nonnull
@ApiModelProperty(required = true, value = "")
@JsonProperty(JSON_PROPERTY_NUMBER)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
@@ -335,6 +336,7 @@ public class FormatTest {
* Get _byte
* @return _byte
**/
@javax.annotation.Nonnull
@ApiModelProperty(required = true, value = "")
@JsonProperty(JSON_PROPERTY_BYTE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
@@ -392,6 +394,7 @@ public class FormatTest {
* Get date
* @return date
**/
@javax.annotation.Nonnull
@ApiModelProperty(required = true, value = "")
@JsonProperty(JSON_PROPERTY_DATE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
@@ -478,6 +481,7 @@ public class FormatTest {
* Get password
* @return password
**/
@javax.annotation.Nonnull
@ApiModelProperty(required = true, value = "")
@JsonProperty(JSON_PROPERTY_PASSWORD)
@JsonInclude(value = JsonInclude.Include.ALWAYS)

View File

@@ -69,6 +69,7 @@ public class Name {
* Get name
* @return name
**/
@javax.annotation.Nonnull
@ApiModelProperty(required = true, value = "")
@JsonProperty(JSON_PROPERTY_NAME)
@JsonInclude(value = JsonInclude.Include.ALWAYS)

View File

@@ -192,6 +192,7 @@ public class Pet {
* Get name
* @return name
**/
@javax.annotation.Nonnull
@ApiModelProperty(example = "doggie", required = true, value = "")
@JsonProperty(JSON_PROPERTY_NAME)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
@@ -225,6 +226,7 @@ public class Pet {
* Get photoUrls
* @return photoUrls
**/
@javax.annotation.Nonnull
@ApiModelProperty(required = true, value = "")
@JsonProperty(JSON_PROPERTY_PHOTO_URLS)
@JsonInclude(value = JsonInclude.Include.ALWAYS)

View File

@@ -79,6 +79,7 @@ public class TypeHolderDefault {
* Get stringItem
* @return stringItem
**/
@javax.annotation.Nonnull
@ApiModelProperty(required = true, value = "")
@JsonProperty(JSON_PROPERTY_STRING_ITEM)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
@@ -107,6 +108,7 @@ public class TypeHolderDefault {
* Get numberItem
* @return numberItem
**/
@javax.annotation.Nonnull
@ApiModelProperty(required = true, value = "")
@JsonProperty(JSON_PROPERTY_NUMBER_ITEM)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
@@ -135,6 +137,7 @@ public class TypeHolderDefault {
* Get integerItem
* @return integerItem
**/
@javax.annotation.Nonnull
@ApiModelProperty(required = true, value = "")
@JsonProperty(JSON_PROPERTY_INTEGER_ITEM)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
@@ -163,6 +166,7 @@ public class TypeHolderDefault {
* Get boolItem
* @return boolItem
**/
@javax.annotation.Nonnull
@ApiModelProperty(required = true, value = "")
@JsonProperty(JSON_PROPERTY_BOOL_ITEM)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
@@ -196,6 +200,7 @@ public class TypeHolderDefault {
* Get arrayItem
* @return arrayItem
**/
@javax.annotation.Nonnull
@ApiModelProperty(required = true, value = "")
@JsonProperty(JSON_PROPERTY_ARRAY_ITEM)
@JsonInclude(value = JsonInclude.Include.ALWAYS)

View File

@@ -84,6 +84,7 @@ public class TypeHolderExample {
* Get stringItem
* @return stringItem
**/
@javax.annotation.Nonnull
@ApiModelProperty(example = "what", required = true, value = "")
@JsonProperty(JSON_PROPERTY_STRING_ITEM)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
@@ -112,6 +113,7 @@ public class TypeHolderExample {
* Get numberItem
* @return numberItem
**/
@javax.annotation.Nonnull
@ApiModelProperty(example = "1.234", required = true, value = "")
@JsonProperty(JSON_PROPERTY_NUMBER_ITEM)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
@@ -140,6 +142,7 @@ public class TypeHolderExample {
* Get floatItem
* @return floatItem
**/
@javax.annotation.Nonnull
@ApiModelProperty(example = "1.234", required = true, value = "")
@JsonProperty(JSON_PROPERTY_FLOAT_ITEM)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
@@ -168,6 +171,7 @@ public class TypeHolderExample {
* Get integerItem
* @return integerItem
**/
@javax.annotation.Nonnull
@ApiModelProperty(example = "-2", required = true, value = "")
@JsonProperty(JSON_PROPERTY_INTEGER_ITEM)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
@@ -196,6 +200,7 @@ public class TypeHolderExample {
* Get boolItem
* @return boolItem
**/
@javax.annotation.Nonnull
@ApiModelProperty(example = "true", required = true, value = "")
@JsonProperty(JSON_PROPERTY_BOOL_ITEM)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
@@ -229,6 +234,7 @@ public class TypeHolderExample {
* Get arrayItem
* @return arrayItem
**/
@javax.annotation.Nonnull
@ApiModelProperty(example = "[0, 1, 2, 3]", required = true, value = "")
@JsonProperty(JSON_PROPERTY_ARRAY_ITEM)
@JsonInclude(value = JsonInclude.Include.ALWAYS)