From f5b0cb878d27952f350b6aa871bd6b73e065bc09 Mon Sep 17 00:00:00 2001 From: "Terence D. Honles" Date: Fri, 21 Feb 2020 17:26:56 -0800 Subject: [PATCH 1/3] Fix duration field inspector - Durations should be represented as an `openapi.TYPE_STRING` so swagger and other tools do not prevent valid input ("00:10:00" is valid, but not a number) See: https://www.django-rest-framework.org/api-guide/fields/#durationfield and https://docs.djangoproject.com/en/3.0/ref/utils/#django.utils.dateparse.parse_duration --- src/drf_yasg/inspectors/field.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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)), From 620ff7bd76ce7d84b7045c9bcffea2c3f903978f Mon Sep 17 00:00:00 2001 From: Joel Lefkowitz Date: Mon, 10 Jan 2022 16:04:12 +0000 Subject: [PATCH 2/3] Remove 'v' from version tag format --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 8d37121e..c9d69041 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -3,7 +3,7 @@ name: Publish on: push: tags: - - "v*.*.*" + - "*.*.*" jobs: publish: From 3110ebb23d3ba283eb747044e446d950ca6336c7 Mon Sep 17 00:00:00 2001 From: Joel Lefkowitz Date: Thu, 14 Jul 2022 16:44:45 +0100 Subject: [PATCH 3/3] Add setuptools-scm to publishing dependencies --- requirements/publish.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/requirements/publish.txt b/requirements/publish.txt index 9006a710..9f84aec3 100644 --- a/requirements/publish.txt +++ b/requirements/publish.txt @@ -1 +1,2 @@ -wheel>=0.37.0 \ No newline at end of file +setuptools-scm==7.0.5 +wheel>=0.37.0