147 lines
4.8 KiB
JSON
147 lines
4.8 KiB
JSON
{
|
|
"$id": "https://sysreptor.com/schema/fielddefinition.schem.json",
|
|
"$schema": "https://json-schema.org/draft/2019-09/schema",
|
|
"title": "Field Definition",
|
|
"$defs": {
|
|
"field_object": {
|
|
"type": "object",
|
|
"patternProperties": {
|
|
"^[a-zA-Z_][a-zA-Z0-9_]*$": {
|
|
"$ref": "#/$defs/field_value",
|
|
"required": ["type", "label"]
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
"field_value": {
|
|
"type": "object",
|
|
"required": ["type"],
|
|
"properties": {
|
|
"label": {
|
|
"type": "string"
|
|
},
|
|
"origin": {
|
|
"type": "string",
|
|
"enum": ["core", "predefined", "custom"]
|
|
}
|
|
},
|
|
"anyOf": [
|
|
{
|
|
"properties": {
|
|
"type": {
|
|
"enum": ["string", "markdown", "cvss"]
|
|
},
|
|
"default": {
|
|
"type": ["string", "null"]
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"properties": {
|
|
"type": {
|
|
"const": "date"
|
|
},
|
|
"default": {
|
|
"type": ["string", "null"],
|
|
"validate": "date"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"properties": {
|
|
"type": {
|
|
"const": "number"
|
|
},
|
|
"default": {
|
|
"type": ["number", "null"]
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"properties": {
|
|
"type": {
|
|
"const": "boolean"
|
|
},
|
|
"default": {
|
|
"type": ["boolean", "null"]
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"properties": {
|
|
"type": {
|
|
"const": "user"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"required": ["choices"],
|
|
"properties": {
|
|
"type": {
|
|
"const": "enum"
|
|
},
|
|
"choices": {
|
|
"type": "array",
|
|
"minItems": 1,
|
|
"items": {
|
|
"type": "object",
|
|
"required": ["value", "label"],
|
|
"properties": {
|
|
"value": {
|
|
"type": "string",
|
|
"pattern": "^[a-zA-Z_][0-9a-zA-Z_-]+$"
|
|
},
|
|
"label": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"default": {
|
|
"type": ["string", "null"]
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"required": ["suggestions"],
|
|
"properties": {
|
|
"type": {
|
|
"const": "combobox"
|
|
},
|
|
"suggestions": {
|
|
"type": "array",
|
|
"minItems": 0,
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"required": ["properties"],
|
|
"properties": {
|
|
"type": {
|
|
"const": "object"
|
|
},
|
|
"properties": {
|
|
"$ref": "#/$defs/field_object"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"required": ["items"],
|
|
"properties": {
|
|
"type": {
|
|
"const": "list"
|
|
},
|
|
"items": {
|
|
"$ref": "#/$defs/field_value"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"$ref": "#/$defs/field_object"
|
|
}
|