Skip to content

Conversation

@nolannbiron
Copy link
Member

No description provided.

@linear
Copy link

linear bot commented Oct 27, 2025

@changeset-bot
Copy link

changeset-bot bot commented Oct 27, 2025

🦋 Changeset detected

Latest commit: b796508

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

This PR includes changesets to release 1 package
Name Type
@gitbook/cli 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
Contributor

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 validation for OpenAPI specification slugs to ensure they match required patterns and length constraints before publishing. The changes extract validation constants from the OpenAPI spec and implement client-side validation with improved error handling.

Key Changes:

  • Added slug validation using pattern matching and length constraints from the API spec
  • Introduced a logger utility for consistent error messaging
  • Created a build-time script to extract constants from OpenAPI specification

Reviewed Changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/cli/src/openapi/publish.ts Added validateSlug function to validate slugs before API calls; improved error handling with logger
packages/cli/src/logger.ts New logger utility with colored console output for different log levels
packages/cli/package.json Added picocolors dependency for terminal color support
packages/api/src/index.ts Exported constants module to make validation constants available
packages/api/scripts/extract-constants.ts Build script to extract validation constants from OpenAPI specification
packages/api/build.sh Added step to run constants extraction during build
packages/api/.gitignore Ignore generated constants.ts file
.changeset/funny-geese-mix.md Changeset documenting the slug validation feature

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@nolannbiron nolannbiron force-pushed the nolann/rnd-8496-dont-allow-openapi-spec-published-through-the-cli-to-have-a branch from b977d2d to 5b88011 Compare October 27, 2025 14:40
@pkg-pr-new
Copy link

pkg-pr-new bot commented Oct 29, 2025

Open in StackBlitz

bun add https://pkg.pr.new/GitbookIO/integrations/@gitbook/api@1029

commit: b796508

@nolannbiron nolannbiron force-pushed the nolann/rnd-8496-dont-allow-openapi-spec-published-through-the-cli-to-have-a branch from 9aeb770 to b796508 Compare October 29, 2025 13:14
@nolannbiron nolannbiron merged commit 9275222 into main Oct 29, 2025
13 checks passed
@nolannbiron nolannbiron deleted the nolann/rnd-8496-dont-allow-openapi-spec-published-through-the-cli-to-have-a branch October 29, 2025 13: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.

3 participants