cwacek / python-jsonschema-objects

Automatic Python binding generation from JSON Schemas

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error in Literal dispatch_to_value when attribute set method is called

bdanofsky opened this issue · comments

Describe the bug
using a bar schema / no schema if one adds a Key:value pair where the value is a python dict()
any call to set an attribute of the dict fails.
This is due to the fact that the wrapper method used takes only one argument.
to fix this the wrapper needs to change to take *args

Example Schema and code
def dispatch_to_value(fn):
def wrapper(self, *args):
return fn(self._value, *args)
return wrapper

to use just do the standard thing to setup

myvar.foo = {"key": "abbc"}
myvar.foo['bar'] = 123

A schema and code that shows the incorrect behavior
{
"type": "object",
"additionalProperties": true
}

Expected behavior
you should be able to get/set any attribute within the dictionary