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

Type name is null in introspection when using Type::listOf #63

Closed
dmongeau opened this issue Oct 25, 2016 · 3 comments
Closed

Type name is null in introspection when using Type::listOf #63

dmongeau opened this issue Oct 25, 2016 · 3 comments

Comments

@dmongeau
Copy link
Contributor

As described in the issue folkloreinc/laravel-graphql#50 the type name is null when using listOf.

Query:

{  
  __type(name: "User") { 
    name 
    fields { 
      name 
      type { 
        name 
      } 
    } 
  } 
}

Response:

{
  "data":{
    "__type":{
      "name": "User",
      "fields":[
        {"name": "followings", "type":{"name": null }},
      ]
    }
  }
}

I suspect this is because public $name is not set in the ListOfType. It may be setted in the constructor. I can submit a pull request if it makes sense.

@vladar
Copy link
Member

vladar commented Oct 26, 2016

It is not a bug. ListOf and NonNull are not named types (their name is null). Instead wrapped type is stored in ofType field.

Change your query to:

{  
  __type(name: "User") { 
    name 
    fields { 
      name 
      type { 
        kind
        name 
        ofType {
          name
        }
      } 
    } 
  } 
}

and you will see what I mean.

If you try graphql-js at http://graphql-swapi.parseapp.com/ and run the same query against any type containing nonNull or listOf field - it will return the same result.

Also I am curious where do you use this?

@vladar vladar closed this as completed Oct 26, 2016
@dmongeau
Copy link
Contributor Author

Ok I understand, sorry about that! Actually, it's not coming from me. Someone as filled an issue on laravel-graphql.

@vladar
Copy link
Member

vladar commented Oct 26, 2016

No problem! %)

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