marshmallow-code / flask-smorest

DB agnostic framework to build auto-documented REST APIs with Flask and marshmallow
https://flask-smorest.readthedocs.io
MIT License
653 stars 73 forks source link

Excluding certain blueprints from auto-generated docs #376

Open reederz opened 2 years ago

reederz commented 2 years ago

I have an app, with two separate REST APIs - private api and public api. Is there a way to mark certain blueprints to be blacklisted from auto-generated docs?

I found that I can register my private api blueprints directly on flask app instead of flask_smorest.Api instance, but I am unsure if this will break something.

lafrech commented 2 years ago

There is no officially supported way to achieve this.

Related to #110 and #277. Perhaps a common solution ought to be offered.

pmdarrow commented 1 year ago

@reederz (or any others that come across this) - I've written a helper that enables flask-smorest routes decorated with a @public_docs decorator to be rendered in a separate OpenAPI spec. It basically processes the output of flask openapi write openapi.json and creates a new spec with just the endpoints (and their related schemas) that have the x-public property. See the implementation here.