add validations to R models (#13157)

This commit is contained in:
William Cheng 2022-08-12 17:09:36 +08:00 committed by GitHub
parent 456d7d0159
commit 123f92d136
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
37 changed files with 1033 additions and 3 deletions

View File

@ -607,6 +607,7 @@ public class RClientCodegen extends DefaultCodegen implements CodegenConfig {
this.operationIdNaming = operationIdNaming; this.operationIdNaming = operationIdNaming;
} }
@Override @Override
public String escapeQuotationMark(String input) { public String escapeQuotationMark(String input) {
// remove " to avoid code injection // remove " to avoid code injection
@ -952,8 +953,8 @@ public class RClientCodegen extends DefaultCodegen implements CodegenConfig {
} }
// remove trailing '/' // remove trailing '/'
if (pattern.charAt(pattern.length()-1) == '/') { if (pattern.charAt(pattern.length() - 1) == '/') {
pattern = pattern.substring(0, pattern.length()-1); pattern = pattern.substring(0, pattern.length() - 1);
} }
return escapeText(pattern); return escapeText(pattern);

View File

@ -354,6 +354,125 @@
#' @export #' @export
toString = function() { toString = function() {
self$toJSONString() self$toJSONString()
},
#' Return true if the values in all fields are valid.
#'
#' @description
#' Return true if the values in all fields are valid.
#'
#' @return true if the values in all fields are valid.
#' @export
isValid = function() {
{{#allVars}}
{{^isNullable}}
{{#required}}
# check if the required `{{{name}}}` is null
if (is.null(`{{{name}}}`)) {
FALSE
}
{{/required}}
{{/isNullable}}
{{#hasValidation}}
{{#maxLength}}
if (nchar(`{{{name}}}`) > {{maxLength}}) {
FALSE
}
{{/maxLength}}
{{#minLength}}
if (nchar(`{{{name}}}`) < {{minLength}}) {
FALSE
}
{{/minLength}}
{{#maximum}}
if (`{{{name}}}` >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{maximum}}) {
FALSE
}
{{/maximum}}
{{#minimum}}
if (`{{{name}}}` <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{minimum}}) {
FALSE
}
{{/minimum}}
{{#pattern}}
if (!str_detect(`{{{name}}}`, "{{{pattern}}}")) {
FALSE
}
{{/pattern}}
{{#maxItems}}
if (length(`{{{name}}}`) > {{maxItems}}) {
FALSE
}
{{/maxItems}}
{{#minItems}}
if (length(`{{{name}}}`) < {{minItems}}) {
FALSE
}
{{/minItems}}
{{/hasValidation}}
{{/allVars}}
TRUE
},
#' Return a list of invalid fields (if any).
#'
#' @description
#' Return a list of invalid fields (if any).
#'
#' @return A list of invalid fields (if any).
#' @export
getInvalidFields = function() {
invalid_fields <- list()
{{#allVars}}
{{^isNullable}}
{{#required}}
# check if the required `{{{name}}}` is null
if (is.null(`{{{name}}}`)) {
invalid_fields[`{{{name}}}`] = "Non-nullable required field `{{{name}}}` cannot be null."
}
{{/required}}
{{/isNullable}}
{{#hasValidation}}
{{#maxLength}}
if (nchar(`{{{name}}}`) > {{maxLength}}) {
invalid_fields[`{{{name}}}`] = "Invalid length for `{{{name}}}`, must be smaller than or equal to {{maxLength}}."
}
{{/maxLength}}
{{#minLength}}
if (nchar(`{{{name}}}`) < {{minLength}}) {
invalid_fields[`{{{name}}}`] = "Invalid length for `{{{name}}}`, must be bigger than or equal to {{minLength}}."
}
{{/minLength}}
{{#maximum}}
if (`{{{name}}}` >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{maximum}}) {
invalid_fields[`{{{name}}}`] = "Invalid value for `{{{name}}}`, must be smaller than {{^exclusiveMaximum}}or equal to {{/exclusiveMaximum}}{{maximum}}."
}
{{/maximum}}
{{#minimum}}
if (`{{{name}}}` <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{minimum}}) {
invalid_fields[`{{{name}}}`] = "Invalid value for `{{{name}}}`, must be bigger than {{^exclusiveMinimum}}or equal to {{/exclusiveMinimum}}{{minimum}}."
}
{{/minimum}}
{{#pattern}}
if (!str_detect(`{{{name}}}`, "{{{pattern}}}")) {
invalid_fields[`{{{name}}}`] = "Invalid value for `{{{name}}}`, must conform to the pattern {{{pattern}}}."
}
{{/pattern}}
{{#maxItems}}
if (length(`{{{name}}}`) > {{maxItems}}) {
invalid_fields[`{{{name}}}`] = "Invalid length for `{{{name}}}`, number of items must be less than or equal to {{maxItems}}."
}
{{/maxItems}}
{{#minItems}}
if (length(`{{{name}}}`) < {{minItems}}) {
invalid_fields[`{{{name}}}`] = "Invalid length for `{{{param}}}`, number of items must be greater than or equal to {{minItems}}."
}
{{/minItems}}
{{/hasValidation}}
{{/allVars}}
invalid_fields
} }
) )
) )

View File

@ -210,6 +210,27 @@ AllofTagApiResponse <- R6::R6Class(
#' @export #' @export
toString = function() { toString = function() {
self$toJSONString() self$toJSONString()
},
#' Return true if the values in all fields are valid.
#'
#' @description
#' Return true if the values in all fields are valid.
#'
#' @return true if the values in all fields are valid.
#' @export
isValid = function() {
TRUE
},
#' Return a list of invalid fields (if any).
#'
#' @description
#' Return a list of invalid fields (if any).
#'
#' @return A list of invalid fields (if any).
#' @export
getInvalidFields = function() {
invalid_fields <- list()
invalid_fields
} }
) )
) )

View File

@ -147,6 +147,37 @@ Animal <- R6::R6Class(
#' @export #' @export
toString = function() { toString = function() {
self$toJSONString() self$toJSONString()
},
#' Return true if the values in all fields are valid.
#'
#' @description
#' Return true if the values in all fields are valid.
#'
#' @return true if the values in all fields are valid.
#' @export
isValid = function() {
# check if the required `className` is null
if (is.null(`className`)) {
FALSE
}
TRUE
},
#' Return a list of invalid fields (if any).
#'
#' @description
#' Return a list of invalid fields (if any).
#'
#' @return A list of invalid fields (if any).
#' @export
getInvalidFields = function() {
invalid_fields <- list()
# check if the required `className` is null
if (is.null(`className`)) {
invalid_fields[`className`] = "Non-nullable required field `className` cannot be null."
}
invalid_fields
} }
) )
) )

View File

@ -153,6 +153,47 @@ BasquePig <- R6::R6Class(
#' @export #' @export
toString = function() { toString = function() {
self$toJSONString() self$toJSONString()
},
#' Return true if the values in all fields are valid.
#'
#' @description
#' Return true if the values in all fields are valid.
#'
#' @return true if the values in all fields are valid.
#' @export
isValid = function() {
# check if the required `className` is null
if (is.null(`className`)) {
FALSE
}
# check if the required `color` is null
if (is.null(`color`)) {
FALSE
}
TRUE
},
#' Return a list of invalid fields (if any).
#'
#' @description
#' Return a list of invalid fields (if any).
#'
#' @return A list of invalid fields (if any).
#' @export
getInvalidFields = function() {
invalid_fields <- list()
# check if the required `className` is null
if (is.null(`className`)) {
invalid_fields[`className`] = "Non-nullable required field `className` cannot be null."
}
# check if the required `color` is null
if (is.null(`color`)) {
invalid_fields[`color`] = "Non-nullable required field `color` cannot be null."
}
invalid_fields
} }
) )
) )

View File

@ -171,6 +171,37 @@ Cat <- R6::R6Class(
#' @export #' @export
toString = function() { toString = function() {
self$toJSONString() self$toJSONString()
},
#' Return true if the values in all fields are valid.
#'
#' @description
#' Return true if the values in all fields are valid.
#'
#' @return true if the values in all fields are valid.
#' @export
isValid = function() {
# check if the required `className` is null
if (is.null(`className`)) {
FALSE
}
TRUE
},
#' Return a list of invalid fields (if any).
#'
#' @description
#' Return a list of invalid fields (if any).
#'
#' @return A list of invalid fields (if any).
#' @export
getInvalidFields = function() {
invalid_fields <- list()
# check if the required `className` is null
if (is.null(`className`)) {
invalid_fields[`className`] = "Non-nullable required field `className` cannot be null."
}
invalid_fields
} }
) )
) )

View File

@ -118,6 +118,27 @@ CatAllOf <- R6::R6Class(
#' @export #' @export
toString = function() { toString = function() {
self$toJSONString() self$toJSONString()
},
#' Return true if the values in all fields are valid.
#'
#' @description
#' Return true if the values in all fields are valid.
#'
#' @return true if the values in all fields are valid.
#' @export
isValid = function() {
TRUE
},
#' Return a list of invalid fields (if any).
#'
#' @description
#' Return a list of invalid fields (if any).
#'
#' @return A list of invalid fields (if any).
#' @export
getInvalidFields = function() {
invalid_fields <- list()
invalid_fields
} }
) )
) )

View File

@ -141,6 +141,35 @@ Category <- R6::R6Class(
#' @export #' @export
toString = function() { toString = function() {
self$toJSONString() self$toJSONString()
},
#' Return true if the values in all fields are valid.
#'
#' @description
#' Return true if the values in all fields are valid.
#'
#' @return true if the values in all fields are valid.
#' @export
isValid = function() {
if (!str_detect(`name`, "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$")) {
FALSE
}
TRUE
},
#' Return a list of invalid fields (if any).
#'
#' @description
#' Return a list of invalid fields (if any).
#'
#' @return A list of invalid fields (if any).
#' @export
getInvalidFields = function() {
invalid_fields <- list()
if (!str_detect(`name`, "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$")) {
invalid_fields[`name`] = "Invalid value for `name`, must conform to the pattern ^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$."
}
invalid_fields
} }
) )
) )

View File

@ -153,6 +153,47 @@ DanishPig <- R6::R6Class(
#' @export #' @export
toString = function() { toString = function() {
self$toJSONString() self$toJSONString()
},
#' Return true if the values in all fields are valid.
#'
#' @description
#' Return true if the values in all fields are valid.
#'
#' @return true if the values in all fields are valid.
#' @export
isValid = function() {
# check if the required `className` is null
if (is.null(`className`)) {
FALSE
}
# check if the required `size` is null
if (is.null(`size`)) {
FALSE
}
TRUE
},
#' Return a list of invalid fields (if any).
#'
#' @description
#' Return a list of invalid fields (if any).
#'
#' @return A list of invalid fields (if any).
#' @export
getInvalidFields = function() {
invalid_fields <- list()
# check if the required `className` is null
if (is.null(`className`)) {
invalid_fields[`className`] = "Non-nullable required field `className` cannot be null."
}
# check if the required `size` is null
if (is.null(`size`)) {
invalid_fields[`size`] = "Non-nullable required field `size` cannot be null."
}
invalid_fields
} }
) )
) )

View File

@ -171,6 +171,37 @@ Dog <- R6::R6Class(
#' @export #' @export
toString = function() { toString = function() {
self$toJSONString() self$toJSONString()
},
#' Return true if the values in all fields are valid.
#'
#' @description
#' Return true if the values in all fields are valid.
#'
#' @return true if the values in all fields are valid.
#' @export
isValid = function() {
# check if the required `className` is null
if (is.null(`className`)) {
FALSE
}
TRUE
},
#' Return a list of invalid fields (if any).
#'
#' @description
#' Return a list of invalid fields (if any).
#'
#' @return A list of invalid fields (if any).
#' @export
getInvalidFields = function() {
invalid_fields <- list()
# check if the required `className` is null
if (is.null(`className`)) {
invalid_fields[`className`] = "Non-nullable required field `className` cannot be null."
}
invalid_fields
} }
) )
) )

View File

@ -118,6 +118,27 @@ DogAllOf <- R6::R6Class(
#' @export #' @export
toString = function() { toString = function() {
self$toJSONString() self$toJSONString()
},
#' Return true if the values in all fields are valid.
#'
#' @description
#' Return true if the values in all fields are valid.
#'
#' @return true if the values in all fields are valid.
#' @export
isValid = function() {
TRUE
},
#' Return a list of invalid fields (if any).
#'
#' @description
#' Return a list of invalid fields (if any).
#'
#' @return A list of invalid fields (if any).
#' @export
getInvalidFields = function() {
invalid_fields <- list()
invalid_fields
} }
) )
) )

View File

@ -164,6 +164,27 @@ ModelApiResponse <- R6::R6Class(
#' @export #' @export
toString = function() { toString = function() {
self$toJSONString() self$toJSONString()
},
#' Return true if the values in all fields are valid.
#'
#' @description
#' Return true if the values in all fields are valid.
#'
#' @return true if the values in all fields are valid.
#' @export
isValid = function() {
TRUE
},
#' Return a list of invalid fields (if any).
#'
#' @description
#' Return a list of invalid fields (if any).
#'
#' @return A list of invalid fields (if any).
#' @export
getInvalidFields = function() {
invalid_fields <- list()
invalid_fields
} }
) )
) )

View File

@ -143,6 +143,27 @@ NestedOneOf <- R6::R6Class(
#' @export #' @export
toString = function() { toString = function() {
self$toJSONString() self$toJSONString()
},
#' Return true if the values in all fields are valid.
#'
#' @description
#' Return true if the values in all fields are valid.
#'
#' @return true if the values in all fields are valid.
#' @export
isValid = function() {
TRUE
},
#' Return a list of invalid fields (if any).
#'
#' @description
#' Return a list of invalid fields (if any).
#'
#' @return A list of invalid fields (if any).
#' @export
getInvalidFields = function() {
invalid_fields <- list()
invalid_fields
} }
) )
) )

