{"action":"created","issue":{"url":"https://api.github.com/repos/swagger-api/swagger-spec/issues/393","labels_url":"https://api.github.com/repos/swagger-api/swagger-spec/issues/393/labels{/name}","comments_url":"https://api.github.com/repos/swagger-api/swagger-spec/issues/393/comments","events_url":"https://api.github.com/repos/swagger-api/swagger-spec/issues/393/events","html_url":"https://github.com/swagger-api/swagger-spec/issues/393","id":87743147,"number":393,"title":"Algorithm to deduce 'basePath' from Swagger document location.","user":{"login":"IvanGoncharov","id":8336157,"avatar_url":"https://avatars.githubusercontent.com/u/8336157?v=3","gravatar_id":"","url":"https://api.github.com/users/IvanGoncharov","html_url":"https://github.com/IvanGoncharov","followers_url":"https://api.github.com/users/IvanGoncharov/followers","following_url":"https://api.github.com/users/IvanGoncharov/following{/other_user}","gists_url":"https://api.github.com/users/IvanGoncharov/gists{/gist_id}","starred_url":"https://api.github.com/users/IvanGoncharov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IvanGoncharov/subscriptions","organizations_url":"https://api.github.com/users/IvanGoncharov/orgs","repos_url":"https://api.github.com/users/IvanGoncharov/repos","events_url":"https://api.github.com/users/IvanGoncharov/events{/privacy}","received_events_url":"https://api.github.com/users/IvanGoncharov/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-06-12T14:16:25Z","updated_at":"2015-06-14T01:47:27Z","closed_at":null,"body":"In my scenario `host`, `schemes` and `basePath`.\r\nAccording to spec there are rules how to deduce `host` and `schemes`:\r\n>If the `host` is not included, the host serving the documentation is to be used (including the port).\r\n\r\n>If the `schemes` is not included, the default scheme to be used is the one used to access the Swagger definition itself.\r\n\r\nBut what to do with `basePath` is unclear, closes thing is:\r\n>If it is not included, the API is served directly under the `host`.\r\n\r\nWhich is not very suited for situation."},"comment":{"url":"https://api.github.com/repos/swagger-api/swagger-spec/issues/comments/111769534","html_url":"https://github.com/swagger-api/swagger-spec/issues/393#issuecomment-111769534","issue_url":"https://api.github.com/repos/swagger-api/swagger-spec/issues/393","id":111769534,"user":{"login":"IvanGoncharov","id":8336157,"avatar_url":"https://avatars.githubusercontent.com/u/8336157?v=3","gravatar_id":"","url":"https://api.github.com/users/IvanGoncharov","html_url":"https://github.com/IvanGoncharov","followers_url":"https://api.github.com/users/IvanGoncharov/followers","following_url":"https://api.github.com/users/IvanGoncharov/following{/other_user}","gists_url":"https://api.github.com/users/IvanGoncharov/gists{/gist_id}","starred_url":"https://api.github.com/users/IvanGoncharov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IvanGoncharov/subscriptions","organizations_url":"https://api.github.com/users/IvanGoncharov/orgs","repos_url":"https://api.github.com/users/IvanGoncharov/repos","events_url":"https://api.github.com/users/IvanGoncharov/events{/privacy}","received_events_url":"https://api.github.com/users/IvanGoncharov/received_events","type":"User","site_admin":false},"created_at":"2015-06-14T01:47:27Z","updated_at":"2015-06-14T01:47:27Z","body":"@mohsen1 Thanks for such detailed explanation.\r\nBut let's change your example a little bit.\r\nSwagger specification is server from `http://example.com/testing/swagger`\r\nAnd there is no `host`, `basePath` or `scheme`:\r\n```yaml\r\nswagger: '2.0'\r\ninfo:\r\n  version: 0.0.0\r\n  title: Simple API\r\npaths:\r\n  /foo:\r\n    get:\r\n      responses: \r\n        200:\r\n          description: OK\r\n```\r\nAccording to current spec:\r\n**GET `/foo` → GET `http://example.com/foo`**\r\nBut logically it should be:\r\n**GET `/foo` → GET `http://example.com/testing/foo`**\r\n\r\nSo 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**. \r\n\r\nI understand it's not in scope of `2.0` version.\r\nBut it could be solved in next version.\r\n\r\nMy solution to this, is to deduce `basePath` similarly to `host` and `schemes`:\r\n> If the `basePath` is not included, the path to be used is the one used to access the Swagger definition itself with file name being removed.\r\n\r\n During conversion from `2.0`, if `basePath` is missing, empty `basePath` should be added."}}