Schema
Simplified version of JSON Schema
Last updated
Was this helpful?
Simplified version of JSON Schema
Last updated
Was this helpful?
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:
https://schemas.letsflow.io/v1.0/schema
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.
Basic types like string
, number
, or boolean
can be specified directly without wrapping in a type
field.
normalizes to
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 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
Defines a constant value:
!enum
Defines an enumerated set of values:
The type is determined based on the values of the enum.
!format
Specifies a data format:
The type is always set to string
.
!pattern
Defines a regular expression for validation:
The type is always set to string
.
!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.
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
or enum
the type is determined based on the const or enum value.
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.
For schema files; LetsFlow assumes that schemas are immutable to be deterministic. It's highly recommended that the URI of the schema ID includes a version number. Modifying a published schema can lead to unexpected behavior.