View File

@ -233,6 +233,27 @@ Order <- R6::R6Class(
#' @export #' @export
toString = function() { toString = function() {
self$toJSONString() self$toJSONString()
},
#' Return true if the values in all fields are valid.
#'
#' @description
#' Return true if the values in all fields are valid.
#'
#' @return true if the values in all fields are valid.
#' @export
isValid = function() {
TRUE
},
#' Return a list of invalid fields (if any).
#'
#' @description
#' Return a list of invalid fields (if any).
#'
#' @return A list of invalid fields (if any).
#' @export
getInvalidFields = function() {
invalid_fields <- list()
invalid_fields
} }
) )
) )

View File

@ -250,6 +250,47 @@ Pet <- R6::R6Class(
#' @export #' @export
toString = function() { toString = function() {
self$toJSONString() self$toJSONString()
},
#' Return true if the values in all fields are valid.
#'
#' @description
#' Return true if the values in all fields are valid.
#'
#' @return true if the values in all fields are valid.
#' @export
isValid = function() {
# check if the required `name` is null
if (is.null(`name`)) {
FALSE
}
# check if the required `photoUrls` is null
if (is.null(`photoUrls`)) {
FALSE
}
TRUE
},
#' Return a list of invalid fields (if any).
#'
#' @description
#' Return a list of invalid fields (if any).
#'
#' @return A list of invalid fields (if any).
#' @export
getInvalidFields = function() {
invalid_fields <- list()
# check if the required `name` is null
if (is.null(`name`)) {
invalid_fields[`name`] = "Non-nullable required field `name` cannot be null."
}
# check if the required `photoUrls` is null
if (is.null(`photoUrls`)) {
invalid_fields[`photoUrls`] = "Non-nullable required field `photoUrls` cannot be null."
}
invalid_fields
} }
) )
) )

