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 for x-enumDescriptions and x-gitbook-enum #3066

Merged
merged 6 commits into from
Mar 31, 2025

Conversation

nolannbiron
Copy link
Member

@nolannbiron nolannbiron commented Mar 28, 2025

DEMO

CleanShot.2025-03-28.at.21.12.42.mp4

Copy link

linear bot commented Mar 28, 2025

Copy link

changeset-bot bot commented Mar 28, 2025

🦋 Changeset detected

Latest commit: a7089f9

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

This PR includes changesets to release 3 packages
Name Type
@gitbook/openapi-parser Patch
@gitbook/react-openapi Patch
gitbook Patch

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 Mar 28, 2025

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

Build Status Details Updated (UTC)
customers-v1 (Inspect) ✅ No changes detected - Mar 28, 2025, 10:38 PM
customers-v2 (Inspect) ✅ No changes detected - Mar 28, 2025, 10:41 PM
default (Inspect) 👍 Changes approved 2 changed Mar 28, 2025, 10:42 PM
v2-vercel (Inspect) 👍 Changes approved 3 changed Mar 28, 2025, 10:43 PM

@nolannbiron nolannbiron changed the title Support for x-enumDescriptions Support for x-enumDescriptions and x-gitbook-enum Mar 28, 2025
@nolannbiron nolannbiron marked this pull request as ready for review March 28, 2025 21:33
@nolannbiron nolannbiron requested a review from Copilot March 28, 2025 21:33
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 x-enumDescriptions and x-gitbook-enum in the OpenAPI components, enhancing the display of enum values with optional descriptive tooltips. Key changes include:

  • Implementation of a new OpenAPITooltip component to wrap enum value display.
  • Updates to OpenAPISchemaEnum to prioritize x-gitbook-enum and x-enumDescriptions.
  • Refactoring of OpenAPICopyButton to utilize the new tooltip component for clipboard actions.

Reviewed Changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/react-openapi/src/OpenAPITooltip.tsx Introduces a tooltip wrapper component for displaying additional information.
packages/react-openapi/src/OpenAPISchema.tsx Updates enum rendering to support x-gitbook-enum and x-enumDescriptions, and revises title inference for enums.
packages/react-openapi/src/OpenAPICopyButton.tsx Refactors copy button to use OpenAPITooltip for improved UX.
packages/openapi-parser/src/types.ts Adds types for x-enumDescriptions and x-gitbook-enum.
.changeset/tame-colts-know.md Records version updates and changelog for the new features.
Files not reviewed (1)
  • packages/gitbook/src/components/DocumentView/OpenAPI/style.css: Language not supported
Comments suppressed due to low confidence (1)

packages/react-openapi/src/OpenAPISchema.tsx:281

  • [nitpick] Consider using a stable unique key (e.g. item.value) instead of the index to improve rendering consistency.
<span key={index} className="openapi-schema-enum-value">

@nolannbiron nolannbiron merged commit 813b2af into main Mar 31, 2025
18 checks passed
@nolannbiron nolannbiron deleted the nolann/rnd-6436-support-x-enumdescriptions branch March 31, 2025 10:18
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