Skip to content

Swagger auto generate the OPTIONS method #111

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

Closed
ruathudo opened this issue Jul 19, 2018 · 5 comments · Fixed by #123
Closed

Swagger auto generate the OPTIONS method #111

ruathudo opened this issue Jul 19, 2018 · 5 comments · Fixed by #123

Comments

@ruathudo
Copy link

ruathudo commented Jul 19, 2018

Is it normal or an issue when swagger auto creating OPTIONS method when using with others methods (GET, POST...)?
How to ignore the options method? Thanks

image

@blagasz
Copy link

blagasz commented Jul 19, 2018

It is actually a Flask feature described here: http://flask.pocoo.org/docs/1.0/api/#view-function-options

@blagasz
Copy link

blagasz commented Jul 19, 2018

Sorry I've seen your quickfix just now...

@ruathudo
Copy link
Author

I created a pull request for this here. If someone can merge it.
#112

@janhui
Copy link

janhui commented Jan 25, 2019

I also would like this feature where I can stop showing the options endpoint if I don't want to. There are 2 pull request open to deal with this issue, it would be good to get a pointer on which direction we want to go with and get the pr merged into master. @jmcarp @sloria

@guidiego
Copy link

guidiego commented Jul 4, 2019

You could make a workaround using FlaskApiSpec instance :) On my application, I allocate the instance inside app.__docs__

for key, value in app.__docs__.spec._paths.items():
        app.__docs__.spec._paths[key] = {
            inner_key: inner_value
            for inner_key, inner_value in value.items()
            if inner_key != 'options'
        }

This should remove all options from ur API without killing the CORS functionality of your app :)

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

Successfully merging a pull request may close this issue.

4 participants