hasura / hasura/graphql-engine

Geometry Scalar should expect a WKT or a Geometry Object.

Open
#10,667 2 comments 0 reactions 0 assignees View on GitHub
c/v3-ndc-postgres k/enhancement
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

### Component
c/v3-engine

### Is your proposal related to a problem?
At the moment it's necessary to stringify the geometry object.

```gql
query find($Geometry:Geometry!){
postcode(where:{geometry:{st_contains:$Geometry}}){
number
}
}
```
```json
{
"Geometry": "{\"type\":\"Point\",\"coordinates\":[391968,5818620],\"crs\":{\"type\":\"name\",\"properties\":{\"name\":\"EPSG:25833\"}}}"
}
```

### Describe the solution you'd like
Geometry should be a Object instead of a Scalar. This would not only align with the way geometry inputs work but also enable the graphql engine and ui tools like houdini to check the validity of the input in advance. i.e. disallow geometries with an invalid type property.

```gql
query find($Geometry:Geometry!){
postcode(where:{geometry:{st_contains:$Geometry}}){
number
}
}
```
```json
{
"Geometry": {
"type": "Point",
"coordinates": [
391968,
5818620
],
"crs": {
"type": "name",
"properties": {
"name": "EPSG:25833"
}
}
}
}
```

### Describe alternatives you've considered

Contributor guide

Open the contributing guide

Research direction

Start in the c/v3-engine Geometry scalar and its GraphQL input definition, then trace how the Geometry variable is validated. Confirm the expected object shape and invalid type handling before checking the existing geometry input behavior. Done means Geometry variables accept objects directly and reject invalid type values without requiring stringification.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, typescript
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.