[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

@@ -63,6 +63,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

@@ -78,6 +78,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

@@ -235,6 +235,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

@@ -191,6 +191,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)
@@ -302,6 +303,7 @@ public class FormatTest {
* Get _byte
* @return _byte
**/
@javax.annotation.Nonnull
@ApiModelProperty(required = true, value = "")
@JsonProperty(JSON_PROPERTY_BYTE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
@@ -355,6 +357,7 @@ public class FormatTest {
* Get date
* @return date
**/
@javax.annotation.Nonnull
@ApiModelProperty(required = true, value = "")
@JsonProperty(JSON_PROPERTY_DATE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
@@ -435,6 +438,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

@@ -60,6 +60,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

@@ -164,6 +164,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)
@@ -195,6 +196,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

@@ -66,6 +66,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)
@@ -92,6 +93,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)
@@ -118,6 +120,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)
@@ -144,6 +147,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)
@@ -175,6 +179,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

@@ -70,6 +70,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)
@@ -96,6 +97,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)
@@ -122,6 +124,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)
@@ -148,6 +151,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)
@@ -174,6 +178,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)
@@ -205,6 +210,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)