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

SchemaTypeChecker does not check interface extension field types #2542

Open
ctrlcwho opened this issue Sep 9, 2021 · 2 comments
Open

SchemaTypeChecker does not check interface extension field types #2542

ctrlcwho opened this issue Sep 9, 2021 · 2 comments
Labels

Comments

@ctrlcwho
Copy link

ctrlcwho commented Sep 9, 2021

private void checkFieldTypesPresent(TypeDefinitionRegistry typeRegistry, List<GraphQLError> errors, TypeDefinition typeDefinition, List<FieldDefinition> fields) {

The SchemaTypeChecker class only checks type extension field types, not interface extension fields, this seems like inconsistent behavior.
To reproduce, simply run the following type registry through graphql.schema.idl.SchemaTypeChecker#checkTypeRegistry:

interface BaseType {
  id: String
}
extend interface BaseType {
  reference: OtherType
}

No error related to OtherType not existing within the type registry will be thrown, but when you make the interface into a type, the type registry checker will return a validation error.

@bbakerman
Copy link
Member

When we first put the TypeDefinitionRegistry code in place, we put in a series of checks to make sure we had a consistent and correct schema - aka these rules.

Later we learnt that there are cases that can be really checked until you have a full schema so we started to check schema invariants the GraphqlSchema .build() code.

I guess my point of this story is - if this referenced OtherType can exist in GraphqlSchema form then its a bug.

However if after calling SchemaParser + SchemaGenerator there is an SchemaProblem throw by some part of the code then its not a bug, just not implemented all in SchemaTypeChecker

Copy link

Hello, this issue has been inactive for 60 days, so we're marking it as stale. If you would like to continue this discussion, please comment within the next 30 days or we'll close the issue.

@github-actions github-actions bot added the Stale label Dec 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants
@bbakerman @ctrlcwho and others