Skip to content

Commit

Permalink
Fix missing assignment for default in openapi.Parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
axnsan12 committed Feb 22, 2018
1 parent 64c280e commit f15e70b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
8 changes: 8 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
Changelog
#########


*********
**1.4.3**
*********

- **FIXED:** added a missing assignment that would cause the ``default`` argument to ``openapi.Parameter.__init__`` to
be ignored

*********
**1.4.2**
*********
Expand Down
1 change: 1 addition & 0 deletions src/drf_yasg/openapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,7 @@ def __init__(self, name, in_, description=None, required=None, schema=None,
self.enum = enum
self.pattern = pattern
self.items = items
self.default = default
self._insert_extras__()
if self['in'] == IN_PATH:
# path parameters must always be required
Expand Down
2 changes: 1 addition & 1 deletion testproj/articles/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Meta:


class ImageUploadSerializer(serializers.Serializer):
what_am_i_doing = serializers.RegexField(regex=r"^69$", help_text="test")
what_am_i_doing = serializers.RegexField(regex=r"^69$", help_text="test", default="69")
image_styles = serializers.ListSerializer(
child=serializers.ChoiceField(choices=['wide', 'tall', 'thumb', 'social']),
help_text="Parameter with Items"
Expand Down
3 changes: 2 additions & 1 deletion tests/reference.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,10 @@ paths:
- name: what_am_i_doing
in: formData
description: test
required: true
required: false
type: string
pattern: ^69$
default: '69'
- name: image_styles
in: formData
description: Parameter with Items
Expand Down

0 comments on commit f15e70b

Please sign in to comment.