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

Incorrect model when using references as types #73

Open
fvieira opened this issue Mar 25, 2020 · 1 comment
Open

Incorrect model when using references as types #73

fvieira opened this issue Mar 25, 2020 · 1 comment

Comments

@fvieira
Copy link

fvieira commented Mar 25, 2020

Due to GraphQL restrictions, references cannot be inline in arrays and have to be extracted and referenced as types. The issue is that this library faild to build the correct model when the references are not inline.

This is the code for inline references and the model built (correct):

{
  name: 'myObject',
  type: 'object',
  fields: [
    {
      name: 'myArrayOfReferences',
      type: 'array',
      of: [
        {
          name: 'myReferencedTypeReference',
          type: 'reference',
          to: {
            type: 'myReferencedType',
          },
        },
      ],
    },
  ],
}

correct

And this is the code with the reference as an external type (which is equivalent to the previous code) and the model built (incorrect):

{
  name: 'myReferencedTypeReference',
  type: 'reference',
  to: {
    type: 'myReferencedType',
  },
},
{
  name: 'myObject',
  type: 'object',
  fields: [
    {
      name: 'myArrayOfReferences',
      type: 'array',
      of: [
        {
          type: 'myReferencedTypeReference',
        },
      ],
    },
  ],
}

incorrect

@camjc
Copy link
Member

camjc commented Apr 3, 2020

I've at least got some tests running against this repo now, so we can now modify the get nodes function and the fixtures to solve your test case.

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