Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow description to be optional #120

Merged
merged 1 commit into from
Dec 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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