Members
-
bool
-
Get a new BooleanSchema object.
-
double
-
Get a new NumberSchema object.
-
int
-
Get a new IntegerSchema object.
-
map
-
Get a new MapSchema object.
-
media
-
Get a new MediaSchema object.
-
null
-
Gets the schema for null (a constant).
-
str
-
Get a new StringSchema object.
Methods
-
arr(schema)
-
Parameters:
Name Type Description schemaBaseSchema See ArraySchema#constructor Returns:
- A new ArraySchema object. -
const()
-
Get a new const schema.
-
enum()
-
Get a new num.
-
formatParagraph(p, options) → {String}
-
Formats a paragraph into a string.
Parameters:
Name Type Description pString | Array.<String> the string or array of strings to process optionsformatParagraphOptions how to format the string Returns:
String - formatted string -
lock(schemas)
-
Lock all schemas in a dictionary (in-place).
Parameters:
Name Type Description schemasObject.<Schema> a map of schema values Returns:
- the input map of schema values -
nullable()
-
Returns a schema which is either null or the specified schema.
-
obj(object)
-
Parameters:
Name Type Description objectObject See ObjectSchema#constructor Returns:
- A new ObjectSchema object. -
optional(schemas)
-
Sets all schemas as optional (in-place).
Parameters:
Name Type Description schemasObject.<Schema> a map of schema values Returns:
- the input map of schema values -
polymorphicObj(object)
-
Parameters:
Name Type Description objectObject See ObjectSchema#constructor Returns:
- A new ObjectSchema object. -
ref()
-
Get a new RefSchema object.
-
union()
-
Gets a schema which is a union of two or more schemas.
Type Definitions
-
formatParagraphOptions
-
Options to format a paragraph
Properties:
Name Type Description replaceNewlinesString | false if not false, then newlines will be replaced with this character trimboolean whether to trim whitespace from the start/end (for arrays, each element will be trimmed too)