-
Notifications
You must be signed in to change notification settings - Fork 157
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
Blueprint and arg fixes #70
base: master
Are you sure you want to change the base?
Conversation
…_resources, allowing additional paths to be registered at runtime.
Thanks for these fixes @revmischa. I'm a little surprised anyone even found the I'll install this and give it a test soon with a few of the apps we have that use it. I think this might be the root of some subtle malformed swagger issues we've had. That being said, you seem more familiar with the internals of Example: """Doesn't work"""
docs = FlaskApiSpec(app)
app.register_blueprint(any_bp, url_prefix='/test')
"""Works"""
app.register_blueprint(any_bp, url_prefix='/test')
docs = FlaskApiSpec(app)
docs.register_existing_resources() |
I used metaclasses to auto-register my class-based views. It works nicely. I don't like having to call docs.register() for every function or class. It shouldn't be necessary. |
Codecov Report
@@ Coverage Diff @@
## master #70 +/- ##
==========================================
- Coverage 97.64% 97.21% -0.43%
==========================================
Files 8 8
Lines 339 323 -16
==========================================
- Hits 331 314 -17
- Misses 8 9 +1
Continue to review full report at Codecov.
|
Fixes three problems:
Don't auto-register ResourceMeta-based views that have multiple URLs registered with view_funcs. This allows the standard way of building resourceful APIs with flask MethodViews to work nicely. See http://flask.pocoo.org/docs/0.12/views/#method-views-for-apis
Uses the wrong endpoint name when splitting on blueprint name
When using a view as in 1), there may be multiple methods mapped to the same view_func, as in the common case of GET /foo and GET /foo/123. The param is incorrectly mapped to the first version because they are both GET methods on the same view func. This fixes that incorrect behavior. Before it would add the path param to the endpoint without any params.