sphinx-contrib / sphinx-contrib/openapi
Unexpected KeyError with simple descriptor
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 126
- Forks
- 88
- PR merge metrics
- No merged PRs in 30d
Description
sphinx 2.4.4 +
sphinxcontrib-openapi in /usr/local/lib/python3.7/site-packages (0.7.0)
test-0.1.yml:
openapi: 3.0.1
info:
title: the title
description: A nice API
contact:
name: Fred
url: https://gigantic-server.com
email: Fred@gigagantic-server.com
license:
name: Apache 2.0
url: https://foo.bar
version: "v1.1"
RST file content:
.. openapi:: test-0.1.yml
sphinx-build -b html -d build/doctrees source build/html
Running Sphinx v2.4.4
making output directory... done
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 11 source files that are out of date
updating environment: [new config] 11 added, 0 changed, 0 removed
reading sources... [ 72%] operator-setup
Exception occurred:
File "/usr/local/lib/python3.7/site-packages/sphinxcontrib/openapi/utils.py", line 105, in normalize_spec
for endpoint in spec['paths'].values():
KeyError: 'paths'
The full traceback has been saved in /var/folders/kw/y4ys06qn4bx8lww9yszq5h480000gn/T/sphinx-err-xwso7dyr.log, if you want to report the issue to the developers.
Please also report this if it was a user error, so that a better error message can be provided next time.
A bug report can be filed in the tracker at https://github.com/sphinx-doc/sphinx/issues. Thanks!
log file:
...
File "/usr/local/lib/python3.7/site-packages/docutils/parsers/rst/states.py", line 196, in run
results = StateMachineWS.run(self, input_lines, input_offset)
File "/usr/local/lib/python3.7/site-packages/docutils/statemachine.py", line 239, in run
context, state, transitions)
File "/usr/local/lib/python3.7/site-packages/docutils/statemachine.py", line 460, in check_line
return method(match, context, next_state)
File "/usr/local/lib/python3.7/site-packages/docutils/parsers/rst/states.py", line 2344, in explicit_markup
nodelist, blank_finish = self.explicit_construct(match)
File "/usr/local/lib/python3.7/site-packages/docutils/parsers/rst/states.py", line 2356, in explicit_construct
return method(self, expmatch)
File "/usr/local/lib/python3.7/site-packages/docutils/parsers/rst/states.py", line 2099, in directive
directive_class, match, type_name, option_presets)
File "/usr/local/lib/python3.7/site-packages/docutils/parsers/rst/states.py", line 2148, in run_directive
result = directive_instance.run()
File "/usr/local/lib/python3.7/site-packages/sphinxcontrib/openapi/directive.py", line 56, in run
return renderer_cls(self.state, self.options).render(spec)
File "/usr/local/lib/python3.7/site-packages/sphinxcontrib/openapi/renderers/abc.py", line 40, in render
for line in self.render_restructuredtext_markup(spec):
File "/usr/local/lib/python3.7/site-packages/sphinxcontrib/openapi/renderers/_httpdomain_old.py", line 42, in render_restructuredtext_markup
utils.normalize_spec(spec, **self._options)
File "/usr/local/lib/python3.7/site-packages/sphinxcontrib/openapi/utils.py", line 105, in normalize_spec
for endpoint in spec['paths'].values():
KeyError: 'paths'
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
Reproduce the failure with the provided test-0.1.yml, RST directive, and sphinx-build command. Read sphinxcontrib/openapi/utils.py at normalize_spec and follow the calls from directive.py and renderers/_httpdomain_old.py; done means this descriptor no longer raises the reported KeyError during the build.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi, python
- Domain
- documentation
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100