Make to code to skip checking swagger responses which don't have an
application/json example clearer.
This commit is contained in:
parent
9896f98e2b
commit
f827765ba1
1 changed files with 4 additions and 3 deletions
|
@ -30,10 +30,11 @@ except ImportError as e:
|
|||
|
||||
|
||||
def check_response(filepath, request, code, response):
|
||||
example = None
|
||||
try:
|
||||
example = json.loads(
|
||||
response.get('examples', {}).get('application/json', "null")
|
||||
)
|
||||
example_json = response.get('examples', {}).get('application/json')
|
||||
if example_json:
|
||||
example = json.loads(example_json)
|
||||
except Exception as e:
|
||||
raise ValueError("Error parsing JSON example response for %r %r" % (
|
||||
request, code
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue