The schema object allows the definition of input and output data types.
These types can be objects, but also primitives and arrays. This object is a
superset of the JSON Schema Specification Draft 2020-12.
Arguments
- type
Factor (or coercible to factor). The type of object being defined. Currently must be one of "string", "number", "integer", "boolean", "array", or "object".
- ...
These dots are for future extensions and must be empty.
- nullable
Logical scalar (default
FALSE). Whether the parameter can be set toNULL.- description
Character scalar (optional). A description of the object defined by the schema.
- format
Character scalar (optional). The format of the object. Essentially a sub-type.
Value
A schema S7 object describing the data type, with fields type,
nullable, description, and format.
See also
schema objects
as_schema()
components object
as_api_key_security_scheme(),
as_components(),
as_oauth2_authorization_code_flow(),
as_oauth2_implicit_flow(),
as_oauth2_security_scheme(),
as_oauth2_token_flow(),
as_reference(),
as_schema(),
as_scopes(),
as_security_scheme(),
as_security_scheme_details(),
as_security_schemes(),
class_api_key_security_scheme(),
class_components(),
class_oauth2_authorization_code_flow(),
class_oauth2_implicit_flow(),
class_oauth2_security_scheme(),
class_oauth2_token_flow(),
class_reference(),
class_scopes(),
class_security_scheme_details(),
class_security_schemes()
Examples
class_schema("string")
#> <rapid::schema>
#> @ type : Factor w/ 6 levels "string","number",..: 1
#> .. - attr(*, "initialized")= logi TRUE
#> @ nullable : logi FALSE
#> @ description: chr(0)
#> @ format : chr(0)
class_schema("string", nullable = TRUE, description = "A nullable string.")
#> <rapid::schema>
#> @ type : Factor w/ 6 levels "string","number",..: 1
#> .. - attr(*, "initialized")= logi TRUE
#> @ nullable : logi TRUE
#> @ description: chr "A nullable string."
#> @ format : chr(0)