Skip to content

Commit

Permalink
Merge pull request #120 from flxdot/optional-description
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenfin authored Dec 6, 2022
2 parents c78bf64 + 82a458d commit 1f06ad8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions sphinxcontrib/openapi/openapi20.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def _httpresource(endpoint, method, properties, convert):
# print response status codes
for status, response in sorted(responses.items()):
yield '{indent}:status {status}:'.format(**locals())
for line in convert(response['description']).splitlines():
for line in convert(response.get('description', '')).splitlines():
yield '{indent}{indent}{line}'.format(**locals())

# print request header params
Expand All @@ -70,7 +70,7 @@ def _httpresource(endpoint, method, properties, convert):
for status, response in responses.items():
for headername, header in response.get('headers', {}).items():
yield indent + ':resheader {name}:'.format(name=headername)
for line in convert(header['description']).splitlines():
for line in convert(header.get('description', '')).splitlines():
yield '{indent}{indent}{line}'.format(**locals())

for status, response in responses.items():
Expand Down
6 changes: 3 additions & 3 deletions sphinxcontrib/openapi/openapi30.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ def _httpresource(endpoint, method, properties, convert, render_examples,
yield ''

if 'description' in properties:
for line in convert(properties['description']).splitlines():
for line in convert(properties.get('description', '')).splitlines():
yield '{indent}{line}'.format(**locals())
yield ''

Expand Down Expand Up @@ -330,7 +330,7 @@ def _httpresource(endpoint, method, properties, convert, render_examples,
# print response status codes
for status, response in responses.items():
yield '{indent}:status {status}:'.format(**locals())
for line in convert(response['description']).splitlines():
for line in convert(response.get('description', '')).splitlines():
yield '{indent}{indent}{line}'.format(**locals())

# print response example
Expand All @@ -351,7 +351,7 @@ def _httpresource(endpoint, method, properties, convert, render_examples,
for status, response in responses.items():
for headername, header in response.get('headers', {}).items():
yield indent + ':resheader {name}:'.format(name=headername)
for line in convert(header['description']).splitlines():
for line in convert(header.get('description', '')).splitlines():
yield '{indent}{indent}{line}'.format(**locals())

for cb_name, cb_specs in properties.get('callbacks', {}).items():
Expand Down

0 comments on commit 1f06ad8

Please sign in to comment.