Skip to content
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

Make it impossible to construct an InputSchema that does not validate #4899

Merged
merged 7 commits into from
Nov 15, 2023

Conversation

lutter
Copy link
Collaborator

@lutter lutter commented Sep 28, 2023

With these changes, an InputSchema is validated as soon as it is constructed, ensuring that any InputSchema is actually valid.

This PR also does:

  • move the validations for an InputSchema from Schema to InputSchema (they were in Schema for bad historical reasons)
  • fixes all the schemas we use in tests to be actually valid
  • adds a validation for the id field; in practice, all schemas pass this validation, but it's good to spell the requirement out explicitly
  • adds a small tool to bulk validate InputSchemas; that was used on the schemas from the hosted service to make sure that all existing schemas pass the new id validation

@azf20 azf20 requested a review from mangas October 23, 2023 15:40
@lutter
Copy link
Collaborator Author

lutter commented Oct 23, 2023

Rebase to latest master

@lutter lutter force-pushed the lutter/validate branch 3 times, most recently from 8d37ceb to 6719e9c Compare November 14, 2023 08:42
These validations only makes sense for input schemas, not generic GraphQL
schemas
Since validation of InputSchema isn't mandatory, many of the schemas we use
in our tests actually failed validation. This commit addresses that.
This hadn't been done before, though in practice it was probably never
violated (presumably since graph-cli enforces such rules, and because
trying to deploy such a schema would end badly)

The `examples/validate.rs` is a tool that makes it possible to bulk
validate subgraph schemas.
@lutter lutter merged commit 4a16783 into master Nov 15, 2023
@lutter lutter deleted the lutter/validate branch November 15, 2023 11:06
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