GetDKAN / RootedJsonData

Access and modify JSON-based data objects while enforcing JSON Schema
GNU General Public License v3.0
1 stars 0 forks source link

Normalize set values when passing objects #9

Closed dafeder closed 3 years ago

dafeder commented 3 years ago

A strange behavior inherited from the JsonObeject class means that for an existing RootedJsonData object, setting a property by passing an object, in particular a stdClass resulting from json_decode will cause the full object to be stored at that level of the data structure. Validation still works but retrieving the value after setting it will return the same stdObeject, when we would expect any get() to retrieve an array.

By normalizing incoming objects we avoid this inconsistency. See the new testAddJsonData() for examples.