Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Copilot Lvl 2
Message 1 of 4

defaultValue in introspection query returns wrongly encoded value if its type is a list of enum

I'm currently trying to generate an actual schema from github's graphql api using graphql-java, via introspection query.

 

I've already created an issue in graphql-java repo.

https://github.com/graphql-java/graphql-java/issues/1509

 

The problem is, defaultValue in introspection query is wrongly formatted if its type is `List<Enum>`.

 

below is the instrospection query I used and its result

https://gist.github.com/yshrsmz/c038c3bfb751b7a738a46589c91dbdb2

 

Here's an affiliations definition for `pinnedRepositories` input

 

{
  "name": "affiliations",
  "description": "Array of viewer's affiliation options for repositories returned from the connection. For example, OWNER will include only repositories that the current viewer owns.",
  "type": {
    "kind": "LIST",
    "name": null,
    "ofType": {
      "kind": "ENUM",
      "name": "RepositoryAffiliation",
      "ofType": null
    }
  },
  "defaultValue": "[\"OWNER\", \"COLLABORATOR\"]"
},

as you can see, its type is `List<RepositoriAffiliation>`, and defaultValue is `"[\"OWNER\", \"COLLABORATOR\"]"`, looks like `List<String>`.

 

According to the graphql spec(https://graphql.github.io/graphql-spec/June2018/#sec-The-__InputValue-Type),  defaultValue may return a String encoding (using the GraphQL language) of the default value.

 

So I think default value for this list of enum type should be `"[OWNER, COLLABORATOR]"`.

3 Replies
Community Manager
Message 2 of 4

Re: defaultValue in introspection query returns wrongly encoded value if its type is a list of enum

Thanks for reaching out.

 

Other than not being able to generate a schema, is this causing any other problems with being able to use the API itself?

 

Copilot Lvl 2
Message 3 of 4

Re: defaultValue in introspection query returns wrongly encoded value if its type is a list of enum

Hi, thanks for the reply.

 

> Other than not being able to generate a schema, is this causing any other problems with being able to use the API itself?

 

I can use graphql API itself, but as I need schema definition of the API, this is causing huge trouble.

Community Manager
Message 4 of 4

Re: defaultValue in introspection query returns wrongly encoded value if its type is a list of enum

I'm still not certain I understand what problem this could be causing. However, I've logged your feature request in our internal feature request list. Though I can't guarantee anything or share a timeline for this, I can tell you that it's been shared with the appropriate teams for consideration.

Please let me know if you have any other questions.