View File

@ -233,6 +233,27 @@ Special <- R6::R6Class(
#' @export #' @export
toString = function() { toString = function() {
self$toJSONString() self$toJSONString()
},
#' Return true if the values in all fields are valid.
#'
#' @description
#' Return true if the values in all fields are valid.
#'
#' @return true if the values in all fields are valid.
#' @export
isValid = function() {
TRUE
},
#' Return a list of invalid fields (if any).
#'
#' @description
#' Return a list of invalid fields (if any).
#'
#' @return A list of invalid fields (if any).
#' @export
getInvalidFields = function() {
invalid_fields <- list()
invalid_fields
} }
) )
) )

View File

@ -141,6 +141,27 @@ Tag <- R6::R6Class(
#' @export #' @export
toString = function() { toString = function() {
self$toJSONString() self$toJSONString()
},
#' Return true if the values in all fields are valid.
#'
#' @description
#' Return true if the values in all fields are valid.
#'
#' @return true if the values in all fields are valid.
#' @export
isValid = function() {
TRUE
},
#' Return a list of invalid fields (if any).
#'
#' @description
#' Return a list of invalid fields (if any).
#'
#' @return A list of invalid fields (if any).
#' @export
getInvalidFields = function() {
invalid_fields <- list()
invalid_fields
} }
) )
) )

View File

@ -142,6 +142,27 @@ UpdatePetRequest <- R6::R6Class(
#' @export #' @export
toString = function() { toString = function() {
self$toJSONString() self$toJSONString()
},
#' Return true if the values in all fields are valid.
#'
#' @description
#' Return true if the values in all fields are valid.
#'
#' @return true if the values in all fields are valid.
#' @export
isValid = function() {
TRUE
},
#' Return a list of invalid fields (if any).
#'
#' @description
#' Return a list of invalid fields (if any).
#'
#' @return A list of invalid fields (if any).
#' @export
getInvalidFields = function() {
invalid_fields <- list()
invalid_fields
} }
) )
) )

View File

@ -279,6 +279,27 @@ User <- R6::R6Class(
#' @export #' @export
toString = function() { toString = function() {
self$toJSONString() self$toJSONString()
},
#' Return true if the values in all fields are valid.
#'
#' @description
#' Return true if the values in all fields are valid.
#'
#' @return true if the values in all fields are valid.
#' @export
isValid = function() {
TRUE
},
#' Return a list of invalid fields (if any).
#'
#' @description
#' Return a list of invalid fields (if any).
#'
#' @return A list of invalid fields (if any).
#' @export
getInvalidFields = function() {
invalid_fields <- list()
invalid_fields
} }
) )
) )

