-
Notifications
You must be signed in to change notification settings - Fork 4k
Add OpenAPI Webhook block #3160
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
Add OpenAPI Webhook block #3160
Conversation
🦋 Changeset detectedLatest commit: 1e2ef19 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Summary of the deployments: Version 1
Version 2
Test content |
8b25243
to
904476b
Compare
dedb612
to
1f43b68
Compare
0eb9e4a
to
7518b0a
Compare
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for an OpenAPI Webhook block to the project by introducing new components, updating types, and integrating the webhook block into the GitBook document view. Key changes include:
- Introducing a new React component (OpenAPIWebhook) and its resolver in both the react-openapi and gitbook packages.
- Updating existing components (e.g., OpenAPISpec, OpenAPIRequestBody, OpenAPIMediaType) to accommodate the new webhook data type.
- Extending type definitions and the fetch/resolve logic and integrating the webhook block into the GitBook UI.
Reviewed Changes
Copilot reviewed 28 out of 31 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
packages/react-openapi/src/OpenAPIWebhook.tsx | New component for displaying the webhook block |
packages/react-openapi/src/OpenAPISpec.tsx | Updated to handle OpenAPIWebhookData and conditionally set securities |
packages/react-openapi/src/OpenAPIResponseExample.tsx | Refactored to use updated media type content handling |
packages/react-openapi/src/OpenAPIRequestBody.tsx | Header now conditionally displays "Payload" for webhook operations |
packages/react-openapi/src/OpenAPIOperation.tsx | Simplified operation layout using the new summary component |
packages/react-openapi/src/OpenAPIMediaType.tsx | Renamed and refactored media type state and footer components |
packages/gitbook/src/lib/openapi/types.ts | Added new type for OpenAPIWebhookBlock |
packages/gitbook/src/lib/openapi/resolveOpenAPIWebhookBlock.ts | Added resolver logic for the webhook block |
packages/gitbook/src/components/DocumentView/OpenAPI/OpenAPIWebhook.tsx | Integrated new webhook component into the document view |
.changeset/light-mirrors-give.md | Documented the addition of the OpenAPI Webhook block |
Files not reviewed (3)
- package.json: Language not supported
- packages/cache-tags/package.json: Language not supported
- packages/gitbook/src/components/DocumentView/OpenAPI/style.css: Language not supported
Comments suppressed due to low confidence (1)
packages/react-openapi/src/OpenAPIRequestBody.tsx:21
- Consider using a more explicit type guard or discriminant to determine whether 'data' represents a webhook operation rather than relying on the existence of a 'name' property. This may improve readability and maintainability when differentiating between OpenAPIOperationData and OpenAPIWebhookData.
const header = 'name' in data ? 'Payload' : 'Body';
DEMO :

CleanShot.2025-04-15.at.17.17.55.mp4