{"action":"opened","issue":{"url":"https://api.github.com/repos/zircote/swagger-php/issues/202","labels_url":"https://api.github.com/repos/zircote/swagger-php/issues/202/labels{/name}","comments_url":"https://api.github.com/repos/zircote/swagger-php/issues/202/comments","events_url":"https://api.github.com/repos/zircote/swagger-php/issues/202/events","html_url":"https://github.com/zircote/swagger-php/issues/202","id":64734911,"number":202,"title":"[Swagger 2.0] A few issues with the generated definitions","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},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-03-27T10:27:26Z","updated_at":"2015-03-27T10:27:26Z","closed_at":null,"body":"Hello,\r\n\r\n@marcinskubala opened an issue on swagger-ui - https://github.com/swagger-api/swagger-ui/issues/1055 - related to an issue we have, and shared his Swagger definition that was generated by the new version of swagger-php. I assume it's redacted, but I believe the general structure is coming from swagger-php. This is the shared definition:\r\n\r\n```json\r\n{\r\n    \"swagger\": \"2.0\",\r\n    \"info\": {\r\n        \"title\": \"XXX\",\r\n        \"version\": \"XXX\"\r\n    },\r\n    \"host\": \"XXX\",\r\n    \"basePath\": \"XXX\",\r\n    \"schemes\": [\r\n        \"http\"\r\n    ],\r\n    \"consumes\": [\r\n        \"application\\/x-www-form-urlencoded\"\r\n    ],\r\n    \"produces\": [\r\n        \"application\\/json\",\r\n        \"application\\/xml\"\r\n    ],\r\n    \"paths\": {\r\n        \"\\/media\": {\r\n            \"post\": {\r\n                \"tags\": [\r\n                    \"Media Operations\"\r\n                ],\r\n                \"summary\": \"Create a new media\",\r\n                \"parameters\": [\r\n                    {\r\n                        \"name\": \"title\",\r\n                        \"in\": \"formData\",\r\n                        \"description\": \"Media title\",\r\n                        \"required\": false,\r\n                        \"type\": \"string\"\r\n                    }\r\n                ],\r\n                \"responses\": {\r\n                    \"200\": {\r\n                        \"description\": \"Media Response\",\r\n                        \"schema\": {\r\n                            \"$ref\": \"#\\/definitions\\/Media\"\r\n                        }\r\n                    },\r\n                    \"Default\": {\r\n                        \"description\": \"Default Error\",\r\n                        \"schema\": {\r\n                            \"$ref\": \"#\\/definitions\\/Error\"\r\n                        }\r\n                    },\r\n                    \"422\": {\r\n                        \"description\": \"Validation Error\",\r\n                        \"schema\": {\r\n\t\t\t\t\t\t\t\"type\": \"array\",\r\n\t\t\t\t\t\t\t\"items\": {\r\n\t\t\t\t\t\t\t\t\"$ref\": \"#\\/definitions\\/ValidationError\"\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n                    }\r\n                }\r\n            }\r\n        }\r\n    },\r\n    \"definitions\": {\r\n\t\t\"Media\": {\r\n            \"required\": [\r\n\t\t\t\t\"id\"\r\n            ],\r\n            \"properties\": {\r\n                \"id\": {\r\n                    \"type\": \"integer\"\r\n                },\r\n                \"title\": {\r\n                    \"type\": \"string\"\r\n                }\r\n            }\r\n        },\r\n        \"Error\": {\r\n            \"required\": [\r\n                \"code\"\r\n            ],\r\n            \"properties\": {\r\n                \"code\": {\r\n                    \"type\": \"integer\"\r\n                }\r\n            }\r\n        },\r\n        \"ValidationError\": {\r\n            \"required\": [\r\n                \"field\"\r\n            ],\r\n            \"properties\": {\r\n                \"field\": {\r\n                    \"type\": \"string\"\r\n                }\r\n            }\r\n        }\r\n    }\r\n}\r\n```\r\n\r\nThe definition above has three issues I can point out. I'm not sure whether these are generated errors or user errors, but I wanted to bring them to your attention.\r\n\r\n- Strings seem to be unnecessarily \"escaped\". For example, `\"application\\/json\"` vs `\"application/json\"`, `\"\\/media\"` vs `\"/media\"` and `\"\"#\\/definitions\\/ValidationError\"` vs `\"#/definitions/ValidationError\"`. While parsing of these works fine, it makes it difficult to read and really doesn't add anything.\r\n\r\n- The `default` response should be spelled like that instead of `Default` (case matters).\r\n\r\n- Definitions of models should be accompanied with `\"type\": \"object\"`, so the `Error` model above would be:\r\n\r\n```json\r\n       \"Error\": {\r\n            \"type\": \"object\",\r\n            \"required\": [\r\n                \"code\"\r\n            ],\r\n            \"properties\": {\r\n                \"code\": {\r\n                    \"type\": \"integer\"\r\n                }\r\n            }\r\n        }\r\n```"}}