View File

@ -210,6 +210,27 @@ AllofTagApiResponse <- R6::R6Class(
#' @export #' @export
toString = function() { toString = function() {
self$toJSONString() self$toJSONString()
},
#' Return true if the values in all fields are valid.
#'
#' @description
#' Return true if the values in all fields are valid.
#'
#' @return true if the values in all fields are valid.
#' @export
isValid = function() {
TRUE
},
#' Return a list of invalid fields (if any).
#'
#' @description
#' Return a list of invalid fields (if any).
#'
#' @return A list of invalid fields (if any).
#' @export
getInvalidFields = function() {
invalid_fields <- list()
invalid_fields
} }
) )
) )

View File

@ -147,6 +147,37 @@ Animal <- R6::R6Class(
#' @export #' @export
toString = function() { toString = function() {
self$toJSONString() self$toJSONString()
},
#' Return true if the values in all fields are valid.
#'
#' @description
#' Return true if the values in all fields are valid.
#'
#' @return true if the values in all fields are valid.
#' @export
isValid = function() {
# check if the required `className` is null
if (is.null(`className`)) {
FALSE
}
TRUE
},
#' Return a list of invalid fields (if any).
#'
#' @description
#' Return a list of invalid fields (if any).
#'
#' @return A list of invalid fields (if any).
#' @export
getInvalidFields = function() {
invalid_fields <- list()
# check if the required `className` is null
if (is.null(`className`)) {
invalid_fields[`className`] = "Non-nullable required field `className` cannot be null."
}
invalid_fields
} }
) )
) )

View File

@ -153,6 +153,47 @@ BasquePig <- R6::R6Class(
#' @export #' @export
toString = function() { toString = function() {
self$toJSONString() self$toJSONString()
},
#' Return true if the values in all fields are valid.
#'
#' @description
#' Return true if the values in all fields are valid.
#'
#' @return true if the values in all fields are valid.
#' @export
isValid = function() {
# check if the required `className` is null
if (is.null(`className`)) {
FALSE
}
# check if the required `color` is null
if (is.null(`color`)) {
FALSE
}
TRUE
},
#' Return a list of invalid fields (if any).
#'
#' @description
#' Return a list of invalid fields (if any).
#'
#' @return A list of invalid fields (if any).
#' @export
getInvalidFields = function() {
invalid_fields <- list()
# check if the required `className` is null
if (is.null(`className`)) {
invalid_fields[`className`] = "Non-nullable required field `className` cannot be null."
}
# check if the required `color` is null
if (is.null(`color`)) {
invalid_fields[`color`] = "Non-nullable required field `color` cannot be null."
}
invalid_fields
} }
) )
) )

View File

@ -171,6 +171,37 @@ Cat <- R6::R6Class(
#' @export #' @export
toString = function() { toString = function() {
self$toJSONString() self$toJSONString()
},
#' Return true if the values in all fields are valid.
#'
#' @description
#' Return true if the values in all fields are valid.
#'
#' @return true if the values in all fields are valid.
#' @export
isValid = function() {
# check if the required `className` is null
if (is.null(`className`)) {
FALSE
}
TRUE
},
#' Return a list of invalid fields (if any).
#'
#' @description
#' Return a list of invalid fields (if any).
#'
#' @return A list of invalid fields (if any).
#' @export
getInvalidFields = function() {
invalid_fields <- list()
# check if the required `className` is null
if (is.null(`className`)) {
invalid_fields[`className`] = "Non-nullable required field `className` cannot be null."
}
invalid_fields
} }
) )
) )

View File

@ -118,6 +118,27 @@ CatAllOf <- R6::R6Class(
#' @export #' @export
toString = function() { toString = function() {
self$toJSONString() self$toJSONString()
},
#' Return true if the values in all fields are valid.
#'
#' @description
#' Return true if the values in all fields are valid.
#'
#' @return true if the values in all fields are valid.
#' @export
isValid = function() {
TRUE
},
#' Return a list of invalid fields (if any).
#'
#' @description
#' Return a list of invalid fields (if any).
#'
#' @return A list of invalid fields (if any).
#' @export
getInvalidFields = function() {
invalid_fields <- list()
invalid_fields
} }
) )
) )

View File

@ -141,6 +141,35 @@ Category <- R6::R6Class(
#' @export #' @export
toString = function() { toString = function() {
self$toJSONString() self$toJSONString()
},
#' Return true if the values in all fields are valid.
#'
#' @description
#' Return true if the values in all fields are valid.
#'
#' @return true if the values in all fields are valid.
#' @export
isValid = function() {
if (!str_detect(`name`, "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$")) {
FALSE
}
TRUE
},
#' Return a list of invalid fields (if any).
#'
#' @description
#' Return a list of invalid fields (if any).
#'
#' @return A list of invalid fields (if any).
#' @export
getInvalidFields = function() {
invalid_fields <- list()
if (!str_detect(`name`, "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$")) {
invalid_fields[`name`] = "Invalid value for `name`, must conform to the pattern ^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$."
}
invalid_fields
} }
) )
) )

View File

