Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow users to specify a filter function to remove endpoints from auto doc #12

Open
robertdzeigler opened this issue Jun 6, 2018 · 0 comments

Comments

@robertdzeigler
Copy link

I'm using httdomain on a tornado project with "auto tornado" to generate API documentation and it's great. A nice-to-have feature is the ability to specify a custom filter function to the autotornado directive to allow for greater dynamic control over which API routes are published vs. not. A few use cases include:

  • Private/internal APIs endpoints that shouldn't be accessed by end-users
  • "Unstable" APIs that are intended for eventual public consumption but should remain undocumented in official docs until the API has stabilized

I'd propose a "filter-endpoints" parameter to the auto tornado directive. It would take a tornado rule target (Rule or URLSpec) or a method/function target of such rule and return True to exclude the item (the item is filtered) and False to include it (the item is not filtered).

For instance, a filter function that excludes classes and methods which have "PRIVATE API" in the docstring:

def doctoring_private_filter(obj):
    return "PRIVATE API" in obj.__doc__

And would be setup as:

    .. autotornado:: yourwebapp:app
        :filter-endpoints: yourwebapp:docstring_private_filter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant