Closed bdanofsky closed 1 year ago
I strongly recommend not using setattr
directly on the objects here (unless you have a compelling usecase). Lots of work has been done to use setattr
and getattr
to make these behave like normal Python objects. All bets are off if you go through the looking glass and use those low level funcs for normal ops.
Describe the bug when additional properties are used and if setattr() is called on the attribute with an already built value. Instantiate fails to find the type.
Example Schema and code { "title": "noSchema" "type": "object", "additionalProperties": true }
Just use a bare schema with no values Then add two attributes: if abc is the built noSchema abc.foo = 123 abc.anotherFoo = 456 then call setattr(abc, 'foo', getattr(abc, 'anotherFoo'))
Expected behavior clearly abc.foo should be set to the value 456 instead when this is called ExtensbileValidator.instantiate is called and it fails with an IndexError