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

Implemented a safe way to build a schema #374

Merged
merged 2 commits into from
Sep 2, 2020
Merged

Conversation

vepanimas
Copy link
Collaborator

@vepanimas vepanimas commented Aug 31, 2020

Partially addresses these issues #348 #344 #340 #201 #313 #309.

The main goal of this PR is to avoid re-declaration errors during the schema build and not to fail completely in such cases:

type Query {
  user: User
}

type Query {
  cart: Cart
}
type Query {
  user: User;
}

extend type Query {
  user: User;
}

This situation occurs quite often when the schema is divided into several files and is collected during the build or in runtime. For example, this can often be found when using graphql-modules.

It doesn't fix error messages though, they are still pretty confusing and useless because they don't help you to find where the re-declaration is located. I think we should completely ignore them from graphql-java and implement custom inspections, which could be configured or even disabled by the user.

Also we should support resolving multiple declarations using PsiPolyVariantReference.

@Nullable
protected T myBuiltDefinition;

public void addDefinition(@NotNull SDLDefinition<?> definition) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addDefinition(T)?

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