Skip to content

Improve OpenAPI parsing errors #3555

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 1 commit into from
Aug 13, 2025
Merged

Conversation

gregberge
Copy link
Contributor

@gregberge gregberge commented Aug 12, 2025

We make the error more explicit, saying that we didn't find any version.

CleanShot 2025-08-12 at 14 29 52@2x

Copy link

linear bot commented Aug 12, 2025

Copy link

changeset-bot bot commented Aug 12, 2025

🦋 Changeset detected

Latest commit: 636d324

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 Patch
@gitbook/react-openapi 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 Aug 12, 2025

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

Build Status Details Updated (UTC)
customers-v2 (Inspect) ✅ No changes detected - Aug 13, 2025, 11:32 AM
v2-cloudflare (Inspect) ✅ No changes detected - Aug 13, 2025, 11:38 AM
v2-vercel (Inspect) 👍 Changes approved 1 changed Aug 13, 2025, 11:34 AM

@gregberge gregberge requested a review from Copilot August 12, 2025 12:36
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 improves OpenAPI parsing error messages by making version-related errors more explicit and refactors some function names for clarity.

  • Added explicit error handling for missing OpenAPI/Swagger versions with clearer error messages
  • Refactored function and variable names for better clarity (cache vs weakmap, NoCache suffix)
  • Updated test expectations to match the new error message format

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/openapi-parser/src/v3.ts Added explicit version validation with improved error message and restructured validation logic
packages/openapi-parser/src/parse.test.ts Updated test to expect the new, more specific error message
packages/gitbook/src/lib/openapi/resolveOpenAPIOperationBlock.ts Renamed variables and functions for clarity (weakmap → cache, base → NoCache)
packages/gitbook/src/lib/openapi/fetch.ts Refactored function names and added documentation, plus a console.log statement
.changeset/tough-beers-own.md Added changeset for the OpenAPI parsing improvements

We make the error more explicit, saying that we didn't find any version.
@gregberge gregberge force-pushed the greg/rnd-7600-openapi-null-schema branch from d67c455 to 636d324 Compare August 13, 2025 11:24
@gregberge gregberge merged commit 42c17f5 into main Aug 13, 2025
16 checks passed
@gregberge gregberge deleted the greg/rnd-7600-openapi-null-schema branch August 13, 2025 11:38
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