Skip to content

Conversation

@iamakulov
Copy link
Contributor

Fixes #7. Fixes #8.

Before, for a JSON shape of

{
  name: 'Luke Skywalker',
  limbs: [
    { kind: 'arm', position: 'left', length: 76 },
    { kind: 'arm', position: 'left', length: 76 },
    { kind: 'leg', position: 'left', length: 81 },
    { kind: 'leg', position: 'right', length: 82 },
  ],
}

graphql-compose-json was calculating the type of the limbs field as [JSON]. Because of this, you weren’t able to query subfields of the limb field. Reproduction

This PR fixes that issue. Now, the getFieldConfig method passes typeName and fieldName down when it encounters an error, and the library goes deeper into the array.

opts && opts.typeName && opts.fieldName
? {
typeName: `${opts.typeName}_${upperFirst(opts.fieldName)}`,
fieldName: '0',
Copy link
Member

@nodkz nodkz Aug 14, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rewrite this method on

{
  typeName: opts.typeName
  fieldName: opts.fieldName
}

Person_Limbs is a better name for typename rather than Person_Limbs_0

@nodkz nodkz merged commit 6ba50b2 into graphql-compose:master Aug 15, 2019
@nodkz
Copy link
Member

nodkz commented Aug 15, 2019

Great job 👍
Tnx

@nodkz
Copy link
Member

nodkz commented Aug 15, 2019

🎉 This PR is included in version 4.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

working with nested/plural fields Shallow?

2 participants