✨ feat(actions): meta.openapi für Aktionen typisieren und validieren (#40)
continuous-integration/drone/push Build is passing
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.
This commit is contained in:
1 parent
4e13d4ab9a
commit
11069d83d4
5 files changed
+110
-8
No files matched your search
@@ -428,6 +428,10 @@
|
||||
"hide": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"openapi": {
|
||||
"$ref": "openapi.schema.json",
|
||||
"description": "OpenAPI overrides for this action, same shape a collection uses in meta.openapi. The action appears as path /_actions/{name} with its get/post operations."
|
||||
},
|
||||
"methods": {
|
||||
"type": "object",
|
||||
"patternProperties": {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"$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",
|
||||
"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": {
|
||||
@@ -161,27 +161,27 @@
|
||||
"properties": {
|
||||
"disabled": {
|
||||
"type": "boolean",
|
||||
"description": "Exclude this entire collection from the generated OpenAPI spec"
|
||||
"description": "Exclude this entire collection or action from the generated OpenAPI spec"
|
||||
},
|
||||
"get": {
|
||||
"$ref": "#/definitions/operationObject",
|
||||
"description": "OpenAPI operation overrides for the list endpoint (GET /{collection})"
|
||||
"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 (GET /{collection}/{id})"
|
||||
"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 create endpoint (POST /{collection})"
|
||||
"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 (PUT /{collection}/{id})"
|
||||
"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 (DELETE /{collection}/{id})"
|
||||
"description": "OpenAPI operation overrides for the delete endpoint of a collection (DELETE /{collection}/{id}); unused by actions"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user