Open markedwards opened 3 months ago
An alternative here, for my use case, is simply to not serve any documentation at all, and to output openapi.json somewhere other than /public. This is an internal API which should not be publicly documented.
I would go with the Next.js middleware and add redirection logic there for serving both docs route and the openapi.json
file from the public folder only for authenticated users and redirect non-authenticated users to whatever auth provider you are using.
Thanks, that was the plan I concocted. Have you given consideration to exposing options to configure next-rest-framework
without generating a docs route? Maybe this could be done via a config file in the project root or some such.
Use cases could include:
openapi.json
spec, without docs<RedocStandalone />
in a page route/public
Looking for options to put API documentation behind auth. Is this just a matter of wrapping the
GET
returned bydocsRoute
? There's also the matter of protecting theopenapi.json
.