aiohttp-swagger
aiohttp-swagger copied to clipboard
patch: More verbose yaml errors
When the docstring is invalid yaml/swagger, the generated swagged documentation just shows:
Invalid Swagger
⚠ Swagger document could not be loaded from docstring ⚠
This change makes the docstring parsing step a bit more verbose to indicate that there are problems. It is still not ideal but it is an improvement over guessing/ copy-pasta into a validator.
How to test that this is working:
- create a aiohttp route with docstring, add it to the app with the swagger plugin
- start the app
- navigate to the /api/doc page and find the route observe that the route is displayed correctly in the swagger page
- change the docstring to invalid yaml (e.g. by indenting with tabs)
- (re) start the app observe that there is more verbose output
- (re) navigat ot the /api/doc page and find the route observe that the route now probably is labeled as 'Invalid Swagger'
Codecov Report
Merging #84 into master will decrease coverage by
3.43%. The diff coverage is0%.
@@ Coverage Diff @@
## master #84 +/- ##
=========================================
- Coverage 94.73% 91.3% -3.44%
=========================================
Files 4 4
Lines 133 138 +5
=========================================
Hits 126 126
- Misses 7 12 +5
| Impacted Files | Coverage Δ | |
|---|---|---|
| aiohttp_swagger/helpers/builders.py | 86.66% <0%> (-5.1%) |
:arrow_down: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update db559ae...a85683e. Read the comment docs.