✨ feat: add new JSON schemas for Tibi configuration including fields, hooks, jobs, and permissions
continuous-integration/drone/push Build is passing
continuous-integration/drone/push Build is passing
- Introduced `field-list.schema.json`, `field-meta.schema.json`, and `field.schema.json` for field configurations. - Added `hooks.schema.json` for defining hooks in the Tibi project. - Created `image-filter.schema.json` for image processing configurations. - Implemented `job.schema.json` for job scheduling configurations. - Added `openapi.schema.json` for OpenAPI metadata generation. - Introduced `permissions.schema.json` for managing permissions in the project. - Created `project.schema.json` for overall project configuration. - Added `projections.schema.json` for defining projections in the project. - Implemented a validation script `validate-schemas.mjs` to ensure schema compliance.
This commit is contained in:
@@ -0,0 +1,434 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"$id": "action.schema.json",
|
||||
"title": "Tibi action config",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"patternProperties": {
|
||||
"^x-": {}
|
||||
},
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"pattern": "^[0-9A-Za-z_-]+$"
|
||||
},
|
||||
"meta": {
|
||||
"$ref": "action.schema.json#/definitions/actionMeta"
|
||||
},
|
||||
"permissions": {
|
||||
"$ref": "action.schema.json#/definitions/actionPermissions"
|
||||
},
|
||||
"hooks": {
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"$ref": "hooks.schema.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"name"
|
||||
],
|
||||
"definitions": {
|
||||
"actionField": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"patternProperties": {
|
||||
"^x-": {}
|
||||
},
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"pattern": "^[0-9A-Za-z_]+$"
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"string",
|
||||
"string[]",
|
||||
"number",
|
||||
"number[]",
|
||||
"boolean",
|
||||
"object",
|
||||
"object[]",
|
||||
"file",
|
||||
"file[]",
|
||||
"date",
|
||||
"any"
|
||||
]
|
||||
},
|
||||
"index": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"single",
|
||||
"unique",
|
||||
"text",
|
||||
"sparse",
|
||||
"background"
|
||||
]
|
||||
}
|
||||
},
|
||||
"subFields": {
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"$ref": "action.schema.json#/definitions/actionField"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"validator": {
|
||||
"$ref": "field.schema.json#/definitions/field/properties/validator"
|
||||
},
|
||||
"readonly": {
|
||||
"$ref": "defs.schema.json#/definitions/boolOrEval"
|
||||
},
|
||||
"hidden": {
|
||||
"$ref": "defs.schema.json#/definitions/boolOrEval"
|
||||
},
|
||||
"strictFields": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"meta": {
|
||||
"$ref": "field-meta.schema.json"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"name",
|
||||
"type"
|
||||
]
|
||||
},
|
||||
"actionMappedField": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"patternProperties": {
|
||||
"^x-": {}
|
||||
},
|
||||
"properties": {
|
||||
"source": {
|
||||
"$ref": "defs.schema.json#/definitions/fieldPath"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"pattern": "^[0-9A-Za-z_]+$"
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"string",
|
||||
"string[]",
|
||||
"number",
|
||||
"number[]",
|
||||
"boolean",
|
||||
"object",
|
||||
"object[]",
|
||||
"file",
|
||||
"file[]",
|
||||
"date",
|
||||
"any"
|
||||
]
|
||||
},
|
||||
"subFields": {
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"$ref": "action.schema.json#/definitions/actionMappedField"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"meta": {
|
||||
"$ref": "field-meta.schema.json"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"type"
|
||||
],
|
||||
"anyOf": [
|
||||
{
|
||||
"required": [
|
||||
"source"
|
||||
]
|
||||
},
|
||||
{
|
||||
"required": [
|
||||
"name"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"actionFieldSection": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"patternProperties": {
|
||||
"^x-": {}
|
||||
},
|
||||
"properties": {
|
||||
"title": {
|
||||
"$ref": "defs.schema.json#/definitions/i18nText"
|
||||
},
|
||||
"description": {
|
||||
"$ref": "defs.schema.json#/definitions/i18nText"
|
||||
},
|
||||
"fields": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"$ref": "action.schema.json#/definitions/actionField"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"actionExecutionMeta": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"patternProperties": {
|
||||
"^x-": {}
|
||||
},
|
||||
"properties": {
|
||||
"kind": {
|
||||
"type": "string"
|
||||
},
|
||||
"cancellable": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
},
|
||||
"actionOutputProgressMapping": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"patternProperties": {
|
||||
"^x-": {}
|
||||
},
|
||||
"properties": {
|
||||
"indexField": {
|
||||
"$ref": "defs.schema.json#/definitions/fieldPath"
|
||||
},
|
||||
"countField": {
|
||||
"$ref": "defs.schema.json#/definitions/fieldPath"
|
||||
},
|
||||
"statusField": {
|
||||
"oneOf": [
|
||||
{
|
||||
"$ref": "defs.schema.json#/definitions/fieldPath"
|
||||
},
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "defs.schema.json#/definitions/fieldPath"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"messageField": {
|
||||
"$ref": "defs.schema.json#/definitions/fieldPath"
|
||||
},
|
||||
"fields": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"$ref": "action.schema.json#/definitions/actionMappedField"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"actionOutputMappingSection": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"patternProperties": {
|
||||
"^x-": {}
|
||||
},
|
||||
"properties": {
|
||||
"fields": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"$ref": "action.schema.json#/definitions/actionMappedField"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"actionOutputMapping": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"patternProperties": {
|
||||
"^x-": {}
|
||||
},
|
||||
"properties": {
|
||||
"summary": {
|
||||
"$ref": "action.schema.json#/definitions/actionOutputMappingSection"
|
||||
},
|
||||
"details": {
|
||||
"$ref": "action.schema.json#/definitions/actionOutputMappingSection"
|
||||
},
|
||||
"progress": {
|
||||
"$ref": "action.schema.json#/definitions/actionOutputProgressMapping"
|
||||
}
|
||||
}
|
||||
},
|
||||
"actionOutputMeta": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"patternProperties": {
|
||||
"^x-": {}
|
||||
},
|
||||
"properties": {
|
||||
"title": {
|
||||
"$ref": "defs.schema.json#/definitions/i18nText"
|
||||
},
|
||||
"mapping": {
|
||||
"$ref": "action.schema.json#/definitions/actionOutputMapping"
|
||||
}
|
||||
}
|
||||
},
|
||||
"actionMethodMeta": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"patternProperties": {
|
||||
"^x-": {}
|
||||
},
|
||||
"properties": {
|
||||
"query": {
|
||||
"$ref": "action.schema.json#/definitions/actionFieldSection"
|
||||
},
|
||||
"data": {
|
||||
"$ref": "action.schema.json#/definitions/actionFieldSection"
|
||||
},
|
||||
"execution": {
|
||||
"$ref": "action.schema.json#/definitions/actionExecutionMeta"
|
||||
},
|
||||
"output": {
|
||||
"$ref": "action.schema.json#/definitions/actionOutputMeta"
|
||||
}
|
||||
}
|
||||
},
|
||||
"actionMeta": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"patternProperties": {
|
||||
"^x-": {}
|
||||
},
|
||||
"properties": {
|
||||
"label": {
|
||||
"$ref": "defs.schema.json#/definitions/i18nText"
|
||||
},
|
||||
"muiIcon": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": {
|
||||
"$ref": "defs.schema.json#/definitions/i18nText"
|
||||
},
|
||||
"group": {
|
||||
"type": "string"
|
||||
},
|
||||
"hide": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"methods": {
|
||||
"type": "object",
|
||||
"patternProperties": {
|
||||
"^x-": {},
|
||||
"^[a-zA-Z0-9_-]+$": {
|
||||
"$ref": "action.schema.json#/definitions/actionMethodMeta"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"actionPermissionSet": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"patternProperties": {
|
||||
"^x-": {}
|
||||
},
|
||||
"properties": {
|
||||
"methods": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"get": {
|
||||
"$ref": "defs.schema.json#/definitions/methodPermissionGet"
|
||||
},
|
||||
"post": {
|
||||
"$ref": "defs.schema.json#/definitions/methodPermissionWrite"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"methods"
|
||||
]
|
||||
},
|
||||
"actionPermissions": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"public": {
|
||||
"$ref": "action.schema.json#/definitions/actionPermissionSet"
|
||||
},
|
||||
"user": {
|
||||
"$ref": "action.schema.json#/definitions/actionPermissionSet"
|
||||
}
|
||||
},
|
||||
"patternProperties": {
|
||||
"^x-": {},
|
||||
"^token:[^\\s]+$": {
|
||||
"$ref": "action.schema.json#/definitions/actionPermissionSet"
|
||||
},
|
||||
"^[a-zA-Z0-9_]+$": {
|
||||
"$ref": "action.schema.json#/definitions/actionPermissionSet"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"public",
|
||||
"user"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user