Skip to content

Commit bcfa4fb

Browse files
authored
Merge branch 'master' into strict-validation-pr
2 parents cb12cac + 858ac78 commit bcfa4fb

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

flask_restx/api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -503,11 +503,11 @@ def endpoint(self, name):
503503
@property
504504
def specs_url(self):
505505
"""
506-
The Swagger specifications absolute url (ie. `swagger.json`)
506+
The Swagger specifications relative url (ie. `swagger.json`)
507507
508508
:rtype: str
509509
"""
510-
return url_for(self.endpoint("specs"), _external=True)
510+
return url_for(self.endpoint("specs"))
511511

512512
@property
513513
def base_url(self):

flask_restx/fields.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ def __init__(
156156
self.description = description
157157
self.required = required
158158
self.readonly = readonly
159-
self.example = example or self.__schema_example__
159+
self.example = example if example is not None else self.__schema_example__
160160
self.mask = mask
161161

162162
def format(self, value):

tests/test_fields.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,14 @@ def test_with_default(self):
298298
assert not field.required
299299
assert field.__schema__ == {"type": "boolean", "default": True}
300300

301+
def test_with_example(self):
302+
field = fields.Boolean(default=True, example=False)
303+
assert field.__schema__ == {
304+
"type": "boolean",
305+
"default": True,
306+
"example": False,
307+
}
308+
301309
@pytest.mark.parametrize(
302310
"value,expected",
303311
[

0 commit comments

Comments
 (0)