-
-
Notifications
You must be signed in to change notification settings - Fork 179
Core path does not support swagger basePath #78
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
Comments
After looking into the implementation, I realized that the A work around for #69 would have been to pass If anyone was using flask configured with It might be a good idea to roll back #70 and yank the releases. A better design would be to have the flask extension apply the In summary, |
Upon further investigation, |
I'm discovering this and I find it a bit strange that we add the Shouldn't we revert #70 already to not add it in the first place? I think that's what @deckar01 means in
I guess now would be a good time. Note that this is an apispec-webframeworks issue, rather than an apispec issue. Back to apispec, I'm not sure about |
Also if What about replacing it with this (untested) ? def normalize_path(path):
if path and 'basePath' in self.options:
path.lstrip(self.options['basePath'])
if not path.starstwith('/'):
path = '/' + path
return path |
Let's settle this before v1.0. |
Pinging @asteinlein, who worked on this. |
Removing I think we should do the Flask plugin change (undo #70) in apispec-webframeworks. And document the need for the user to specify the base path (how to do it differs between OpenAPI v2 and v3). Regarding I can only talk about Flask, but from my experience, the app doesn't know its base path until told via a parameter ( Ultimately, OpenAPI v3 breaks the whole thing by allowing multiple base paths... From there, I lean towards removing |
Discussed in marshmallow-code/apispec#78 It is the user's responsability to set the correct "basePath" in the spec. Blueprint.register_views_in_doc does not pass app to spec.add_path anymore.
Closing as changes in #78 (comment) were implemented. |
Related to #69.
Flask allows configuring the
APPLICATION_ROOT
, which provides the base path for the routes. #70 fixed this issue so that the flask extension reports the fully qualified path.When the specs are dumped as swagger specs using
to_dict()
, the full path is shown on every route, even though the swagger specification supports thebasePath
field on the root object.I think it is important to keep the meaningful portion of the route URL separate from the base path to maintain readable documentation. #70 was the right fix for the flask extension since the
apispec
core assumes paths are absolute, but the fact that bothflask
andswagger
support a configurable base path indicates that theapispec
core should probably internalize the concept of base paths and expose them to extensions.Examples of base path in similar libraries:
The text was updated successfully, but these errors were encountered: