Fix gis contrib geometry resolution when using different source (ref #989) - #1428
Open
submarcos wants to merge 5 commits into
Open
Fix gis contrib geometry resolution when using different source (ref #989)#1428submarcos wants to merge 5 commits into
submarcos wants to merge 5 commits into
Conversation
submarcos
marked this pull request as draft
June 17, 2025 08:22
submarcos
marked this pull request as ready for review
November 17, 2025 15:24
Author
|
@tfranzel Hi. Can you take a look at this ? |
Author
There was a problem hiding this comment.
Pull request overview
This PR addresses issue #989 by fixing how GeoFeatureModelSerializer’s geo_field is resolved when the serializer field’s source does not directly match a model field name (e.g., source="aoi.geometry"), preventing KeyError during schema generation.
Changes:
- Update GIS contrib schema generation to resolve geometry model fields via
follow_field_source(...)using the serializer field’ssourcepath. - Add a regression test case covering a
GeoFeatureModelSerializerwhosegeo_fieldpoints to a serializer field with a differentsource. - Update the expected OpenAPI snapshot to include the new test route/schema.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
drf_spectacular/contrib/rest_framework_gis.py |
Fixes geometry model-field resolution by following the serializer field’s source path. |
tests/contrib/test_rest_framework_gis.py |
Adds a new GeoFeature serializer scenario to exercise “geo_field name != model field name”. |
tests/contrib/test_rest_framework_gis.yml |
Updates expected schema snapshot for the new endpoint/component. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
11 tasks
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.
Try to implement bugfix to #989