Skip to content

Commit 372f74f

Browse files
committed
Allow empty value with default
1 parent 9cf677e commit 372f74f

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

openapi_core/wrappers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def create(self, request, spec):
7070
if param.required:
7171
raise
7272

73-
if not param.schema or not param.schema.default:
73+
if not param.schema or param.schema.default is None:
7474
continue
7575
raw_value = param.schema.default
7676

tests/integration/data/v3.0/petstore.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@ paths:
3434
type: integer
3535
format: int32
3636
nullable: true
37+
- name: search
38+
in: query
39+
description: Search query
40+
schema:
41+
type: string
42+
default: ""
43+
allowEmptyValue: true
3744
- name: ids
3845
in: query
3946
description: Filter pets with Ids

tests/integration/test_petstore.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ def test_get_pets(self, spec):
137137
'query': {
138138
'limit': 20,
139139
'page': 1,
140+
'search': '',
140141
'ids': [12, 13],
141142
}
142143
}
@@ -212,6 +213,7 @@ def test_get_pets_none_value(self, spec):
212213
'query': {
213214
'limit': None,
214215
'page': 1,
216+
'search': '',
215217
}
216218
}
217219

0 commit comments

Comments
 (0)