✨ 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
Vendored
+38
@@ -515,10 +515,48 @@ declare global {
|
||||
description?: LocalizedText
|
||||
group?: string
|
||||
hide?: boolean
|
||||
/** OpenAPI overrides, same shape a collection uses in `meta.openapi` (#40). */
|
||||
openapi?: OpenapiMeta
|
||||
methods?: Record<string, ActionMethodMeta>
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
/** `meta.openapi` of a collection or an action (GET /_openapi/:project). */
|
||||
export interface OpenapiMeta {
|
||||
/** Hide the whole collection or action from the generated spec. */
|
||||
disabled?: boolean
|
||||
/** GET: collection list, or the action itself (/_actions/{name}). */
|
||||
get?: OpenapiOperationMeta
|
||||
/** Single-entry GET of a collection (/{collection}/{id}); unused by actions. */
|
||||
getOne?: OpenapiOperationMeta
|
||||
/** POST: collection create, or the action itself (/_actions/{name}). */
|
||||
post?: OpenapiOperationMeta
|
||||
put?: OpenapiOperationMeta
|
||||
delete?: OpenapiOperationMeta
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
export interface OpenapiOperationMeta {
|
||||
/** Drop this operation from the spec. */
|
||||
disabled?: boolean
|
||||
tags?: string[]
|
||||
summary?: LocalizedText
|
||||
description?: LocalizedText
|
||||
parameters?: OpenapiParameter[]
|
||||
responses?: { [status: string]: any }
|
||||
security?: Array<{ [tokenName: string]: string[] }>
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
export interface OpenapiParameter {
|
||||
name: string
|
||||
in: "query" | "header" | "path" | "cookie"
|
||||
description?: LocalizedText
|
||||
required?: boolean
|
||||
schema?: { type?: string; [key: string]: any }
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
export interface ActionMethodMeta {
|
||||
query?: {
|
||||
title?: LocalizedText
|
||||
|
||||
Reference in new issue
Block a user