sphinx-contrib / sphinx-contrib/openapi

Parsing fails when a response includes a header without a description

Open
#80 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
126
Forks
88
PR merge metrics
No merged PRs in 30d

Description

The exception looks like this:

Exception occurred:
  File "/usr/local/lib/python3.7/site-packages/sphinxcontrib/openapi/openapi20.py", line 75, in _httpresource
    for line in convert(header['description']).splitlines():
KeyError: 'description'

It appears to be because _httpresource blindly defererences header['description']. According to HeaderObject the description field is not required.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in openapi20.py at the _httpresource method, especially line 75 where header['description'] is accessed. Reproduce the failure with an OpenAPI response header that omits description, then verify parsing completes without a KeyError and existing behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.