the-bastion/json-schema/include/result.jsonschema
Stéphane Lesimple 0428f356b0
wip
2024-12-21 12:05:18 +00:00

81 lines
1.7 KiB
Text

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://ovh.github.io/the-bastion/schemas/plugins-include/result",
"$defs": {
"command": {
"description": "Command name",
"type": "string",
"pattern": "^[a-z][a-zA-Z]+$",
"minLength": 2
},
"error_message": {
"type": "string",
"minLength": 2
},
"session_id": {
"type": "string",
"pattern": "^[a-f0-9]{12}$"
}
},
"type": "object",
"additionalProperties": true,
"minProperties": 5,
"maxProperties": 5,
"oneOf": [
{
"additionalProperties": false,
"properties": {
"command": {
"oneOf": [
{
"type": "null"
},
{
"$ref": "#/$defs/command"
}
]
},
"error_message": {
"$ref": "#/$defs/error_message"
},
"error_code": {
"type": "string",
"pattern": "^(ERR|KO)(_[A-Z_]+)?$"
},
"value": {
"type": ["array","object","null"]
},
"session_id": {
"$ref": "#/$defs/session_id"
}
}
},
{
"additionalProperties": false,
"properties": {
"command": {
"$ref": "#/$defs/command"
},
"error_message": {
"$ref": "#/$defs/error_message"
},
"error_code": {
"type": "string",
"pattern": "^OK(_[A-Z_]+)?$"
},
"value": {
"type": ["array","object","null"]
},
"session_id": {
"$ref": "#/$defs/session_id"
}
}
}
],
"required": [
"command",
"error_code",
"error_message",
"value"
]
}