Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coerce not recursive #31

Open
oniramarf opened this issue Dec 19, 2016 · 0 comments
Open

Coerce not recursive #31

oniramarf opened this issue Dec 19, 2016 · 0 comments

Comments

@oniramarf
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant