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

Required Objects Without Properties Dont Validate Against Empty Objects #58

Open
pixelshaded opened this issue Jun 28, 2013 · 1 comment
Assignees

Comments

@pixelshaded
Copy link

var messageSchema = {
    type: 'object',
    properties: {
        Action: {
            required: true,
            type: 'string'
        },
        Data: {
            required: true,
            type: 'object',
        }
    }
};

if I validate against

{
        Action: "GetAllPools",
        Data: {  }
}

I will get an error message saying that Data is required. I have not required any properties be on Data however with my schema. If I add a random property to Data it will validate against the schema.

@ghost ghost assigned Baggz Jul 7, 2013
@Baggz
Copy link
Owner

Baggz commented Jul 7, 2013

I will get an error message saying that Data is required. I have not required any properties be on Data however with my schema. If I add a random property to Data it will validate against the schema.

@pixelshaded Actually, Amanda takes an empty object as a falsy value, that's why it throws an error. There's no prescribed behaviour for the required validator (http://json-schema.org/latest/json-schema-validation.html#anchor61).

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

2 participants