Skip to content

Coerce not recursive #31

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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