{"action":"created","issue":{"url":"https://api.github.com/repos/apigee-127/swagger-tools/issues/194","labels_url":"https://api.github.com/repos/apigee-127/swagger-tools/issues/194/labels{/name}","comments_url":"https://api.github.com/repos/apigee-127/swagger-tools/issues/194/comments","events_url":"https://api.github.com/repos/apigee-127/swagger-tools/issues/194/events","html_url":"https://github.com/apigee-127/swagger-tools/issues/194","id":68661229,"number":194,"title":"Path with query parses incorrectly in swagger-metadata.js","user":{"login":"AlenaSviridenko","id":8777209,"avatar_url":"https://avatars.githubusercontent.com/u/8777209?v=3","gravatar_id":"","url":"https://api.github.com/users/AlenaSviridenko","html_url":"https://github.com/AlenaSviridenko","followers_url":"https://api.github.com/users/AlenaSviridenko/followers","following_url":"https://api.github.com/users/AlenaSviridenko/following{/other_user}","gists_url":"https://api.github.com/users/AlenaSviridenko/gists{/gist_id}","starred_url":"https://api.github.com/users/AlenaSviridenko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlenaSviridenko/subscriptions","organizations_url":"https://api.github.com/users/AlenaSviridenko/orgs","repos_url":"https://api.github.com/users/AlenaSviridenko/repos","events_url":"https://api.github.com/users/AlenaSviridenko/events{/privacy}","received_events_url":"https://api.github.com/users/AlenaSviridenko/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-04-15T11:56:48Z","updated_at":"2015-04-17T05:03:21Z","closed_at":null,"body":"I have the following simple-swagger.json file:\r\n```\r\n{\r\n  \"swagger\": \"2.0\",\r\n  \"info\": {\r\n    \"title\": \"Microsoft Azure Redis Cache Management API\",\r\n    \"description\": \"Some cool documentation.\",\r\n    \"version\": \"2.0.1\"\r\n  },\r\n  \"host\": \"management.azure.com\",\r\n  \"schemes\": [\r\n    \"https\"\r\n  ],\r\n  \"basePath\": \"/\",\r\n  \"produces\": [ \"application/json\" ],\r\n  \"consumes\": [ \"application/json\" ],\r\n  \"paths\": {\r\n    \"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/Microsoft.Cache/Redis?api-version={apiVersion}\": {\r\n      \"get\": {\r\n... etc\r\n}\r\n```\r\nas you can notice, my path contains a query. It doesn't work correctly because of this string in swagger-metadata.js :\r\n```\r\n    var path = parseurl(req).pathname;\r\n```\r\n*parseurl(req).pathname* takes the path up to the first non-slash symbol. That's why I got 404 error.\r\nIn my opinion, there should be \r\n```\r\nreturn function swaggerMetadata (req, res, next) {\r\n    var method = req.method.toLowerCase();\r\n    var path = parseurl(req).href;\r\n    var cacheEntry;\r\n    var match;\r\n... etc\r\n```\r\n*parseurl(req).href* takes the whole request path. It works okay not only for query path, but also for non-query path."},"comment":{"url":"https://api.github.com/repos/apigee-127/swagger-tools/issues/comments/93893636","html_url":"https://github.com/apigee-127/swagger-tools/issues/194#issuecomment-93893636","issue_url":"https://api.github.com/repos/apigee-127/swagger-tools/issues/194","id":93893636,"user":{"login":"webron","id":241629,"avatar_url":"https://avatars.githubusercontent.com/u/241629?v=3","gravatar_id":"","url":"https://api.github.com/users/webron","html_url":"https://github.com/webron","followers_url":"https://api.github.com/users/webron/followers","following_url":"https://api.github.com/users/webron/following{/other_user}","gists_url":"https://api.github.com/users/webron/gists{/gist_id}","starred_url":"https://api.github.com/users/webron/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/webron/subscriptions","organizations_url":"https://api.github.com/users/webron/orgs","repos_url":"https://api.github.com/users/webron/repos","events_url":"https://api.github.com/users/webron/events{/privacy}","received_events_url":"https://api.github.com/users/webron/received_events","type":"User","site_admin":false},"created_at":"2015-04-17T05:03:21Z","updated_at":"2015-04-17T05:03:21Z","body":"@whitlockjc - You are correct, that is not valid.\r\n\r\n@mohsen1 - We're trying to make the schema validate the structure more than the content. We've had a long discussion, for example, whether we should apply a complex regex for mime types or not. Eventually, we decided to keep it simple. It's not that we don't use regex at all to limit user input, but we keep it as little as possible. That said, if you feel strongly about it, feel free to open an issue on swagger-spec so at least it's there for evaluation."}}