Schema generation with an HStoreField gives an incorrect type · Issue #6913 · encode/django-rest-framework (original) (raw)

Checklist

Steps to reproduce

On any serializer, add an HStoreField.

class HStoredSerializer(serializers.Serializer): myfield = serializers.HStoreField()

class HStoredAPIView(CreateAPIView): serializer_class = HStoredSerializer ...

Expected behavior

Output of ./manage.py generateschema:

paths: /api/hstored: post: operationId: CreateHStored parameters: [] requestBody: content: application/json: schema: required: - myfield properties: myfield: type: object

Actual behavior

Output of ./manage.py generateschema:

paths: /api/hstored: post: operationId: CreateHStored parameters: [] requestBody: content: application/json: schema: required: - myfield properties: myfield: type: string

It seems that we should only need to add a line to the FIELD_CLASS_SCHEMA_TYPE dict found here; if that's all we need, I can easily open a PR myself.