Skip to content

perf: remove schema-utils dependency and validation - #78

Merged
chenjiahan merged 2 commits into
mainfrom
remove_validation_0227
Feb 27, 2026
Merged

chenjiahan merged 2 commits into
mainfrom
remove_validation_0227

Conversation

@chenjiahan

Copy link
Copy Markdown
Member

The schema validation was removed, use TypeScript type checking instead.

Copilot AI review requested due to automatic review settings February 27, 2026 07:19
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly refactors the configuration validation mechanism by eliminating the schema-utils dependency. The change aims to streamline the codebase and potentially improve performance by relying on TypeScript's inherent type safety for schema validation, rather than a runtime utility. This aligns with a modern TypeScript-first development approach, reducing external dependencies and simplifying the validation process.

Highlights

  • Dependency Removal: The schema-utils dependency has been completely removed from the project, including its entry in package.json and pnpm-lock.yaml.
  • Schema Validation Refactor: The explicit schema validation using schema-utils has been replaced by leveraging TypeScript's static type checking for configuration validation.
  • Code Cleanup: Related imports, type definitions, and validation calls associated with schema-utils have been removed from src/server.ts and src/types.ts.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • package.json
    • Removed schema-utils from devDependencies.
  • pnpm-lock.yaml
    • Removed the schema-utils entry.
  • src/server.ts
    • Removed the import of validate from schema-utils.
    • Removed the import of the Schema type.
    • Removed the validate function call in the Server class constructor.
    • Removed the Schema type annotation from the static get schema() getter.
  • src/types.ts
    • Removed the Schema type definition and its associated biome-ignore comment.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request removes the schema-utils dependency to improve performance by eliminating runtime option validation, relying instead on TypeScript's static type checking. The changes are consistent across the codebase. I have one suggestion regarding maintainability: since the options.json schema file is still exposed to consumers, there's a risk of it diverging from the TypeScript types over time. I've recommended adding a test to ensure the JSON schema and the TypeScript types remain synchronized, which would benefit all consumers of the library.

I am having trouble creating individual review comments. Click here to see my feedback.

src/server.ts (191-194)

medium

Removing runtime validation shifts the responsibility of providing correct options to the consumer, relying on TypeScript for static verification. While this improves performance, a potential maintainability issue arises because options.json is still exported for consumers via Server.schema. This file can now easily get out of sync with the TypeScript types (DevServer / Configuration), which are the new source of truth.

To prevent this schema drift, I suggest adding a test to ensure options.json and the TypeScript types remain consistent. A tool like typescript-json-schema could generate a schema from the types at test time, which can then be compared against the committed options.json. This would ensure a reliable contract for all consumers, whether they use TypeScript or JavaScript.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request removes the schema-utils dependency and its runtime validation in favor of relying solely on TypeScript's compile-time type checking. The change removes the validate() call from the Server constructor that was performing runtime options validation against a JSON schema.

Changes:

  • Removed schema-utils dependency from package.json and pnpm-lock.yaml
  • Removed runtime validation call from Server constructor
  • Removed Schema type export from types.ts
  • Updated schema getter to return untyped schema object

Reviewed changes

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

File Description
src/types.ts Removed Schema type export (previously used to type the JSON schema)
src/server.ts Removed schema-utils import, validate() call, and Schema type; updated schema getter return type
package.json Removed schema-utils ^4.2.0 dependency
pnpm-lock.yaml Removed schema-utils package lock entry
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (1)

src/server.ts:202

  • The static schema getter is still exposed and returns the JSON schema, but the schema is no longer used internally for validation. This creates inconsistency:
  1. External consumers (like webpack CLI, documentation generators, or validation tools) may depend on this schema and expect it to be synchronized with actual validation behavior
  2. The schema file (options.json) is still maintained but not validated against

Consider:

  • If external tools rely on this schema, document that it's provided for external use only
  • If no external consumers exist, consider removing the schema getter and the unused schema import
  • If keeping the schema for documentation purposes, add a comment explaining its purpose
    return {
      all: false,
      hash: true,

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

Comment thread src/server.ts
Comment thread src/server.ts
@chenjiahan
chenjiahan merged commit 8a8278e into main Feb 27, 2026
4 checks passed
@chenjiahan
chenjiahan deleted the remove_validation_0227 branch February 27, 2026 07: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