diff --git a/drf_spectacular/plumbing.py b/drf_spectacular/plumbing.py index 71c2cdde..face6f79 100644 --- a/drf_spectacular/plumbing.py +++ b/drf_spectacular/plumbing.py @@ -199,7 +199,9 @@ def build_parameter_type( explode=None, style=None ): - irrelevant_field_meta = ['readOnly', 'writeOnly', 'nullable', 'default'] + irrelevant_field_meta = ['readOnly', 'writeOnly'] + if location == OpenApiParameter.PATH: + irrelevant_field_meta += ['nullable', 'default'] schema = { 'in': location, 'name': name, diff --git a/tests/test_extend_schema.yml b/tests/test_extend_schema.yml index abb463a1..82d0ce91 100644 --- a/tests/test_extend_schema.yml +++ b/tests/test_extend_schema.yml @@ -231,6 +231,8 @@ paths: - a - b type: string + default: + - a - in: query name: stars schema: