Skip to content
This repository has been archived by the owner on Dec 25, 2022. It is now read-only.

Schema hierarchy / image not being downloaded #32

Open
a-rbsn opened this issue Aug 31, 2021 · 0 comments
Open

Schema hierarchy / image not being downloaded #32

a-rbsn opened this issue Aug 31, 2021 · 0 comments

Comments

@a-rbsn
Copy link

a-rbsn commented Aug 31, 2021

I've encountered some strange behaviour — I'm building my schemas and it appears that I have to choose between either my images downloading, or to have my api being brought in correctly. The two options I am presented with:

  1. Have my data being brought in with the correct hierarchy (in my case: conferences->events->image), but the images don't get downloaded.
  2. Have my data being brought in with a flat hierarchy (conferences, events->image) and with the images downloading.

My api looks like this:
image

to have the correct hierarchy I need to use this config:

    {
      resolve: "gatsby-source-custom-api",
      options: {
        url: {
          production: "http://sculpture-poetry-cms.test/conferences.json",
          development: "http://sculpture-poetry-cms.test/conferences.json",
        },
        auth: {
          username: "username",
          password: "password",
        },
        rootKey: "spConferences",
        schemas: {
          spConferences: `
            conference: [conference]
          `,
          conference: `
            uid: String
            title: String
            description: String
            location: String
            byline: String
            startDate: String
            endDate: String
            button: button
            events: [event]
          `,
          event: `
            uid: String
            slug: String
            url: String
            title: String
            type: String
            description: String
            image: image
            eventLink: eventLink
            speakers: [speaker]
            date: String
            startTime: String
            endTime: String
          `,
          image: `
            url: String
            modified: String
          `,
          speaker: `
            uid: String
            name: String
            url: String
            slug: String
          `,
          button: `
            customText: String
            value: String
          `,
          eventLink: `
            customText: String
            value: String
          `,
        },
      },
    },

image

BUT if I change events: [event] to events: [events] and rename the event schema also to match, the images download — though I can then no longer access the event information through the conferences in GraphQL as they appear as null. The images appear under allImages?

image

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant