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

Validation: forbid __schema outside of the root type #903

Closed
Geal opened this issue Aug 29, 2024 · 2 comments
Closed

Validation: forbid __schema outside of the root type #903

Geal opened this issue Aug 29, 2024 · 2 comments

Comments

@Geal
Copy link
Contributor

Geal commented Aug 29, 2024

According to @IvanGoncharov , __schema should not be used outside of the root type: apollographql/router#5255 (comment)

Do we check this somewhere?

@SimonSapin
Copy link
Contributor

In a typical schema, non-root types don’t have a __schema field so converting AST to an ExecutableDocument would fail with a BuildError::UndefinedField. In code, meta-fields like __schema are not present in the Rust struct ObjecType.fields but are returned if you instead call schema.type_field(type_name, field_name).

Defining a schema like type Something { __schema: Int } is disallowed per spec but we don’t yet implement that validation rule: #743

@SimonSapin
Copy link
Contributor

Closing as duplicate of #743

@SimonSapin SimonSapin closed this as not planned Won't fix, can't repro, duplicate, stale Sep 2, 2024
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

No branches or pull requests

2 participants