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

The parent selection or operation does not resolve to a valid schema type #340

Closed
1 of 2 tasks
dandv opened this issue May 28, 2020 · 6 comments
Closed
1 of 2 tasks
Labels
Milestone

Comments

@dandv
Copy link

dandv commented May 28, 2020

Before you create the issue

Version and Environment Details

Operation system: Ubuntu 20

IDE name and version: WebStorm 2020.2 EAP, Build #WS-202.4357.21, built on May 26, 2020

Plugin version: 2.4.0

Steps to Reproduce / Link to Repo with Reproduction and Instructions

I use graphql-modules on the server, and in my web app I have a .tsx file with this query

gql`
    query($id: ID!) {
      product(id: $ID) {
        id
      }
    }
  `

On the server, the schema looks like this:

export const ProductModule = new GraphQLModule({
  imports: [
    AuthModule,
  ],

  typeDefs: gql`
    scalar DateTime

    input ProductInput {
      ...
    }

    "Alias: Item"
    type Product {
      id: ID!
      "Alias: title"
      name: String!
      ...
    }

    type Query {
      "Find product by id"
      product(id: ID!): Product
      ...
    }

I can work on a reproduction repo upon request.

@jimkyndemeyer
Copy link
Collaborator

Hi Dan,

Thanks for using the plugin.

Using the SDL you've shown I don't get an error. Please add a reproduction.

Thanks.

@davoam
Copy link

davoam commented Jun 17, 2020

@jimkyndemeyer Hi!

Thanks for the plugin!

I also had this error after upgrading to version 2.5.0. All my queries became invalid, and all had this error The parent selection or operation does not resolve to a valid schema type.

I downgraded to version 2.4.0 and everything works fine

@vepanimas vepanimas added the bug label Aug 19, 2020
@vepanimas vepanimas added this to the 2.6.0 milestone Aug 19, 2020
@vepanimas
Copy link
Collaborator

@davoam hello! I'm trying to reproduce this one, could you please provide a minimal reproducible example? Or if it's not possible, provide any information as described in this comment #348 (comment)?

@davoam
Copy link

davoam commented Aug 30, 2020

@vepanimas I read your comment and solved the problem. Thanks!

I have a script which generates GraphQL schema. When I run it, it uses some files to generate final schema. It complained that some instances are defined in final schema and in these files. For example, SomeInput was defined in final schema file and in these files which I use to generate final schema.

input SomeInput {
        someNumber: Int!
        someString: String!
}

I have added files which I use to generate final schema to excludes section of plugin config file (.graphqlconfig).

Now everything works

@vepanimas
Copy link
Collaborator

@davoam thank you for the info, that's very helpful! I'm working now on improving the user experience for the case when some types/fields are duplicated. It definitely shouldn't break such features as resolve and autocomplete, and the errors should be more meaningful.

@vepanimas
Copy link
Collaborator

@dandv it should work better with graphql-modules in the 2.6.0 version, so I'm closing this now. If you encounter any problems, please feel free to report them, it will be very appreciated!

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