Required Objects #29

Closed
wants to merge 6 commits into
from

Conversation

Projects
None yet
3 participants

These changes should allow objects to fit a certain mold while being flexible.

Example Schema:

var schema = {
  type: 'object',
  properties: {
    user: {
      type: 'object',
      properties: {
        name: {
          required: true
        },
        surname: {
          required: true
        } } } } };

It doesn't require anything, but if it is there, it should be an object.
If it has a field of 'user', it should be an object.
If field 'user' exists, then 'name' and 'surname' are required to be present.

Currently, the 'user' field is not taken into account when looking at it's required subfields: 'name' and 'surname'. If 'user' is not present and not required, then I believe there is no need to check for it's sub fields.

Best,
Barret

DavidIAm commented Sep 6, 2012

This is totally needed. You can't be requiring the contents of optional schema bits.

Baggz closed this Dec 26, 2012

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