✨ 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,187 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"$id": "openapi.schema.json",
|
||||
"title": "Tibi OpenAPI collection config",
|
||||
"description": "OpenAPI metadata for a collection, used to generate the project's OpenAPI 3.0 spec via /_openapi/:project",
|
||||
"type": "object",
|
||||
"additionalProperties": true,
|
||||
"definitions": {
|
||||
"i18nOrString": {
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"minProperties": 1,
|
||||
"patternProperties": {
|
||||
"^[a-z]{2}(-[A-Za-z0-9_]+)?$": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"codeSample": {
|
||||
"type": "object",
|
||||
"additionalProperties": true,
|
||||
"properties": {
|
||||
"lang": {
|
||||
"type": "string",
|
||||
"description": "Language identifier (e.g. Shell, JavaScript, Python)"
|
||||
},
|
||||
"label": {
|
||||
"type": "string",
|
||||
"description": "Display label for the code sample"
|
||||
},
|
||||
"source": {
|
||||
"type": "string",
|
||||
"description": "The code sample source"
|
||||
}
|
||||
},
|
||||
"required": ["lang", "source"]
|
||||
},
|
||||
"responseObject": {
|
||||
"type": "object",
|
||||
"additionalProperties": true,
|
||||
"properties": {
|
||||
"description": {
|
||||
"$ref": "#/definitions/i18nOrString"
|
||||
},
|
||||
"x-summary": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"operationObject": {
|
||||
"type": "object",
|
||||
"additionalProperties": true,
|
||||
"properties": {
|
||||
"disabled": {
|
||||
"type": "boolean",
|
||||
"description": "Exclude this operation from the generated OpenAPI spec"
|
||||
},
|
||||
"tags": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": "OpenAPI tags for grouping"
|
||||
},
|
||||
"summary": {
|
||||
"$ref": "#/definitions/i18nOrString"
|
||||
},
|
||||
"description": {
|
||||
"$ref": "#/definitions/i18nOrString"
|
||||
},
|
||||
"x-codeSamples": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/codeSample"
|
||||
}
|
||||
},
|
||||
"parameters": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"additionalProperties": true,
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"in": {
|
||||
"type": "string",
|
||||
"enum": ["query", "header", "path", "cookie"]
|
||||
},
|
||||
"description": {
|
||||
"$ref": "#/definitions/i18nOrString"
|
||||
},
|
||||
"required": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"required": ["name", "in"]
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"$ref": "#/definitions/responseObject"
|
||||
},
|
||||
"propertyNames": {
|
||||
"pattern": "^[1-5][0-9]{2}$|^default$"
|
||||
}
|
||||
},
|
||||
"security": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"fieldOpenapi": {
|
||||
"type": "object",
|
||||
"description": "OpenAPI metadata for a collection field. Extra properties are merged into the field's schema object.",
|
||||
"additionalProperties": true,
|
||||
"properties": {
|
||||
"disabled": {
|
||||
"type": "boolean",
|
||||
"description": "Exclude this field from the generated OpenAPI schema"
|
||||
},
|
||||
"description": {
|
||||
"$ref": "#/definitions/i18nOrString"
|
||||
},
|
||||
"example": {},
|
||||
"format": {
|
||||
"type": "string",
|
||||
"description": "OpenAPI format hint (e.g. date-time, email, uri)"
|
||||
},
|
||||
"enum": {
|
||||
"type": "array",
|
||||
"description": "Restrict values to a fixed set"
|
||||
},
|
||||
"deprecated": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"disabled": {
|
||||
"type": "boolean",
|
||||
"description": "Exclude this entire collection from the generated OpenAPI spec"
|
||||
},
|
||||
"get": {
|
||||
"$ref": "#/definitions/operationObject",
|
||||
"description": "OpenAPI operation overrides for the list endpoint (GET /{collection})"
|
||||
},
|
||||
"getOne": {
|
||||
"$ref": "#/definitions/operationObject",
|
||||
"description": "OpenAPI operation overrides for the single-entry endpoint (GET /{collection}/{id})"
|
||||
},
|
||||
"post": {
|
||||
"$ref": "#/definitions/operationObject",
|
||||
"description": "OpenAPI operation overrides for the create endpoint (POST /{collection})"
|
||||
},
|
||||
"put": {
|
||||
"$ref": "#/definitions/operationObject",
|
||||
"description": "OpenAPI operation overrides for the update endpoint (PUT /{collection}/{id})"
|
||||
},
|
||||
"delete": {
|
||||
"$ref": "#/definitions/operationObject",
|
||||
"description": "OpenAPI operation overrides for the delete endpoint (DELETE /{collection}/{id})"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user