Openapi schema generation does not support serializers not subclassing GeoFeatureModelSerializer #257
Closed
Description
I have a pretty simple model:
from django.contrib.gis.db import models
class StoredRaster(models.Model):
file_arn = models.CharField(max_length=1024, null=True)
footprint = models.PolygonField(srid=4326, null=True)
If I try to now generate a schema of this model, it will declare the footprint
field as a string type, rather than the GeoJSON representation that the API would actually return. This causes clients to fail type validation on responses.
You can see that the schema generation logic explicitly checks for this serializer in both of these places:
https://github.com/openwisp/django-rest-framework-gis/blob/master/rest_framework_gis/schema.py#L162-L169
https://github.com/openwisp/django-rest-framework-gis/blob/master/rest_framework_gis/schema.py#L109-L113
The logic for map_field
should be adapted to also handle GeometryField
s
Metadata
Assignees
Labels
No labels