Generator plugin provides a way to interact with users through Input, which is defined using JSON Schema:
For example:
JSON Schema format is based on the open source Formily Schema format. The following are the supported fields:
Defines the type of the current schema. Currently supported types are string
, number
, and object
. string
type is used for string inputs and dropdown options. object
type is used for nesting schemas and needs to be used with the properties
attribute.
Defines the display name of the current schema.
Defines the default value of the current schema.
Defines the options when the current schema is a dropdown selection.
The sub-items support string
or { label: string; value: string}
types. When the value and display value are the same in the dropdown options, string
can be used directly to define the options.
When representing multiple selection options, set the default
field to []
.
Defines the validation rules for the current schema. When the schema is an input type, validation will be automatically performed after input completion.
The validation rules supported here are provided by Formily, for example, the maximum value is 5:
It also supports using validation functions directly:
Use linkage between schemas. This is exactly the same as Formily linkage rules.
For example:
Organize the structure of the current schema and define sub-forms. properties
is an object, where the key
is the schema keyword and the value
is a schema object as described above.