lib/schema-util.js
function recursivelyChangeAllAdditionalProperties(schema, newvalue) {
  if (!schema) return;
  // First set additionalProperties if it's here:
  if (typeof schema.additionalProperties !== 'undefined') {
    schema.additionalProperties = newvalue;
  }
  // Then check any child properties for the same:
  _.each(_.keys(schema.properties), function(child_schema) {
    recursivelyChangeAllAdditionalProperties(child_schema, newvalue);
  });
  // Then check any child patternProperties for the same:
  _.each(_.keys(schema.patternProperties), function(child_schema) {
    recursivelyChangeAllAdditionalProperties(child_schema, newvalue);
  });
  // Then check for anyOf, allOf, oneOf
  _.each(schema.anyOf, function(child_schema) {
    recursivelyChangeAllAdditionalProperties(child_schema, newvalue);
  });
  _.each(schema.allOf, function(child_schema) {
    recursivelyChangeAllAdditionalProperties(child_schema, newvalue);
  });
  _.each(schema.oneOf, function(child_schema) {
    recursivelyChangeAllAdditionalProperties(child_schema, newvalue);
  });
  // ignoring 'not' for now
}
function recursivelyChangeAllAdditionalProperties(schema, newvalue) {
  if (!schema) return;
  // First set additionalProperties if it's here:
  if (typeof schema.additionalProperties !== 'undefined') {
    schema.additionalProperties = newvalue;
  }
  // Then check any child properties for the same:
  _.each(_.keys(schema.properties), function(child_schema) {
    recursivelyChangeAllAdditionalProperties(child_schema, newvalue);
  });
  // Then check any child patternProperties for the same:
  _.each(_.keys(schema.patternProperties), function(child_schema) {
    recursivelyChangeAllAdditionalProperties(child_schema, newvalue);
  });
  // Then check for anyOf, allOf, oneOf
  _.each(schema.anyOf, function(child_schema) {
    recursivelyChangeAllAdditionalProperties(child_schema, newvalue);
  });
  _.each(schema.allOf, function(child_schema) {
    recursivelyChangeAllAdditionalProperties(child_schema, newvalue);
  });
  _.each(schema.oneOf, function(child_schema) {
    recursivelyChangeAllAdditionalProperties(child_schema, newvalue);
  });
  // ignoring 'not' for now
}
function recursivelyChangeAllAdditionalProperties ( schema , newvalue ) { if ( ! schema ) return ; // First set additionalProperties if it's here: if ( typeof schema . additionalProperties !== 'undefined' ) { schema . additionalProperties = newvalue ; } // Then check any child properties for the same: _ . each ( _ . keys ( schema . properties ) , function ( child_schema ) { recursivelyChangeAllAdditionalProperties ( child_schema , newvalue ) ; } ) ; // Then check any child patternProperties for the same: _ . each ( _ . keys ( schema . patternProperties ) , function ( child_schema ) { recursivelyChangeAllAdditionalProperties ( child_schema , newvalue ) ; } ) ; // Then check for anyOf, allOf, oneOf _ . each ( schema . anyOf , function ( child_schema ) { recursivelyChangeAllAdditionalProperties ( child_schema , newvalue ) ; } ) ; _ . each ( schema . allOf , function ( child_schema ) { recursivelyChangeAllAdditionalProperties ( child_schema , newvalue ) ; } ) ; _ . each ( schema . oneOf , function ( child_schema ) { recursivelyChangeAllAdditionalProperties ( child_schema , newvalue ) ; } ) ; // ignoring 'not' for now }
recursivelyChangeAllAdditionalProperties is used when "strict" mode is turned on to set all the additionalProperties variables to false.  Use only for developer testing to ensure you didn't mispell things because that is not the true definition of these schemas. Note this mutates the schema passed.
recursivelyChangeAllAdditionalProperties is used when strict mode is turned on to set all the additionalProperties variables to false . Use only for developer testing to ensure you didn t mispell things because that is not the true definition of these schemas . Note this mutates the schema passed .