-
-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Labels
Description
See this callbacks example.
To do:
- types generator support Generate types for callbacks schema2dts#39,
- check this works fine with callbacks: ,
whook/packages/whook/src/libs/openapi.ts
Lines 23 to 59 in 87fe576
export function cleanupOpenAPI( api: OpenAPIV3_1.Document, ): OpenAPIV3_1.Document { const seenRefs = [ ...new Set( collectRefs( api as unknown as JsonObject, api.paths as unknown as JsonValue, ), ), ]; return { ...api, components: { ...(Object.keys(api?.components || {}) as ComponentType[]).reduce( (cleanedComponents, componentType) => ({ ...cleanedComponents, [componentType]: COMPONENTS_TYPES.includes(componentType) ? Object.keys(api?.components?.[componentType] || {}) .filter((key) => seenRefs.includes(`#/components/${componentType}/${key}`), ) .reduce( (cleanedComponents, key) => ({ ...cleanedComponents, [key]: api.components?.[componentType]?.[key], }), {}, ) : api.components?.[componentType], }), {}, ), }, }; } - think of the integration level: we could generate the API SDK in the watch function and add callback implementation utilities (see Allow to create a callbacks SDK openapi-ts-sdk-builder#17 ).
Reactions are currently unavailable