{"action":"created","issue":{"url":"https://api.github.com/repos/Yelp/bravado-core/issues/251","repository_url":"https://api.github.com/repos/Yelp/bravado-core","labels_url":"https://api.github.com/repos/Yelp/bravado-core/issues/251/labels{/name}","comments_url":"https://api.github.com/repos/Yelp/bravado-core/issues/251/comments","events_url":"https://api.github.com/repos/Yelp/bravado-core/issues/251/events","html_url":"https://github.com/Yelp/bravado-core/issues/251","id":297350994,"number":251,"title":"Validation passes with properties not presented in a definition","user":{"login":"rredkovich","id":1866409,"avatar_url":"https://avatars0.githubusercontent.com/u/1866409?v=4","gravatar_id":"","url":"https://api.github.com/users/rredkovich","html_url":"https://github.com/rredkovich","followers_url":"https://api.github.com/users/rredkovich/followers","following_url":"https://api.github.com/users/rredkovich/following{/other_user}","gists_url":"https://api.github.com/users/rredkovich/gists{/gist_id}","starred_url":"https://api.github.com/users/rredkovich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rredkovich/subscriptions","organizations_url":"https://api.github.com/users/rredkovich/orgs","repos_url":"https://api.github.com/users/rredkovich/repos","events_url":"https://api.github.com/users/rredkovich/events{/privacy}","received_events_url":"https://api.github.com/users/rredkovich/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-02-15T07:27:02Z","updated_at":"2018-02-15T11:44:23Z","closed_at":"2018-02-15T09:07:14Z","author_association":"NONE","body":"Pretty sure that I just missed the option, however read the docs, checked out code, issues and still cannot figure out how to config validation to fail on dict with keys not presented in schema.\r\n\r\nCould you please point to my error?\r\n\r\nExample:\r\n```python\r\nfrom bravado_core.spec import Spec\r\nfrom bravado_core.validate import validate_object\r\nfrom jsonschema.exceptions import ValidationError\r\n\r\nschema = {\r\n  \"swagger\": \"2.0\",\r\n  \"host\": \"localhost:8000\",\r\n  \"basePath\": \"/v1\",\r\n  \"tags\": [\r\n    {\r\n      \"name\": \"user\",\r\n      \"description\": \"Users managment\",\r\n      \"externalDocs\": {\r\n        \"description\": \"Find out more\",\r\n        \"url\": \"https://server-documentation-fake-path\"\r\n      }\r\n    }\r\n  ],\r\n  \"schemes\": [\r\n    \"http\"\r\n  ],\r\n  \"paths\": {\r\n    \"/users\": {\r\n      \"post\": {\r\n        \"tags\": [\r\n          \"user\"\r\n        ],\r\n        \"summary\": \"Adds a new user\",\r\n        \"description\": \"\",\r\n        \"operationId\": \"addUser\",\r\n        \"consumes\": [\r\n          \"application/json\"\r\n        ],\r\n        \"produces\": [\r\n          \"application/json\"\r\n        ],\r\n        \"parameters\": [\r\n          {\r\n            \"in\": \"body\",\r\n            \"name\": \"body\",\r\n            \"description\": \"User data\",\r\n            \"required\": True,\r\n            \"schema\": {\r\n              \"$ref\": \"#/definitions/User\"\r\n            }\r\n          }\r\n        ],\r\n        \"responses\": {\r\n          \"200\": {\r\n            \"description\": \"successful operation\",\r\n            \"schema\": {\r\n              \"type\": \"object\",\r\n              \"items\": {\r\n                \"$ref\": \"#/definitions/User\"\r\n              }\r\n            }\r\n          }\r\n        }\r\n      }\r\n    }\r\n  },\r\n  \"definitions\": {\r\n    \"User\": {\r\n      \"type\": \"object\",\r\n      \"properties\": {\r\n        \"first_name\": {\r\n          \"type\": \"string\",\r\n          \"example\": \"John\"\r\n        },\r\n        \"last_name\": {\r\n          \"type\": \"string\",\r\n          \"example\": \"Doe\"\r\n        }\r\n      },\r\n      \"required\": [\r\n        \"first_name\",\r\n        \"last_name\"\r\n      ]\r\n    }\r\n  }\r\n}\r\n\r\nbravado_config = {\r\n    'validate_swagger_spec': False,\r\n    'validate_requests': False,\r\n    'validate_responses': False,\r\n    'include_missing_properties': False,\r\n    'internally_dereference_refs': False,\r\n    'use_models': True\r\n}\r\n\r\nUser = schema['definitions']['User']\r\nspec = Spec.from_dict(schema, config=bravado_config)\r\n\r\nuser_data = {'first_name': 'foo'}\r\nvalidate_object(spec, User, user_data)\r\n>>> jsonschema.exceptions.ValidationError: 'last_name' is a required property\r\n\r\nuser_data = {'first_name': 'foo', 'last_name': 'bar', 'unexpected': 'is ok'}\r\nvalidate_object(spec, User, user_data)\r\n>>> no complains\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/Yelp/bravado-core/issues/comments/365903373","html_url":"https://github.com/Yelp/bravado-core/issues/251#issuecomment-365903373","issue_url":"https://api.github.com/repos/Yelp/bravado-core/issues/251","id":365903373,"user":{"login":"rredkovich","id":1866409,"avatar_url":"https://avatars0.githubusercontent.com/u/1866409?v=4","gravatar_id":"","url":"https://api.github.com/users/rredkovich","html_url":"https://github.com/rredkovich","followers_url":"https://api.github.com/users/rredkovich/followers","following_url":"https://api.github.com/users/rredkovich/following{/other_user}","gists_url":"https://api.github.com/users/rredkovich/gists{/gist_id}","starred_url":"https://api.github.com/users/rredkovich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rredkovich/subscriptions","organizations_url":"https://api.github.com/users/rredkovich/orgs","repos_url":"https://api.github.com/users/rredkovich/repos","events_url":"https://api.github.com/users/rredkovich/events{/privacy}","received_events_url":"https://api.github.com/users/rredkovich/received_events","type":"User","site_admin":false},"created_at":"2018-02-15T11:44:22Z","updated_at":"2018-02-15T11:44:22Z","author_association":"NONE","body":"@macisamuele thank yor very much for such detailed explanation!"}}
{"actor":{"display_login":"rredkovich"}}