Schema
Simplified version of JSON Schema
Variables, the process result, and actors are defined using JSON Schema within a scenario. JSON Schema is a standard for defining the structure, format, and validation rules of JSON data.
To simplify usage, LetsFlow supports both standard and simplified schemas.
For more information about JSON Schema, please visit:
Schema
https://schemas.letsflow.io/v1.0.0/schema
Normalization
Simplified schemas are converted into their full JSON Schema equivalent before use. This is done when a scenario or a standalone schema is normalized.
Simplified schemas supersede full JSON Schema, thus any valid JSON Schema is also a valid LetsFlow schema.
Simplification features
Simple types
Basic types like string
, number
, or boolean
can be specified directly without wrapping in a type
field.
normalizes to
Simple References
In JSON Schema, you can reference an external schema or subsection of the current schema using $ref
.
In LetsFlow's simplified schema, references can be written directly as strings. Any string starting with http://
, https://
, or #
is seen as a reference, rather than a type.
normalizes to
Yaml tags
YAML tags in LetsFlow provide a concise way to define additional metadata or constraints in your schema.
These tags are not available when defining a schema in JSON.
!const
!const
Defines a constant value:
!enum
!enum
Defines an enumerated set of values:
The type is determined based on the values of the enum.
!format
!format
Specifies a data format:
The type is always set to string
.
!pattern
!pattern
Defines a regular expression for validation:
The type is always set to string
.
!default
!default
Provides a default value:
The type is determined based on the default value.
!required
Marks a property as required:
The !required
tag should only be used on properties, as the property is automatically appended to the required
field of the parent object.
Implicit Types
If type
is omitted, it may be automatically determined based on the structure:
The presence of
properties
implies an object.The presence of
items
implies an array.For
const
orenum
the type is determined based on the const or enum value.
Additional properties
Properties that aren't defined don't exist and can't be set unless additionalProperties
is set in the definition.
In other words; additionalProperties
defaults to false
in contrary to the default behavior of JSON Schema.
Last updated