Page MenuHomeSoftware Heritage

apidoc: harden the decorator stack
ClosedPublic

Authored by jbertran on Sep 8 2016, 12:15 PM.

Details

Summary

Avoid breaking endpoints when apidoc decorators are in the wrong order
(or when an endpoint function is missing a docstring)

Test Plan

Tests to be added once we're OK with the Apidoc logic changes.

Diff Detail

Repository
rDWAPPS Web applications
Branch
ApidocChanges
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 466
Build 685: Software Heritage Python tests
Build 684: arc lint + arc unit

Event Timeline

jbertran retitled this revision from to apidoc: harden the decorator stack.
jbertran updated this object.
jbertran edited the test plan for this revision. (Show Details)
ardumont added inline comments.
swh/web/ui/apidoc.py
124

Please remove if useless.

129

Can you please try to clarify this code?
After some oral discussion, it's still not completely clear to me ^^.

If you don't find a way to improve on this, please, at least, add some comments to try and explain it.

Thanks a bunch.

193

Remove print please.

206–207

It'd be nice to have a developer exception here when the docstring is missing.

Something like for example (feel free to adapt ^^):

if not f.__doc__:
    raise Exception('Apidoc %s: expected a docstring'
                    ' for function %s'
                    % (self.__class__.__name__, f.__name__))
ardumont edited edge metadata.
jbertran edited edge metadata.

Add doc, custom exception

jbertran edited edge metadata.

Fix phrasing in README-dev

jbertran edited edge metadata.

Rebase onto master

This revision is now accepted and ready to land.Sep 9 2016, 11:37 AM
This revision was automatically updated to reflect the committed changes.