fix(graphile-postgis): camelCase @spatialRelation field + PascalCase filter type#1006
Merged
pyramation merged 1 commit intomainfrom Apr 18, 2026
Merged
fix(graphile-postgis): camelCase @spatialRelation field + PascalCase filter type#1006pyramation merged 1 commit intomainfrom
pyramation merged 1 commit intomainfrom
Conversation
…filter type The generated GraphQL for a @spatialRelation tag like '@spatialRelation inside_neighborhood neighborhoods.geom st_within' used to produce a field and type whose casing passed through the raw tag identifier verbatim: inside_neighborhood?: PlaceSpatialInside_neighborhoodFilter; Normalize the relation name through the standard Graphile inflectors so the GraphQL identifiers follow the same conventions as every other generated field/type: insideNeighborhood?: PlaceSpatialInsideNeighborhoodFilter; Also camelCase the parametric arg name (e.g. 'travel_distance' → 'travelDistance') on parametric ops (st_dwithin). Added a unit test that pins this behavior. While here, re-export graphile-connection-filter's declaration-merge augmentations from its package entry so that satellite plugins (like graphile-postgis) that type-only import the package actually pick up the Inflection.filterType/filterManyType augmentations the file already declared — the satellite plugin was previously relying on an augmentation chain that was never loaded via the public barrel, which produced TS2339 errors during typecheck.
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A
@spatialRelationtag likeused to generate a filter whose casing passed the raw tag identifier through verbatim:
The fix routes the relation name through the standard Graphile inflectors so spatial-relation identifiers follow the same conventions as every other generated GraphQL type/field:
Concretely:
inflection.upperCamelCase(rel.relationName)instead of a rawcharAt(0).toUpperCase()splice.inflection.camelCase(rel.relationName).travel_distance→travelDistance) is normalized at collection time so both the GraphQL field and thevalue[paramFieldName]read insideapply()stay consistent.Both inflectors are idempotent on already-camelCased input, so existing tags such as
nearbyClinic/intersectingCountykeep producing the exact same identifiers they do today (theTelemedicineClinicFilter.nearbyClinic/distanceassertions ingraphql/orm-test/__tests__/postgis-spatial-relations.test.tsall still hold).Drive-by: connection-filter augmentation barrel
While adding the test,
jestsurfaced a pre-existing TS2339 in the same plugin:graphile-connection-filter/src/augmentations.tsdeclares thefilterType/filterManyTypeinflection augmentations, but the package barrel never imported it — so any satellite plugin that only didimport 'graphile-connection-filter';(as this one does) couldn't see the augmentations. Every plugin inside the package imports../augmentationsdirectly, but downstream consumers can't reach into that path.Fixed by loading the augmentations from the public barrel: <ref_snippet file="/home/ubuntu/repos/constructive/graphile/graphile-connection-filter/src/index.ts" lines="52-59" />
Review & Testing Checklist for Human
@spatialRelationtag and confirm the emitted*Filterinterface now usescamelCasefield names andPascalCasefilter-type names (including thePlaceSpatial*Filterthat triggered this).where: { inside_neighborhood: … }(should be none, but worth a quick grep across downstream apps) — the field name changes from snake_case to camelCase. This is a breaking change on the generated schema if anyone was somehow writing snake_case relation tags in production.st_dwithin travel_distance) produces a GraphQL field namedtravelDistanceand that the subfilter still propagates the numeric value correctly at runtime.Notes
graphile-postgisunit tests still pass; a newcamelCases snake_case parametric arg namestest pins the parametric-arg fix.Link to Devin session: https://app.devin.ai/sessions/51d10f7657484009ba4b4c303b9704e4
Requested by: @pyramation