sphinx-contrib / sphinx-contrib/openapi
Missing header descriptions in response raise exception
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 126
- Forks
- 88
- PR merge metrics
- No merged PRs in 30d
Description
In my sample project on AWS I've enabled cors and since then I get this error.
Exception occurred:
File "/Users/cionzo/myproject/venv/lib/python3.8/site-packages/sphinxcontrib/openapi/openapi30.py", line 354, in _httpresource
for line in convert(header['description']).splitlines():
KeyError: 'description'
It occurs at the point of generating the docs for the OPTIONS method (depending on the cors).
The openapi document is generated by aws apigateway, hence I have almost no control on it.
I suggest modifying line 354 of openapi30.py in order to cope with missing header descriptions and using a default value:
for line in convert(header.get('description', '')).splitlines():
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Inspect sphinxcontrib/openapi/openapi30.py around line 354, where response header descriptions are converted during documentation generation. Reproduce the AWS API Gateway OPTIONS case with a header lacking a description, then verify generation completes without the KeyError and still handles headers that include descriptions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, openapi, python
- Domain
- api, documentation
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100