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

InterfaceTypeDefinition should contain "possibleTypes" as returned by introspection #2166

Closed
cooniur opened this issue Jan 28, 2021 · 2 comments
Labels

Comments

@cooniur
Copy link

cooniur commented Jan 28, 2021

Library version: v16.1

Describe the bug
TL;DR
For an interface type, the possibleTypes should be captured in InterfaceTypeDefinition by IntrospectionResultToSchema.

Details:
When introspecting an interface type, the introspection result would look like (example taken from this test):

{
  "kind": "INTERFACE",
  "name": "Character",
  "description": "A character in the Star Wars Trilogy",
  "fields": [
    {
      "name": "id",
      "description": "The id of the character.",
      "args": [],
      "type": {
        "kind": "NON_NULL",
        "name": null,
        "ofType": {
          "kind": "SCALAR",
          "name": "String",
          "ofType": null
        }
      },
      "isDeprecated": false,
      "deprecationReason": null
    },
    ...
  ],
  "inputFields": null,
  "interfaces": null,
  "enumValues": null,
  "possibleTypes": [
    {
      "kind": "OBJECT",
      "name": "Human",
      "ofType": null
    },
    {
      "kind": "OBJECT",
      "name": "Droid",
      "ofType": null
    }
  ]
}

The IntrospectionResultToSchema#createSchemaDefinition can parse the introspection result and returns the InterfaceTypeDefinition object. However, the possibleTypes are lost during the parsing. In fact, the InterfaceTypeDefinition class itself does not contain a data structure to capture possible types at all (as compared to the UnionTypeDefinition which contains memberTypes that is used to contain possible types).

This would make it difficult to analyze GraphQL types programmatically because of the missing possible types information.

To Reproduce
Run IntrospectionResultToSchemaTest and look at interfaceTypeDefinition variable, it cannot return a list of possible types ([Human, Droid]).

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 29, 2023
@dondonz
Copy link
Member

dondonz commented Jun 5, 2024

Hello as this issue is quite old and hasn't received any extra comments lately, I'll close this issue out.

If you'd like to make a new comment please do open a new issue, thanks!

@dondonz dondonz closed this as completed Jun 5, 2024
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

3 participants
@cooniur @dondonz and others