{"action":"created","issue":{"url":"https://api.github.com/repos/nicolaiarocci/cerberus/issues/176","labels_url":"https://api.github.com/repos/nicolaiarocci/cerberus/issues/176/labels{/name}","comments_url":"https://api.github.com/repos/nicolaiarocci/cerberus/issues/176/comments","events_url":"https://api.github.com/repos/nicolaiarocci/cerberus/issues/176/events","html_url":"https://github.com/nicolaiarocci/cerberus/issues/176","id":118616299,"number":176,"title":"Recursion issue when using a recursive schema","user":{"login":"carlos-alberto","id":1853495,"avatar_url":"https://avatars.githubusercontent.com/u/1853495?v=3","gravatar_id":"","url":"https://api.github.com/users/carlos-alberto","html_url":"https://github.com/carlos-alberto","followers_url":"https://api.github.com/users/carlos-alberto/followers","following_url":"https://api.github.com/users/carlos-alberto/following{/other_user}","gists_url":"https://api.github.com/users/carlos-alberto/gists{/gist_id}","starred_url":"https://api.github.com/users/carlos-alberto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carlos-alberto/subscriptions","organizations_url":"https://api.github.com/users/carlos-alberto/orgs","repos_url":"https://api.github.com/users/carlos-alberto/repos","events_url":"https://api.github.com/users/carlos-alberto/events{/privacy}","received_events_url":"https://api.github.com/users/carlos-alberto/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-11-24T14:09:29Z","updated_at":"2015-11-24T15:10:13Z","closed_at":null,"body":"We are trying to upgrade to the master branch currently, however the functionality we were currently using to define a recursive schema appears to be broken on the latest release\r\n\r\n0.8\r\n===\r\n\r\n    In [1]: from cerberus import Validator\r\n\r\n    In [2]: schema = {'a': {'type': 'integer'}, 'b': {'keyschema': {'type': 'dict', 'schema': None}}}\r\n\r\n    In [3]: schema['b']['keyschema']['schema'] = schema\r\n\r\n    In [4]: data = {'a': 1, 'b': {'c': {'a': 10}, 'd': {'a': 10000}}}\r\n\r\n    In [5]: validator = Validator(schema)\r\n\r\n    In [6]: validator.validate(data)\r\n    Out[6]: True\r\n\r\nmaster\r\n======\r\n\r\n    In [1]: from cerberus import Validator\r\n\r\n    In [2]: schema = {'a': {'type': 'integer'}, 'b': {'valueschema': {'type': 'dict', 'schema': None}}}\r\n\r\n    In [3]: schema['b']['valueschema']['schema'] = schema\r\n\r\n    In [4]: validator = Validator(schema)\r\n    ...\r\n    .virtualenvs/connect/lib/python3.4/site-packages/cerberus/cerberus.py in update_to_valueschema(constraints)\r\n       1275                                          \"Use 'valueschema' instead.\")\r\n       1276         for key, value in constraints.items():\r\n    -> 1277             constraints[key] = update_to_valueschema(value)\r\n       1278         return constraints\r\n       1279\r\n\r\n    .virtualenvs/connect/lib/python3.4/site-packages/cerberus/cerberus.py in update_to_valueschema(constraints)\r\n       1275                                          \"Use 'valueschema' instead.\")\r\n       1276         for key, value in constraints.items():\r\n    -> 1277             constraints[key] = update_to_valueschema(value)\r\n       1278         return constraints\r\n       1279\r\n\r\n    .virtualenvs/connect/lib/python3.4/site-packages/cerberus/cerberus.py in update_to_valueschema(constraints)\r\n       1275                                          \"Use 'valueschema' instead.\")\r\n       1276         for key, value in constraints.items():\r\n    -> 1277             constraints[key] = update_to_valueschema(value)\r\n       1278         return constraints\r\n       1279\r\n\r\n    .virtualenvs/connect/lib/python3.4/site-packages/cerberus/cerberus.py in update_to_valueschema(constraints)\r\n       1275                                          \"Use 'valueschema' instead.\")\r\n       1276         for key, value in constraints.items():\r\n    -> 1277             constraints[key] = update_to_valueschema(value)\r\n       1278         return constraints\r\n       1279\r\n\r\n    .virtualenvs/connect/lib/python3.4/site-packages/cerberus/cerberus.py in update_to_valueschema(constraints)\r\n       1267     # TODO remove on next major release\r\n       1268     def update_to_valueschema(constraints):\r\n    -> 1269         if not isinstance(constraints, Mapping):\r\n       1270             return constraints\r\n       1271         if 'keyschema' in constraints:\r\n\r\n    .virtualenvs/connect/lib/python3.4/abc.py in __instancecheck__(cls, instance)\r\n        186             if (cls._abc_negative_cache_version ==\r\n        187                 ABCMeta._abc_invalidation_counter and\r\n    --> 188                 subclass in cls._abc_negative_cache):\r\n        189                 return False\r\n        190             # Fall back to the subclass check.\r\n\r\n    .virtualenvs/connect/lib/python3.4/_weakrefset.py in __contains__(self, item)\r\n         73         except TypeError:\r\n         74             return False\r\n    ---> 75         return wr in self.data\r\n         76\r\n         77     def __reduce__(self):\r\n\r\nIs this a known issue? Are recursive schemas something Cerberus intends to support?"},"comment":{"url":"https://api.github.com/repos/nicolaiarocci/cerberus/issues/comments/159296682","html_url":"https://github.com/nicolaiarocci/cerberus/issues/176#issuecomment-159296682","issue_url":"https://api.github.com/repos/nicolaiarocci/cerberus/issues/176","id":159296682,"user":{"login":"nicolaiarocci","id":512968,"avatar_url":"https://avatars.githubusercontent.com/u/512968?v=3","gravatar_id":"","url":"https://api.github.com/users/nicolaiarocci","html_url":"https://github.com/nicolaiarocci","followers_url":"https://api.github.com/users/nicolaiarocci/followers","following_url":"https://api.github.com/users/nicolaiarocci/following{/other_user}","gists_url":"https://api.github.com/users/nicolaiarocci/gists{/gist_id}","starred_url":"https://api.github.com/users/nicolaiarocci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicolaiarocci/subscriptions","organizations_url":"https://api.github.com/users/nicolaiarocci/orgs","repos_url":"https://api.github.com/users/nicolaiarocci/repos","events_url":"https://api.github.com/users/nicolaiarocci/events{/privacy}","received_events_url":"https://api.github.com/users/nicolaiarocci/received_events","type":"User","site_admin":false},"created_at":"2015-11-24T15:10:13Z","updated_at":"2015-11-24T15:10:13Z","body":"Good catch, this also happens with 0.9.x. You could workaround with: \r\n\r\n`schema['b']['keyschema']['schema'] = copy.deepcopy(schema)`"}}