flasgger icon indicating copy to clipboard operation
flasgger copied to clipboard

apidocs endpoint

Open moshere opened this issue 6 years ago • 5 comments

Hi, I would like to change the apidocs url endpoint to some other endpoint such as api-docs. Is there any way to do this through some configuration?

Thank you Moshe

moshere avatar Jan 23 '19 17:01 moshere

You can config the Flasgger though Flask's config, eg:

SWAGGER = {
    "specs": [
        {
            "endpoint": "apispec_1",
            "route": "/project/apispec_1.json",
            "rule_filter": lambda rule: True,  # all in
            "model_filter": lambda tag: True,  # all in
        }
    ],
    "static_url_path": "/project/flasgger_static",
    "swagger_ui": True,
    "specs_route": "/project/apidocs"
}

strongbugman avatar Jan 24 '19 06:01 strongbugman

@moshere You should close this issue if the given response was correct.

Dakad avatar Jul 15 '19 22:07 Dakad

I tried this:

template = {
    "info": {
        "title": "My API"
    },
    "specs_route": "/api/"
}
swagger = Swagger(app, template=template)

But the route is still /apidocs

shapiro2 avatar Mar 12 '20 00:03 shapiro2

Hi, pls see source code: default config: https://github.com/flasgger/flasgger/blob/7f8bb663b177d936a1a7921db0acfeecd75edce5/flasgger/base.py#L162

https://github.com/flasgger/flasgger/blob/7f8bb663b177d936a1a7921db0acfeecd75edce5/flasgger/base.py#L178

and set specs_route https://github.com/flasgger/flasgger/blob/7f8bb663b177d936a1a7921db0acfeecd75edce5/flasgger/base.py#L565

Try this:

config = {
     "specs_route": "/api/"
}
swagger = Swagger(app, config=config)

mirecl avatar May 03 '20 20:05 mirecl

swagger = Swagger(app, config=config, merge=True)

yerco avatar Dec 22 '22 17:12 yerco