opened
antonioperic
username_0
We have situation where in our graphql schema we have fields 
`taxon.main `which is string
and `taxon.others` which is `array` of `strings` all strings are code/id of `Tours` in our case.

<img width="1437" alt="image" src="https://user-images.githubusercontent.com/2453151/72687292-b3be8a80-3afc-11ea-9dd9-f316a348d88b.png">

what we want to achieve is replacing only code with entire information for Taxon, partially we did this with this part of code:

```
exports.createSchemaCustomization = ({ actions, schema }) => {
  const { createTypes } = actions
  const typeDefs = [
    "type Product implements Node",
    schema.buildObjectType({
      name: "Product",
      fields: {
        taxons: {
          type: "Tours",
          resolve: (source, args, context, info) => {
            console.log("source", source)
            // If you were linking by ID, you could use `getNodeById` to
            // find the correct author:
            // return context.nodeModel.getNodeById({
            //   id: source.author,
            //   type: "AuthorJson",
            // })
            // But since the example is using the author email as foreign key,
            // you can use `runQuery`, or get all author nodes
            // with `getAllNodes` and manually find the linked author
            // node:
            return context.nodeModel
                .getAllNodes({ type: "Tours" })
                .find(tour => tour.code === source.taxons.main)
          },
        },
      },
    }),
  ]
  createTypes(typeDefs)
}
```

the result is that we have all Taxon information in taxons field, but main and others fields are now null.

<img width="1440" alt="image" src="https://user-images.githubusercontent.com/2453151/72687354-45c69300-3afd-11ea-9400-2f324fdb0d34.png">

What we will have to achive is to have taxon.main as Tour object and taxon.others as array of Tour objects
How to override graphql schema when we have array?
issue
created
LekoArts
username_1
Hi, thanks for the issue! Could you please explain your issue in more detail and possibly give a [minimal reproduction][reproduction].

Thanks for using Gatsby! 💜

[reproduction]: https://gatsby.dev/reproduction
comment
created
davorduhovic
username_2
Hi @username_0 , you can do something like this,    

`type Product implements Node {
			taxons: ProductTaxon 
		}`,
    `type ProductTaxon { 
			main: Tours! @link(by: "code") 
			others: [Tours]! @link(by: "code") 
  }`

this will link Tours by foreign-key: more data here https://www.gatsbyjs.org/docs/schema-customization/#foreign-key-fields.
comment
created
antonioperic
username_0
@username_2 thank you, seems that works!
comment
closed
antonioperic
username_0
issue