Skip to content

fix(codegen): add GeoJSONFilter for PostGIS geometry/geography fields#793

Closed
pyramation wants to merge 2 commits intomainfrom
devin/1773284011-postgis-codegen-fix
Closed

fix(codegen): add GeoJSONFilter for PostGIS geometry/geography fields#793
pyramation wants to merge 2 commits intomainfrom
devin/1773284011-postgis-codegen-fix

Conversation

@pyramation
Copy link
Contributor

fix(codegen): add GeoJSONFilter for PostGIS geometry/geography fields

Summary

Previously, PostGIS geometry columns (GeoJSON, Geometry, GeometryPoint, Point) were present in SCALAR_TS_MAP (mapped to unknown) but had no entry in SCALAR_FILTER_MAP. This caused geometry columns to be silently omitted from generated filter types — so you couldn't even do isNull checks on geometry fields through the generated TypeScript SDK.

This PR adds:

  • SCALAR_FILTER_MAP: GeoJSON, Geometry, GeometryPoint, PointGeoJSONFilter
  • SCALAR_FILTER_CONFIGS: GeoJSONFilter with equality + distinct operators (isNull, equalTo, notEqualTo, distinctFrom, notDistinctFrom), typed as unknown
  • Unit test for GeoJSONFilter generation
  • PostGIS schema fixture (example-postgis.schema.graphql) with Place/Route entities containing GeoJSON columns
  • 13 integration tests exercising the full codegen pipeline

Scope note: This does NOT add PostGIS spatial operators (contains, intersects, within, etc.) — those are provided at runtime by postgraphile-plugin-connection-filter-postgis and would require a more complex codegen approach. This PR only ensures geometry columns aren't dropped from filter types entirely.

Review & Testing Checklist for Human

  • Verify unknown is the right TS type for GeoJSON filter values. equalTo?: unknown provides no type safety. Consider whether this should be Record<string, unknown> or a GeoJSON-specific type. The precedent is that SCALAR_TS_MAP already maps GeoJSON→unknown, so this is consistent — but it's a design choice worth affirming.
  • Verify the fixture schema matches real PostGraphile + graphile-postgis output. The example-postgis.schema.graphql is hand-crafted. Compare the shape (especially PlaceFilter.location: GeoJSONFilter) against what PostGraphile actually generates for a table with a geometry column when graphile-postgis and connection-filter-postgis plugins are loaded.
  • Run codegen against a real project with PostGIS columns to confirm the generated SDK includes geometry fields in filter types and compiles cleanly. The integration tests use a synthetic fixture, not a real introspected schema.
  • Scan the 14 updated snapshots — they should all be identical additions of the GeoJSONFilter interface block after VectorFilter. No other snapshot content should have changed.

Notes

Adds GeoJSON/Geometry/GeometryPoint/Point → GeoJSONFilter mapping to
SCALAR_FILTER_MAP so PostGIS geometry columns appear in generated filter
types instead of being silently omitted.

Changes:
- Add GeoJSON, Geometry, GeometryPoint, Point to SCALAR_FILTER_MAP
- Add GeoJSONFilter config with equality/distinct operators
- Add GeoJSONFilter unit test
- Add PostGIS schema fixture (example-postgis.schema.graphql)
- Add 13 PostGIS integration tests (Place/Route with GeoJSON columns)
- Update 14 snapshots to include GeoJSONFilter
@devin-ai-integration
Copy link
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Base automatically changed from devin/1773279354-fix-vector-codegen-v2 to main March 12, 2026 04:32
@pyramation pyramation closed this Mar 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant