Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

move name validation in production to separate validation step #4431

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

Open
wants to merge 3 commits into
base: next
Choose a base branch
Loading
from

Conversation

yaacovCR
Copy link
Contributor

@yaacovCR yaacovCR commented Jun 6, 2025

Motivation:

  • Improve known-valid schema construction time as much as possible.

Background:

  • All schema validation except name validation is currently performed separately in the validateSchema(...), which optimizes schema construction for known-valid schemas.
  • Name validation is an exception, which provides useful localized dev feedback if a naming mistake has been made, see GraphQLSchema does not completely validate names #4362 and especially this comment which details some history of the code changes.
  • This PR adds name validation to the validateSchema(...) step and makes it so that in a production environment only, name validation is skipped during schema construction.

Depends on:

Prior proposals:

JoviDeCroock and others added 3 commits June 4, 2025 13:57
Re-implements graphql#4386 with a configurable function variable initialized to a no-op function in production builds. This is apparently optimizable by v8, as it has no performance hit when setEnv('development') is not called.

This should also allow for tree-shaking in production builds, as the development instanceOf function should not be included within the production bundle if setEnv is not called, although this has not been confirmed.

To avoid a performance hit, setEnv('development') calls setInstanceOfCheckForEnv('development') which sets the function variable to developmentInstanceOfCheck. Setting a property on globalThis was tested, but reading the property led to a small performance hit.

Co-Authored-By: Yaacov Rydzinski <yaacovCR@gmail.com>
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
Morty Proxy This is a proxified and sanitized view of the page, visit original site.