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

Offline/firewalled mode #24

Closed
choobinejad opened this issue Jun 27, 2017 · 7 comments · Fixed by #100
Closed

Offline/firewalled mode #24

choobinejad opened this issue Jun 27, 2017 · 7 comments · Fixed by #100

Comments

@choobinejad
Copy link

There are several pointers in swagger-ui.js and swagger-ui-bundle.js to https://online.swagger.io/validator. These pointers cause the swagger UI to freeze.

Would it be possible to document "offline deployment" instructions, or even provide a configuration for whether or not the UI should try to access resources on external domains?

@Reinami
Copy link
Contributor

Reinami commented Aug 27, 2017

Would have to look into this.

@fredyw
Copy link
Contributor

fredyw commented Sep 9, 2017

Disabling online validator can be done by setting validatorUrl to null in SwaggerUIBundle of index.html. I'm not sure if there's an easy way to configure this in Python, though.

@jasper9
Copy link

jasper9 commented May 18, 2018

+1 for this

@hampsterx
Copy link
Contributor

hampsterx commented Mar 28, 2019

https://swagger.io/docs/open-source-tools/swagger-ui/usage/configuration/

this is an option as I don't think templating index.html is suitable.

configUrl: 'swagger-config',

then have a route for it in swagger.py

@blueprint.route('/swagger-config')
@doc_route(exclude=True)
def config(request):

    options = {}

    if hasattr(request.app.config, 'API_VALIDATOR_URL'):
        options['validatorUrl'] = getattr(request.app.config, 'API_VALIDATOR_URL')

    return json(options)

@ahopkins @DirkGuijt I can do a PR for this if happy with this approach. I am in need of this solution also as many of our APIs are internal.

@LTMenezes
Copy link
Contributor

+1 for this.

I think a quick solution to this issue would be to add another option in the "app.config" in order to make the validator URL customizable. This way we would enable sanic-openapi users to disable the validation or to provide a custom validator URL.

What do you guys think about this approach? I would be happy to submit a PR for this.
@hampsterx @chenjr0719

@hampsterx
Copy link
Contributor

@LTMenezes go for it~

@chenjr0719
Copy link
Member

@LTMenezes Sounds good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants