Skip to content

Commit 5823ff8

Browse files
authored
Merge pull request #468 from python-openapi/docs/clarify-intentionally-invalid-validate-example
Clarify usage example for intentionally invalid spec
2 parents 90a94ed + 8b86b95 commit 5823ff8

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

README.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,10 @@ Python package
104104
# If no exception is raised by validate(), the spec is valid.
105105
validate(spec_dict)
106106
107-
validate({'openapi': '3.1.0'})
107+
# Example of an intentionally invalid spec.
108+
invalid_spec = {'openapi': '3.1.0'}
109+
110+
validate(invalid_spec)
108111
109112
Traceback (most recent call last):
110113
...

docs/python.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ By default, OpenAPI spec version is detected. To validate spec:
1313
# If no exception is raised by validate(), the spec is valid.
1414
validate(spec_dict)
1515
16-
validate({'openapi': '3.1.0'})
16+
# Example of an intentionally invalid spec.
17+
invalid_spec = {'openapi': '3.1.0'}
18+
19+
validate(invalid_spec)
1720
1821
Traceback (most recent call last):
1922
...

0 commit comments

Comments
 (0)