Repository navigation
Fix GeoJSON MultiPolygon coordinates flattening each polygon's rings - #10347
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The resolver change aligns output with the spec and is backed by new and updated snapshot tests that cover the previously incorrect nesting behavior.
Pull request overview
This PR fixes GeoJSONMultiPolygonType.coordinates output so each polygon emits its own array of linear rings (exterior ring first, followed by interior rings), preserving holes and matching the field description / RFC 7946 shape ([[[Position]]]) while keeping the Coordinates scalar type unchanged.
Changes:
- Added a dedicated
GetMultiPolygonCoordinatesresolver that returns rings-per-polygon (Coordinate[][][]) instead of flattening each polygon’s rings into a single coordinate list. - Updated
GeoJsonMultiPolygonTypeto use the new resolver for thecoordinatesfield. - Added/updated snapshot tests to cover a MultiPolygon containing both a holed polygon and a polygon without holes, and updated the existing MultiPolygon snapshot to reflect the corrected nesting.
File summaries
| File | Description |
|---|---|
| src/HotChocolate/Spatial/src/Types/GeoJsonResolvers.cs | Adds MultiPolygon-specific coordinate shaping (rings per polygon) and a shared helper to extract polygon rings. |
| src/HotChocolate/Spatial/src/Types/GeoJsonMultiPolygonType.cs | Switches coordinates field resolver from geometry-collection flattening to the new MultiPolygon-specific resolver. |
| src/HotChocolate/Spatial/test/Types.Tests/GeoJsonMultiPolygonTypeTests.cs | Adds a new execution test covering polygons with and without holes to prevent regression. |
| src/HotChocolate/Spatial/test/Types.Tests/snapshots/GeoJsonMultiPolygonTypeTests.*.snap | Updates and adds snapshots to assert the corrected per-polygon ring nesting. |
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Contributor
Patch coverage100.0% of changed lines covered (18/18)
Project coverage: 57.8% (287244/497254 lines) |
glen-84
added a commit
that referenced
this pull request
Sep 23, 2026
This was referenced Sep 26, 2026
Merged
This was referenced Oct 3, 2026
Open
This was referenced Oct 7, 2026
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
GeoJSONMultiPolygonType.coordinatesnow emits one ring array per polygon, exterior ring first, so a MultiPolygon's holes survive and the nesting matches the field's description and RFC 7946. The field keeps itsCoordinatesscalar type, so the schema does not change.Follow-up to #10345, covering the MultiPolygon part of #10341.
Test plan
GeoJsonMultiPolygonTypeTestscase with one holed and one plain polygon snapshotstype,coordinates,bbox, andcrs. It fails without the resolver change.MultiPolygon_Execution_Outputsnapshot is updated to the per-polygon ring shape.HotChocolate.Types.Spatial.Testspasses on net10.0.