Skip to content

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

Merged
merged 11 commits into from
Apr 18, 2025

Conversation

nolannbiron
Copy link
Member

@nolannbiron nolannbiron commented Apr 14, 2025

DEMO :
CleanShot 2025-04-15 at 17 17 24@2x

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

Copy link

linear bot commented Apr 14, 2025

Copy link

changeset-bot bot commented Apr 14, 2025

🦋 Changeset detected

Latest commit: 1e2ef19

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@gitbook/react-openapi Minor
gitbook Minor

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

Copy link

argos-ci bot commented Apr 15, 2025

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
customers-v1 (Inspect) 👍 Changes approved 6 changed Apr 15, 2025, 7:48 PM
customers-v2 (Inspect) 👍 Changes approved 8 changed Apr 15, 2025, 7:50 PM
default (Inspect) 👍 Changes approved 2 changed Apr 15, 2025, 7:52 PM
v2-vercel (Inspect) 👍 Changes approved 2 changed Apr 15, 2025, 7:53 PM

@nolannbiron nolannbiron marked this pull request as ready for review April 16, 2025 07:31
Copy link
Contributor

@Copilot Copilot AI left a 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';

@nolannbiron nolannbiron merged commit d67699a into main Apr 18, 2025
20 checks passed
@nolannbiron nolannbiron deleted the nolann/rnd-6895-parser-for-openapi-webhook-block branch April 18, 2025 06:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants