{"action":"created","issue":{"url":"https://api.github.com/repos/pipermerriam/flex/issues/66","labels_url":"https://api.github.com/repos/pipermerriam/flex/issues/66/labels{/name}","comments_url":"https://api.github.com/repos/pipermerriam/flex/issues/66/comments","events_url":"https://api.github.com/repos/pipermerriam/flex/issues/66/events","html_url":"https://github.com/pipermerriam/flex/issues/66","id":65202112,"number":66,"title":"Flex doesn't find referenced definitions","user":{"login":"EBichel","id":5231763,"avatar_url":"https://avatars.githubusercontent.com/u/5231763?v=3","gravatar_id":"","url":"https://api.github.com/users/EBichel","html_url":"https://github.com/EBichel","followers_url":"https://api.github.com/users/EBichel/followers","following_url":"https://api.github.com/users/EBichel/following{/other_user}","gists_url":"https://api.github.com/users/EBichel/gists{/gist_id}","starred_url":"https://api.github.com/users/EBichel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EBichel/subscriptions","organizations_url":"https://api.github.com/users/EBichel/orgs","repos_url":"https://api.github.com/users/EBichel/repos","events_url":"https://api.github.com/users/EBichel/events{/privacy}","received_events_url":"https://api.github.com/users/EBichel/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-03-30T12:37:50Z","updated_at":"2015-03-30T13:24:02Z","closed_at":null,"body":"I am encountering a reference bug with flex (3.5.0).. It doesn't find referenced types in \"#/definitions\".. A sample:\r\n\r\n```json\r\n {\r\n  \"swagger\" : \"2.0\",\r\n  \"info\" : {\r\n    \"version\" : \"1.0\",\r\n    \"title\" : \"Sample Rest API\"\r\n  },\r\n  \"basePath\" : \"/\",\r\n  \"schemes\" : [ \"http\" ],\r\n  \"consumes\" : [ \"application/json\" ],\r\n  \"produces\" : [ \"application/json\" ],\r\n  \"paths\" : {\r\n    \"/status\" : {\r\n      \"post\" : {\r\n        \"parameters\" : [ {\r\n\t\t\t\t\t\t\"in\":\"body\",\r\n\t\t\t\t\t\t\"name\": \"token\",\r\n\t\t\t\t\t\t\"schema\" : {\"$ref\" : \"#/definitions/TokenObj\"}\r\n          }\r\n         ],\r\n        \"responses\" : {\r\n          \"200\" : {\r\n            \"description\" : \"retrieves the status\"\r\n          }\r\n        }\r\n      }\r\n    }\r\n  },\r\n  \"definitions\" : {\r\n    \"TokenObj\" : {\r\n      \"required\" : [ \"magic\", \"timestamp\" ],\r\n      \"properties\" : {\r\n        \"magic\" : {\r\n          \"type\" : \"string\"\r\n        },\r\n        \"timestamp\" : {\r\n          \"type\" : \"string\"\r\n        }\r\n      },\r\n      \"type\" : \"object\"\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nI receive the following output:\r\n```\r\nValidationError: 'paths':\r\n    - u'/status':\r\n        - 'post':\r\n            - 'parameters':\r\n                - 'schema':\r\n                    - '$ref':\r\n                        - u'Unknown definition reference `#/definitions/TokenObj`'\r\n```\r\n\r\nThis is only the simplest sample I could produce. References to #/parameters are working, but anything referencing items in #/definitions seems to be failing."},"comment":{"url":"https://api.github.com/repos/pipermerriam/flex/issues/comments/87677205","html_url":"https://github.com/pipermerriam/flex/issues/66#issuecomment-87677205","issue_url":"https://api.github.com/repos/pipermerriam/flex/issues/66","id":87677205,"user":{"login":"EBichel","id":5231763,"avatar_url":"https://avatars.githubusercontent.com/u/5231763?v=3","gravatar_id":"","url":"https://api.github.com/users/EBichel","html_url":"https://github.com/EBichel","followers_url":"https://api.github.com/users/EBichel/followers","following_url":"https://api.github.com/users/EBichel/following{/other_user}","gists_url":"https://api.github.com/users/EBichel/gists{/gist_id}","starred_url":"https://api.github.com/users/EBichel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EBichel/subscriptions","organizations_url":"https://api.github.com/users/EBichel/orgs","repos_url":"https://api.github.com/users/EBichel/repos","events_url":"https://api.github.com/users/EBichel/events{/privacy}","received_events_url":"https://api.github.com/users/EBichel/received_events","type":"User","site_admin":false},"created_at":"2015-03-30T13:24:02Z","updated_at":"2015-03-30T13:24:02Z","body":"This solves the problem of loading it with flex, but causes errors in the \"official\" swagger editor and other swagger-parser related things. I am not sure, if this is a reliable and \"portable\" solution of the problem. I also created a second version with a problem of referencen to `#/parameters` which also fails\r\n\r\n```json\r\n{\r\n\t\"swagger\": \"2.0\",\r\n\t\"info\": {\r\n\t\t\"title\": \t\"Sample Rest API\",\r\n\t\t\"version\":\t\"1.0\"\r\n\t},\r\n\t\"basePath\": \"/\",\r\n\t\"schemes\": \t[\"http\"],\r\n\t\"consumes\": [\"application/json\"],\r\n\t\"produces\": [\"application/json\"],\r\n\t\"paths\" : {\r\n\t\t\"/status\" : {\r\n\t\t\t\"post\" : {\r\n\t\t\t\t\"parameters\" : [{\r\n\t\t\t\t\t\t\"name\" : \"token\",\r\n\t\t\t\t\t\t\"in\" : \"body\",\r\n\t\t\t\t\t\t\"schema\": {\r\n\t\t\t\t\t\t\t\"$ref\": \"#/parameters/tokenParameter\"\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t],\r\n\t\t\t\t\"responses\" : {\r\n\t\t\t\t\t\"200\" : {\r\n\t\t\t\t\t\t\"description\" : \"retrieves the status\"\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\t\"parameters\": {\r\n\t\t\"tokenParameter\": {\r\n\t\t\t\"in\": \"body\",\r\n\t\t\t\"name\": \"token\",\r\n\t\t\t\"schema\": { \"$ref\": \"#/definitions/TokenObj\" }\r\n\t\t}\t\r\n\t},\r\n\t\"definitions\": {\r\n\t\t\"TokenObj\" : {\r\n\t\t\t\"type\": \"object\",\r\n\t\t\t\"required\": [\"magic\", \"timestamp\"],\r\n\t\t\t\"properties\": {\r\n\t\t\t\t\t\"magic\" : {\r\n\t\t\t\t\t\t\"type\": \"string\"\r\n\t\t\t\t\t},\r\n\t\t\t\t\t\"timestamp\": {\r\n\t\t\t\t\t\t\"type\": \"string\"\r\n\t\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n```\r\nThe suggested solution by you isn't applicable in this case.\r\nAs a further problem, flex insists that as a parameter a simple reference is not enough. There have to be at least a `name` and `in`. However, the swagger spec schema specifies this case of only a schema reference like this: \r\n```json\r\n\t\t\"parameters\" : [{\r\n\t\t\t\t\t\t\t\t\t\t\"$ref\": \"#/parameters/tokenParameter\"\r\n\t\t\t}\r\n\t\t]\r\n```\r\n\r\nMy examplse are valid in the editor. I know that the editor does have its flaws, because sometimes it isn't parsing this strictly enough. However, in my opinion it seems to be a problem with flex, because I also want to use my API specification in other tools."}}