@ -153,6 +153,47 @@ DanishPig <- R6::R6Class(
#' @export #' @export
toString = function() { toString = function() {
self$toJSONString() self$toJSONString()
},
#' Return true if the values in all fields are valid.
#'
#' @description
#' Return true if the values in all fields are valid.
#'
#' @return true if the values in all fields are valid.
#' @export
isValid = function() {
# check if the required `className` is null
if (is.null(`className`)) {
FALSE
}
# check if the required `size` is null
if (is.null(`size`)) {
FALSE
}
TRUE
},
#' Return a list of invalid fields (if any).
#'
#' @description
#' Return a list of invalid fields (if any).
#'
#' @return A list of invalid fields (if any).
#' @export
getInvalidFields = function() {
invalid_fields <- list()
# check if the required `className` is null
if (is.null(`className`)) {
invalid_fields[`className`] = "Non-nullable required field `className` cannot be null."
}
# check if the required `size` is null
if (is.null(`size`)) {
invalid_fields[`size`] = "Non-nullable required field `size` cannot be null."
}
invalid_fields
} }
) )
) )

View File

@ -171,6 +171,37 @@ Dog <- R6::R6Class(
#' @export #' @export
toString = function() { toString = function() {
self$toJSONString() self$toJSONString()
},
#' Return true if the values in all fields are valid.
#'
#' @description
#' Return true if the values in all fields are valid.
#'
#' @return true if the values in all fields are valid.
#' @export
isValid = function() {
# check if the required `className` is null
if (is.null(`className`)) {
FALSE
}
TRUE
},
#' Return a list of invalid fields (if any).
#'
#' @description
#' Return a list of invalid fields (if any).
#'
#' @return A list of invalid fields (if any).
#' @export
getInvalidFields = function() {
invalid_fields <- list()
# check if the required `className` is null
if (is.null(`className`)) {
invalid_fields[`className`] = "Non-nullable required field `className` cannot be null."
}
invalid_fields
} }
) )
) )

View File

@ -118,6 +118,27 @@ DogAllOf <- R6::R6Class(
#' @export #' @export
toString = function() { toString = function() {
self$toJSONString() self$toJSONString()
},
#' Return true if the values in all fields are valid.
#'
#' @description
#' Return true if the values in all fields are valid.
#'
#' @return true if the values in all fields are valid.
#' @export
isValid = function() {
TRUE
},
#' Return a list of invalid fields (if any).
#'
#' @description
#' Return a list of invalid fields (if any).
#'
#' @return A list of invalid fields (if any).
#' @export
getInvalidFields = function() {
invalid_fields <- list()
invalid_fields
} }
) )
) )

View File

@ -164,6 +164,27 @@ ModelApiResponse <- R6::R6Class(
#' @export #' @export
toString = function() { toString = function() {
self$toJSONString() self$toJSONString()
},
#' Return true if the values in all fields are valid.
#'
#' @description
#' Return true if the values in all fields are valid.
#'
#' @return true if the values in all fields are valid.
#' @export
isValid = function() {
TRUE
},
#' Return a list of invalid fields (if any).
#'
#' @description
#' Return a list of invalid fields (if any).
#'
#' @return A list of invalid fields (if any).
#' @export
getInvalidFields = function() {
invalid_fields <- list()
invalid_fields
} }
) )
) )

View File

@ -143,6 +143,27 @@ NestedOneOf <- R6::R6Class(
#' @export #' @export
toString = function() { toString = function() {
self$toJSONString() self$toJSONString()
},
#' Return true if the values in all fields are valid.
#'
#' @description
#' Return true if the values in all fields are valid.
#'
#' @return true if the values in all fields are valid.
#' @export
isValid = function() {
TRUE
},
#' Return a list of invalid fields (if any).
#'
#' @description
#' Return a list of invalid fields (if any).
#'
#' @return A list of invalid fields (if any).
#' @export
getInvalidFields = function() {
invalid_fields <- list()
invalid_fields
} }
) )
) )

View File

@ -233,6 +233,27 @@ Order <- R6::R6Class(
#' @export #' @export
toString = function() { toString = function() {
self$toJSONString() self$toJSONString()
},
#' Return true if the values in all fields are valid.
#'
#' @description
#' Return true if the values in all fields are valid.
#'
#' @return true if the values in all fields are valid.
#' @export
isValid = function() {
TRUE
},
#' Return a list of invalid fields (if any).
#'
#' @description
#' Return a list of invalid fields (if any).
#'
#' @return A list of invalid fields (if any).
#' @export
getInvalidFields = function() {
invalid_fields <- list()
invalid_fields
} }
) )
) )

