✨ feat: add new JSON schemas for Tibi configuration including fields, hooks, jobs, and permissions
- 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,171 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"$id": "field.schema.json",
|
||||
"title": "Tibi field config",
|
||||
"$ref": "#/definitions/field",
|
||||
"definitions": {
|
||||
"field": {
|
||||
"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": "#/definitions/field"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"validator": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"required": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"allowZero": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"format": {
|
||||
"type": "string",
|
||||
"enum": ["email", "url", "uuid", "slug"]
|
||||
},
|
||||
"eval": {
|
||||
"type": "string"
|
||||
},
|
||||
"minItems": {
|
||||
"type": "number"
|
||||
},
|
||||
"maxItems": {
|
||||
"type": "number"
|
||||
},
|
||||
"minLength": {
|
||||
"type": "number"
|
||||
},
|
||||
"maxLength": {
|
||||
"type": "number"
|
||||
},
|
||||
"pattern": {
|
||||
"type": "string"
|
||||
},
|
||||
"min": {
|
||||
"type": "number"
|
||||
},
|
||||
"max": {
|
||||
"type": "number"
|
||||
},
|
||||
"minDate": {
|
||||
"type": "string"
|
||||
},
|
||||
"maxDate": {
|
||||
"type": "string"
|
||||
},
|
||||
"minFileSize": {
|
||||
"type": "string"
|
||||
},
|
||||
"in": {
|
||||
"type": "array"
|
||||
},
|
||||
"maxFileSize": {
|
||||
"type": "string"
|
||||
},
|
||||
"accept": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"image": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"minWidth": {
|
||||
"type": "number"
|
||||
},
|
||||
"maxWidth": {
|
||||
"type": "number"
|
||||
},
|
||||
"minHeight": {
|
||||
"type": "number"
|
||||
},
|
||||
"maxHeight": {
|
||||
"type": "number"
|
||||
},
|
||||
"allowNonImages": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"allowUnknownDimensions": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"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"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user