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

[Question] OpenAPI spec available on all subdomains, and route exclusion without decorators does not seem to work. #223

Open
nicolaipre opened this issue Aug 6, 2023 · 0 comments

Comments

@nicolaipre
Copy link

nicolaipre commented Aug 6, 2023

Is it possible to exclude a route from the OpenAPI spec without using decorators? I found information in the docs about excluding routes, but it did not work:

group = Blueprint(name, url_prefix=prefix, host=subdomain)

if not in_schema:
    openapi.exclude(bp=group)

I also use subdomains and noticed that the Redoc endpoint is available for every subdomain with the default path. Is it possible to reference the Blueprint directly instead of using app.config.OAS_URI_TO_* to set the path?

Ideally something like this (where RedocBlueprint is the blueprint which app.config.OAS_URI_TO_REDOC sends you to):

# Custom route registration because I do not want decorators
RouteGroup(
    subdomain="api",
    middleware=[""],
    name="API-Information", 
    #prefix="",
    routes=[
        GET("/docs", RedocBlueprint).name("Redoc"),
    ]
),

Goals:

  • Excluding a route from OpenAPI spec in Route definition
  • Reference Redoc/Swagger function paths directly instead of being available on all subdomains

I believe* this used to work with the old sanic-openapi:

from sanic_openapi import openapi3_blueprint

Is there any way I can disable the spec generation and Blueprint creation done by Sanic-ext, and manually handle this instead so I can register the blueprint and set a path to it myself?

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