flask-smorest icon indicating copy to clipboard operation
flask-smorest copied to clipboard

Excluding certain blueprints from auto-generated docs

Open reederz opened this issue 3 years ago • 2 comments

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.

reederz avatar Jul 21 '22 09:07 reederz

There is no officially supported way to achieve this.

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

lafrech avatar Jul 27 '22 19:07 lafrech

@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.

pmdarrow avatar Oct 26 '22 20:10 pmdarrow