function findArgChanges(oldSchema, newSchema) {
  var oldTypeMap = oldSchema.getTypeMap();
  var newTypeMap = newSchema.getTypeMap();

  var breakingChanges = [];
  var dangerousChanges = [];

  Object.keys(oldTypeMap).forEach(function (typeName) {
    var oldType = oldTypeMap[typeName];
    var newType = newTypeMap[typeName];
    if (!(oldType instanceof _definition.GraphQLObjectType || oldType instanceof _definition.GraphQLInterfaceType) || !(newType instanceof oldType.constructor)) {
      return;
    }

    var oldTypeFields = oldType.getFields();
    var newTypeFields = newType.getFields();

    Object.keys(oldTypeFields).forEach(function (fieldName) {
      if (!newTypeFields[fieldName]) {
        return;
      }

      oldTypeFields[fieldName].args.forEach(function (oldArgDef) {
        var newArgs = newTypeFields[fieldName].args;
        var newArgDef = newArgs.find(function (arg) {
          return arg.name === oldArgDef.name;
        });

        // Arg not present
        if (!newArgDef) {
          breakingChanges.push({
            type: BreakingChangeType.ARG_REMOVED,
            description: oldType.name + '.' + fieldName + ' arg ' + (oldArgDef.name + ' was removed')
          });
        } else {
          var isSafe = isChangeSafeForInputObjectFieldOrFieldArg(oldArgDef.type, newArgDef.type);
          if (!isSafe) {
            breakingChanges.push({
              type: BreakingChangeType.ARG_CHANGED_KIND,
              description: oldType.name + '.' + fieldName + ' arg ' + (oldArgDef.name + ' has changed type from ') + (oldArgDef.type.toString() + ' to ' + newArgDef.type.toString())
            });
          } else if (oldArgDef.defaultValue !== undefined && oldArgDef.defaultValue !== newArgDef.defaultValue) {
            dangerousChanges.push({
              type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE,
              description: oldType.name + '.' + fieldName + ' arg ' + (oldArgDef.name + ' has changed defaultValue')
            });
          }
        }
      });
      // Check if a non-null arg was added to the field
      newTypeFields[fieldName].args.forEach(function (newArgDef) {
        var oldArgs = oldTypeFields[fieldName].args;
        var oldArgDef = oldArgs.find(function (arg) {
          return arg.name === newArgDef.name;
        });
        if (!oldArgDef && newArgDef.type instanceof _definition.GraphQLNonNull) {
          breakingChanges.push({
            type: BreakingChangeType.NON_NULL_ARG_ADDED,
            description: 'A non-null arg ' + newArgDef.name + ' on ' + (newType.name + '.' + fieldName + ' was added')
          });
        }
      });
    });
  });

  return {
    breakingChanges: breakingChanges,
    dangerousChanges: dangerousChanges
  };
}
/**
 * Given two schemas, returns an Array containing descriptions of any
 * breaking or dangerous changes in the newSchema related to arguments
 * (such as removal or change of type of an argument, or a change in an
 * argument's default value).
 */
Given two schemas, returns an Array containing descriptions of any
breaking or dangerous changes in the newSchema related to arguments
(such as removal or change of type of an argument, or a change in an
argument's default value).
Given two schemas returns an Array containing descriptions of any breaking or dangerous changes in the newSchema related to arguments ( such as removal or change of type of an argument or a change in an argument ' s default value ) .
function findArgChanges(oldSchema, newSchema) {
  var oldTypeMap = oldSchema.getTypeMap();
  var newTypeMap = newSchema.getTypeMap();
  var breakingChanges = [];
  var dangerousChanges = [];
  Object.keys(oldTypeMap).forEach(function (typeName) {
    var oldType = oldTypeMap[typeName];
    var newType = newTypeMap[typeName];
    if (!(oldType instanceof _definition.GraphQLObjectType || oldType instanceof _definition.GraphQLInterfaceType) || !(newType instanceof oldType.constructor)) {
      return;
    }
    var oldTypeFields = oldType.getFields();
    var newTypeFields = newType.getFields();
    Object.keys(oldTypeFields).forEach(function (fieldName) {
      if (!newTypeFields[fieldName]) {
        return;
      }
      oldTypeFields[fieldName].args.forEach(function (oldArgDef) {
        var newArgs = newTypeFields[fieldName].args;
        var newArgDef = newArgs.find(function (arg) {
          return arg.name === oldArgDef.name;
        });
        if (!newArgDef) {
          breakingChanges.push({
            type: BreakingChangeType.ARG_REMOVED,
            description: oldType.name + '.' + fieldName + ' arg ' + (oldArgDef.name + ' was removed')
          });
        } else {
          var isSafe = isChangeSafeForInputObjectFieldOrFieldArg(oldArgDef.type, newArgDef.type);
          if (!isSafe) {
            breakingChanges.push({
              type: BreakingChangeType.ARG_CHANGED_KIND,
              description: oldType.name + '.' + fieldName + ' arg ' + (oldArgDef.name + ' has changed type from ') + (oldArgDef.type.toString() + ' to ' + newArgDef.type.toString())
            });
          } else if (oldArgDef.defaultValue !== undefined && oldArgDef.defaultValue !== newArgDef.defaultValue) {
            dangerousChanges.push({
              type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE,
              description: oldType.name + '.' + fieldName + ' arg ' + (oldArgDef.name + ' has changed defaultValue')
            });
          }
        }
      });
      newTypeFields[fieldName].args.forEach(function (newArgDef) {
        var oldArgs = oldTypeFields[fieldName].args;
        var oldArgDef = oldArgs.find(function (arg) {
          return arg.name === newArgDef.name;
        });
        if (!oldArgDef && newArgDef.type instanceof _definition.GraphQLNonNull) {
          breakingChanges.push({
            type: BreakingChangeType.NON_NULL_ARG_ADDED,
            description: 'A non-null arg ' + newArgDef.name + ' on ' + (newType.name + '.' + fieldName + ' was added')
          });
        }
      });
    });
  });
  return {
    breakingChanges: breakingChanges,
    dangerousChanges: dangerousChanges
  };
}
function findArgChanges ( oldSchema , newSchema ) { var oldTypeMap = oldSchema . getTypeMap ( ) ; var newTypeMap = newSchema . getTypeMap ( ) ; var breakingChanges = [ ] ; var dangerousChanges = [ ] ; Object . keys ( oldTypeMap ) . forEach ( function ( typeName ) { var oldType = oldTypeMap [ typeName ] ; var newType = newTypeMap [ typeName ] ; if ( ! ( oldType instanceof _definition . GraphQLObjectType || oldType instanceof _definition . GraphQLInterfaceType ) || ! ( newType instanceof oldType . constructor ) ) { return ; } var oldTypeFields = oldType . getFields ( ) ; var newTypeFields = newType . getFields ( ) ; Object . keys ( oldTypeFields ) . forEach ( function ( fieldName ) { if ( ! newTypeFields [ fieldName ] ) { return ; } oldTypeFields [ fieldName ] . args . forEach ( function ( oldArgDef ) { var newArgs = newTypeFields [ fieldName ] . args ; var newArgDef = newArgs . find ( function ( arg ) { return arg . name === oldArgDef . name ; } ) ; if ( ! newArgDef ) { breakingChanges . push ( { type : BreakingChangeType . ARG_REMOVED , description : oldType . name + '.' + fieldName + ' arg ' + ( oldArgDef . name + ' was removed' ) } ) ; } else { var isSafe = isChangeSafeForInputObjectFieldOrFieldArg ( oldArgDef . type , newArgDef . type ) ; if ( ! isSafe ) { breakingChanges . push ( { type : BreakingChangeType . ARG_CHANGED_KIND , description : oldType . name + '.' + fieldName + ' arg ' + ( oldArgDef . name + ' has changed type from ' ) + ( oldArgDef . type . toString ( ) + ' to ' + newArgDef . type . toString ( ) ) } ) ; } else if ( oldArgDef . defaultValue !== undefined && oldArgDef . defaultValue !== newArgDef . defaultValue ) { dangerousChanges . push ( { type : DangerousChangeType . ARG_DEFAULT_VALUE_CHANGE , description : oldType . name + '.' + fieldName + ' arg ' + ( oldArgDef . name + ' has changed defaultValue' ) } ) ; } } } ) ; newTypeFields [ fieldName ] . args . forEach ( function ( newArgDef ) { var oldArgs = oldTypeFields [ fieldName ] . args ; var oldArgDef = oldArgs . find ( function ( arg ) { return arg . name === newArgDef . name ; } ) ; if ( ! oldArgDef && newArgDef . type instanceof _definition . GraphQLNonNull ) { breakingChanges . push ( { type : BreakingChangeType . NON_NULL_ARG_ADDED , description : 'A non-null arg ' + newArgDef . name + ' on ' + ( newType . name + '.' + fieldName + ' was added' ) } ) ; } } ) ; } ) ; } ) ; return { breakingChanges : breakingChanges , dangerousChanges : dangerousChanges } ; }
Given two schemas, returns an Array containing descriptions of any
 breaking or dangerous changes in the newSchema related to arguments
 (such as removal or change of type of an argument, or a change in an
 argument's default value).
Given two schemas returns an Array containing descriptions of any breaking or dangerous changes in the newSchema related to arguments ( such as removal or change of type of an argument or a change in an argument ' s default value ) .
// Arg not present // Check if a non-null arg was added to the field