{"action":"created","issue":{"url":"https://api.github.com/repos/swagger-api/swagger-core/issues/1048","labels_url":"https://api.github.com/repos/swagger-api/swagger-core/issues/1048/labels{/name}","comments_url":"https://api.github.com/repos/swagger-api/swagger-core/issues/1048/comments","events_url":"https://api.github.com/repos/swagger-api/swagger-core/issues/1048/events","html_url":"https://github.com/swagger-api/swagger-core/issues/1048","id":74267716,"number":1048,"title":"Please implement equals(), toString(), hashCode() in Swagger models","user":{"login":"RobWin","id":5815046,"avatar_url":"https://avatars.githubusercontent.com/u/5815046?v=3","gravatar_id":"","url":"https://api.github.com/users/RobWin","html_url":"https://github.com/RobWin","followers_url":"https://api.github.com/users/RobWin/followers","following_url":"https://api.github.com/users/RobWin/following{/other_user}","gists_url":"https://api.github.com/users/RobWin/gists{/gist_id}","starred_url":"https://api.github.com/users/RobWin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RobWin/subscriptions","organizations_url":"https://api.github.com/users/RobWin/orgs","repos_url":"https://api.github.com/users/RobWin/repos","events_url":"https://api.github.com/users/RobWin/events{/privacy}","received_events_url":"https://api.github.com/users/RobWin/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/swagger-api/swagger-core/labels/Feature","name":"Feature","color":"009800"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-05-08T07:38:37Z","updated_at":"2015-05-20T00:15:53Z","closed_at":null,"body":"Hello,\r\n\r\nplease implement equals(), toString(), hashCode() in Swagger models.\r\n\r\nI implement a [assertj-swagger] (https://github.com/RobWin/assertj-swagger) library which compares a design-first Swagger YAML with an implementation-first Swagger JSON output of [springfox] (https://github.com/springfox/springfox). It allows to validate if the implementation fits the design specification.\r\n\r\n```\r\nSwaggerAssertions.assertThat(implFirstSwagger).isEqualTo(designFirstSwagger);\r\n```\r\n\r\nBut it is difficult to compare Swagger models without equals() and the output of assertions without toString() is not meaningful.\r\n\r\nThe following example is fine:\r\n\r\n```\r\nThe following 2 assertions failed:\r\n1) [Checking 'produces' of 'GET' operation of path '/pets/findByTags'] \r\nExpecting:\r\n  <[\"application/json\"]>\r\nto contain only:\r\n  <[\"application/json\", \"application/xml\"]>\r\nbut could not find the following elements:\r\n  <[\"application/xml\"]>\r\n```\r\n\r\nIn the following example a toString() for Parameters would have been quite useful:\r\n\r\n```\r\n2) [Checking 'parameters' of 'GET' operation of path '/users/login'] \r\nExpecting:\r\n  <[com.wordnik.swagger.models.parameters.QueryParameter@1f2586d6, com.wordnik.swagger.models.parameters.QueryParameter@10683d9d, com.wordnik.swagger.models.parameters.QueryParameter@3fc2959f]>\r\nto contain only:\r\n  <[com.wordnik.swagger.models.parameters.QueryParameter@5aa9e4eb, com.wordnik.swagger.models.parameters.QueryParameter@6989da5e]>\r\nelements not found:\r\n  <[com.wordnik.swagger.models.parameters.QueryParameter@5aa9e4eb, com.wordnik.swagger.models.parameters.QueryParameter@6989da5e]>\r\nand elements not expected:\r\n  <[com.wordnik.swagger.models.parameters.QueryParameter@1f2586d6, com.wordnik.swagger.models.parameters.QueryParameter@10683d9d, com.wordnik.swagger.models.parameters.QueryParameter@3fc2959f]>\r\nwhen comparing values using 'field by field comparator on fields [\"in\", \"name\", \"required\"]'\r\n```\r\n\r\n\r\nKind regards,\r\n\r\nRobert Winkler\r\n"},"comment":{"url":"https://api.github.com/repos/swagger-api/swagger-core/issues/comments/103702977","html_url":"https://github.com/swagger-api/swagger-core/issues/1048#issuecomment-103702977","issue_url":"https://api.github.com/repos/swagger-api/swagger-core/issues/1048","id":103702977,"user":{"login":"fehguy","id":249413,"avatar_url":"https://avatars.githubusercontent.com/u/249413?v=3","gravatar_id":"","url":"https://api.github.com/users/fehguy","html_url":"https://github.com/fehguy","followers_url":"https://api.github.com/users/fehguy/followers","following_url":"https://api.github.com/users/fehguy/following{/other_user}","gists_url":"https://api.github.com/users/fehguy/gists{/gist_id}","starred_url":"https://api.github.com/users/fehguy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fehguy/subscriptions","organizations_url":"https://api.github.com/users/fehguy/orgs","repos_url":"https://api.github.com/users/fehguy/repos","events_url":"https://api.github.com/users/fehguy/events{/privacy}","received_events_url":"https://api.github.com/users/fehguy/received_events","type":"User","site_admin":false},"created_at":"2015-05-20T00:15:53Z","updated_at":"2015-05-20T00:15:53Z","body":"Someone want to fire up their IDE to implement these and send a PR?"}}