Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make #/definitions optional as prescribed in the Swagger 2.0 spec
- Loading branch information
Showing
2 changed files
with
30 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,35 @@ | ||
import json | ||
import pytest | ||
|
||
from swagger_spec_validator.validator20 import validate_spec | ||
|
||
|
||
@pytest.fixture | ||
def minimal_swagger_dict(): | ||
"""Return minimal dict that respresents a swagger spec - useful as a base | ||
template. | ||
""" | ||
return { | ||
'swagger': '2.0', | ||
'info': { | ||
'title': 'Test', | ||
'version': '1.0', | ||
}, | ||
'paths': { | ||
}, | ||
'definitions': { | ||
}, | ||
} | ||
|
||
|
||
def test_success(petstore_contents): | ||
validate_spec(json.loads(petstore_contents)) | ||
|
||
|
||
def test_definitons_not_present_success(minimal_swagger_dict): | ||
del minimal_swagger_dict['definitions'] | ||
validate_spec(minimal_swagger_dict) | ||
|
||
|
||
def test_empty_definitions_succes(minimal_swagger_dict): | ||
validate_spec(minimal_swagger_dict) |