-
Notifications
You must be signed in to change notification settings - Fork 9.1k
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
Algorithm to deduce 'basePath' from Swagger document location. #393
Comments
When Imagine all following swagger specs are served from When there is no
|
@mohsen1 Thanks for such detailed explanation. swagger: '2.0'
info:
version: 0.0.0
title: Simple API
paths:
/foo:
get:
responses:
200:
description: OK According to current spec: So basically Swagger provide very good mechanism for deploying APIs without being tied to particular hostname. But at the same time it limits you with one API per host rule. I understand it's not in scope of My solution to this, is to deduce
During conversion from |
@mohsen1's description looks accurate. @IvanGoncharov - regarding the current version, I tend to disagree. We make no suggestions as to where the swagger definition should be hosted within the server, and whether it is hosted at the root, application context, or some other place entirely is beyond the scope. As such, unlike the scheme and host, we cannot assume the For a future version, I agree we can take it under consideration, but I can also see why some may not like it. |
I agree with the behavior @IvanGoncharov is suggesting. To reiterate, my API is used internal and external to our network with different paths. Here is how you would get to the same API from different ways. @webron , I understand what you are saying about being cautious to make this the default behavior. Perhaps this can be done: If the spec is configured with no basePath, it can assume '/'. and http://internalroute/swagger.json I would call this a relative basepath, and for my purposes I would think this should be the default, but it doesnt have to be. |
+1: we face the same problem as @IvanGoncharov and need a mechanism to specify the basePath relative to the location of the OpenAPI document. Using an empty string as "next to the document" would work fine for us as OData |
In my scenario
host
,schemes
andbasePath
.According to spec there are rules how to deduce
host
andschemes
:But what to do with
basePath
is unclear, closes thing is:Which is not very suited for situation.
The text was updated successfully, but these errors were encountered: