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

some nested properties are not getting property generated in queries #86

Open
pyramation opened this issue Mar 10, 2022 · 1 comment
Open
Labels
bug Something isn't working

Comments

@pyramation
Copy link
Contributor

pyramation commented Mar 10, 2022

Integrating the postgis stuff, everything works well except GeometryCollection, which apparently has a nested property

For a given property bounds, the admin is generating this query:

    bounds {
          geojson
      srid
      geometries
      __typename
    }

but the geometries is actually another nested object and the correct format should be


bounds {
          geojson
      srid
      geometries {
        geojson
      }
      __typename
    }

Here is my config

        const dataProvider = await pgDataProvider(client, {
          typeMap: {
            Interval: {
              expand: true,
              queryValueToInputValue
            },
            GeometryPoint: {
              expand: true,
              queryValueToInputValue: (value) => value?.geojson
            },
            GeometryGeometry: {
              expand: true,
              queryValueToInputValue: (value) => value?.geojson
            },
            GeometryGeometryCollection: {
              expand: true,
              queryValueToInputValue: (value) => value?.geojson
            },
            GeometryMultiPolygon: {
              expand: true,
              queryValueToInputValue: (value) => value?.geojson
            },
            GeometryPolygon: {
              expand: true,
              queryValueToInputValue: (value) => value?.geojson
            },
            Json: {
              expand: true,
              queryValueToInputValue: (value) => value
            }
          }
        });

I've currently used excludeFields to just exclude the geometries from the query, so I've found a workaround, but figured I would take note of the issue here.

Temporary fix:

            GeometryGeometryCollection: {
              expand: true,
              excludeFields: ['geometries'],
              queryValueToInputValue: (value) => value?.geojson
            },
@BowlingX
Copy link
Owner

Thank you; I will look into that!

@BowlingX BowlingX added the bug Something isn't working label Mar 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants