Skip to content

Coerce not recursive #31

@oniramarf

Description

@oniramarf

Hi, I am having an issue while using the coerce functionality.
I'm using the coerce functionality in order to add properties to my JSON object according to schema. The issue I've found is that if the object has several layers of properties, only the first is filled with missing properties.
For instance, if this is my schema:

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "type": "object",
    "properties": {
        "foo": {
            "type": "object",
            "properties": {
                "foobar": {"type": "numeric"}
            },
            "required": ["foobar"]
        },
        "bar": { "type": "object" }
    },
    "required": ["foo", "bar"]
}

and the JSON to coerce is:

{"bar": {"name":"John"}}

the result is

{"bar": {"name":"John"}, "foo": {}}

while I expected that foo would have been

{"bar": {"name":"John"}, "foo": {"foobar": 0}}

Could you please help me with this issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions