Skip to content
This repository has been archived by the owner on Mar 20, 2023. It is now read-only.

Validate static schema on middleware mount #698

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

Conversation

ValeriaVG
Copy link

Problem:
Static schema only gets validated on the first request, which causes server to successfully start and pass health checks

Solution:
If static schema is provided - validate it on mount and throw an error if validation fails

@IvanGoncharov
Copy link
Member

@ValeriaVG Totally agree that it should be done 👍
One issue that I see is that it would be extremely hard to debug schema validation errors.
As a general rule schema should be validated once in user code, we plan to add something like GraphQLFinalizedSchema (validated and frozen) in graphql-js and force users to call something like schema.finalize() in their code.

I will keep this PR as a bug report until it is implemented in the next version of express-graphql.

Base automatically changed from master to main February 10, 2021 15:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants