continuous-integration/drone/push Build is passing
Aktionen erscheinen in der generierten OpenAPI-Spec als /_actions/<name>. Dafür trägt die Action-Meta jetzt denselben openapi-Block wie eine Sammlung: - action.schema.json: meta.openapi referenziert openapi.schema.json (bisher lehnte additionalProperties: false den Block ab). - openapi.schema.json: Beschreibung deckt Sammlung und Aktion ab, get/getOne/ post/put/delete sind entsprechend erläutert. - index.d.ts: ActionMeta.openapi plus OpenapiMeta/OpenapiOperationMeta/ OpenapiParameter. - demo-api/actions/demo-action.yml und types-test/action-openapi.ts zeigen und prüfen die Form.
188 lines
5.5 KiB
JSON
188 lines
5.5 KiB
JSON
{
|
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
"$id": "openapi.schema.json",
|
|
"title": "Tibi OpenAPI entity config",
|
|
"description": "OpenAPI metadata for a collection or an action, used to generate the project's OpenAPI 3.0 spec via /_openapi/:project. Actions appear as /_actions/{name} and use get/post.",
|
|
"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 or action from the generated OpenAPI spec"
|
|
},
|
|
"get": {
|
|
"$ref": "#/definitions/operationObject",
|
|
"description": "OpenAPI operation overrides for the GET endpoint: list for a collection (GET /{collection}), the action itself for an action (GET /_actions/{name})"
|
|
},
|
|
"getOne": {
|
|
"$ref": "#/definitions/operationObject",
|
|
"description": "OpenAPI operation overrides for the single-entry endpoint of a collection (GET /{collection}/{id}); unused by actions"
|
|
},
|
|
"post": {
|
|
"$ref": "#/definitions/operationObject",
|
|
"description": "OpenAPI operation overrides for the POST endpoint: create for a collection (POST /{collection}), the action itself for an action (POST /_actions/{name})"
|
|
},
|
|
"put": {
|
|
"$ref": "#/definitions/operationObject",
|
|
"description": "OpenAPI operation overrides for the update endpoint of a collection (PUT /{collection}/{id}); unused by actions"
|
|
},
|
|
"delete": {
|
|
"$ref": "#/definitions/operationObject",
|
|
"description": "OpenAPI operation overrides for the delete endpoint of a collection (DELETE /{collection}/{id}); unused by actions"
|
|
}
|
|
}
|
|
}
|