diff --git a/src/drf_yasg/inspectors/field.py b/src/drf_yasg/inspectors/field.py index 09386363..9a16a3ca 100644 --- a/src/drf_yasg/inspectors/field.py +++ b/src/drf_yasg/inspectors/field.py @@ -380,7 +380,7 @@ def decimal_field_type(field): (models.DateTimeField, (openapi.TYPE_STRING, openapi.FORMAT_DATETIME)), (models.DateField, (openapi.TYPE_STRING, openapi.FORMAT_DATE)), (models.DecimalField, (decimal_field_type, openapi.FORMAT_DECIMAL)), - (models.DurationField, (openapi.TYPE_INTEGER, None)), + (models.DurationField, (openapi.TYPE_STRING, None)), (models.FloatField, (openapi.TYPE_NUMBER, None)), (models.IntegerField, (openapi.TYPE_INTEGER, None)), (models.IPAddressField, (openapi.TYPE_STRING, openapi.FORMAT_IPV4)), @@ -407,7 +407,7 @@ def decimal_field_type(field): (serializers.IntegerField, (openapi.TYPE_INTEGER, None)), (serializers.FloatField, (openapi.TYPE_NUMBER, None)), (serializers.DecimalField, (decimal_field_type, openapi.FORMAT_DECIMAL)), - (serializers.DurationField, (openapi.TYPE_NUMBER, None)), # ? + (serializers.DurationField, (openapi.TYPE_STRING, None)), (serializers.DateField, (openapi.TYPE_STRING, openapi.FORMAT_DATE)), (serializers.DateTimeField, (openapi.TYPE_STRING, openapi.FORMAT_DATETIME)), (serializers.ModelField, (openapi.TYPE_STRING, None)),