AndreasFaust / gatsby-source-custom-api

Source data from any API and transform it to (File-)Nodes.
52 stars 25 forks source link

Missing fields in result #34

Open chrneumann opened 2 years ago

chrneumann commented 2 years ago

Hey,

for a Schema like this:

        rootKey: 'stations',
        schemas: {
          stations: `
            features: [features]
          `,
          features: `
            properties: properties
            geometry: geometry
          `,
          properties: `
            name: String
          `,
          geometry: `
            coordinates: [Float]
          `,

And a query like this:

query MyQuery {
  allFeatures {
    totalCount
    edges {
      node {
        id
        properties {
          name
        }
      }
    }
  }
}

I get incomplete results (properties is null):

{
  "data": {
    "allFeatures": {
      "totalCount": 5556,
      "edges": [
        {
          "node": {
            "id": "d92c142e-fd57-56e7-8c7e-d5401d119dd2",
            "properties": null
          }
        },
[...]

Querying for allProperties or allGeometry works as expected. Is this a Bug (sounds like https://github.com/AndreasFaust/gatsby-source-custom-api/issues/8)?

chrneumann commented 2 years ago

https://github.com/AndreasFaust/gatsby-source-custom-api/issues/32 seems similar

chrneumann commented 2 years ago

And it seems to work if I don't supply a schema at all and only use allStations.

mikerudge commented 2 years ago

@chrneumann did you find a solution to this. Pretty sure I am getting the same thing

In the following example, interests is fine but every other type returns null.

const articles = `
user: ArticleUser
post_type: PostType
interests: [Interest]
images: ArticleImage
`;

const ArticleImage = `
banner: String
thumbnail: String
square: String
full: String
`;

const Interest = `
date: String
hidden: Boolean
ID: Int
link: String
slug: String
title: String
tag: String
`;
chrneumann commented 2 years ago

No, I wrote a custom plugin that downloads the data to a .json. After that, I use gatsby-transformer-json to access the data.