openwisp / django-rest-framework-gis

Geographic add-ons for Django REST Framework. Maintained by the OpenWISP Project.
http://openwisp.org
MIT License
1.07k stars 200 forks source link

OpenAPI schema generation fails if the GeometryField is not in the model #264

Open AntoninRousset opened 2 years ago

AntoninRousset commented 2 years ago

This piece of code will cause the schema generation to fail if the GeometryField is not in the model, e.g. it is an annotation or a custom property.

I don't see any simple solution (without custom get_field), beside having multiple serializer fields: PointField, LineStringField, etc.)

auvipy commented 2 years ago

@dhaval-mehta what do you think on this?