View File

@ -250,6 +250,47 @@ Pet <- R6::R6Class(
#' @export #' @export
toString = function() { toString = function() {
self$toJSONString() self$toJSONString()
},
#' Return true if the values in all fields are valid.
#'
#' @description
#' Return true if the values in all fields are valid.
#'
#' @return true if the values in all fields are valid.
#' @export
isValid = function() {
# check if the required `name` is null
if (is.null(`name`)) {
FALSE
}
# check if the required `photoUrls` is null
if (is.null(`photoUrls`)) {
FALSE
}
TRUE
},
#' Return a list of invalid fields (if any).
#'
#' @description
#' Return a list of invalid fields (if any).
#'
#' @return A list of invalid fields (if any).
#' @export
getInvalidFields = function() {
invalid_fields <- list()
# check if the required `name` is null
if (is.null(`name`)) {
invalid_fields[`name`] = "Non-nullable required field `name` cannot be null."
}
# check if the required `photoUrls` is null
if (is.null(`photoUrls`)) {
invalid_fields[`photoUrls`] = "Non-nullable required field `photoUrls` cannot be null."
}
invalid_fields
} }
) )
) )

View File

@ -233,6 +233,27 @@ Special <- R6::R6Class(
#' @export #' @export
toString = function() { toString = function() {
self$toJSONString() self$toJSONString()
},
#' Return true if the values in all fields are valid.
#'
#' @description
#' Return true if the values in all fields are valid.
#'
#' @return true if the values in all fields are valid.
#' @export
isValid = function() {
TRUE
},
#' Return a list of invalid fields (if any).
#'
#' @description
#' Return a list of invalid fields (if any).
#'
#' @return A list of invalid fields (if any).
#' @export
getInvalidFields = function() {
invalid_fields <- list()
invalid_fields
} }
) )
) )

View File

@ -141,6 +141,27 @@ Tag <- R6::R6Class(
#' @export #' @export
toString = function() { toString = function() {
self$toJSONString() self$toJSONString()
},
#' Return true if the values in all fields are valid.
#'
#' @description
#' Return true if the values in all fields are valid.
#'
#' @return true if the values in all fields are valid.
#' @export
isValid = function() {
TRUE
},
#' Return a list of invalid fields (if any).
#'
#' @description
#' Return a list of invalid fields (if any).
#'
#' @return A list of invalid fields (if any).
#' @export
getInvalidFields = function() {
invalid_fields <- list()
invalid_fields
} }
) )
) )

View File

@ -142,6 +142,27 @@ UpdatePetRequest <- R6::R6Class(
#' @export #' @export
toString = function() { toString = function() {
self$toJSONString() self$toJSONString()
},
#' Return true if the values in all fields are valid.
#'
#' @description
#' Return true if the values in all fields are valid.
#'
#' @return true if the values in all fields are valid.
#' @export
isValid = function() {
TRUE
},
#' Return a list of invalid fields (if any).
#'
#' @description
#' Return a list of invalid fields (if any).
#'
#' @return A list of invalid fields (if any).
#' @export
getInvalidFields = function() {
invalid_fields <- list()
invalid_fields
} }
) )
) )

View File

@ -279,6 +279,27 @@ User <- R6::R6Class(
#' @export #' @export
toString = function() { toString = function() {
self$toJSONString() self$toJSONString()
},
#' Return true if the values in all fields are valid.
#'
#' @description
#' Return true if the values in all fields are valid.
#'
#' @return true if the values in all fields are valid.
#' @export
isValid = function() {
TRUE
},
#' Return a list of invalid fields (if any).
#'
#' @description
#' Return a list of invalid fields (if any).
#'
#' @return A list of invalid fields (if any).
#' @export
getInvalidFields = function() {
invalid_fields <- list()
invalid_fields
} }
) )
) )