Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support webhooks #187

Open
Tracked by #79
nfroidure opened this issue Oct 17, 2024 · 0 comments
Open
Tracked by #79

support webhooks #187

nfroidure opened this issue Oct 17, 2024 · 0 comments
Assignees

Comments

@nfroidure
Copy link
Owner

nfroidure commented Oct 17, 2024

See this webhooks example.

To do:

  • types generator support Generate types for Webhooks schema2dts#38,
  • check this works fine with webhooks:
    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],
    }),
    {},
    ),
    },
    };
    }
    (especially when an endpoint uses webhooks schemas, how to know it from the schema (if possible)),
  • think of the integration level: we could generate the API SDK in the watch function and add webhook implementation utilities (see Allow to create a webhooks SDK openapi-ts-sdk-builder#16 ).
@nfroidure nfroidure mentioned this issue Oct 17, 2024
9 tasks
@nfroidure nfroidure self-assigned this Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant