Source: proto/spine/validate/validation_error_pb.js

// source: spine/validate/validation_error.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 * @public
 */
// GENERATED CODE -- DO NOT EDIT!

var jspb = require('google-protobuf');
var goog = jspb;
var global = Function('return this')();

var spine_options_pb = require('../../spine/options_pb.js');
goog.object.extend(proto, spine_options_pb);
var google_protobuf_any_pb = require('../../google/protobuf/any_pb.js');
goog.object.extend(proto, google_protobuf_any_pb);
var spine_base_field_path_pb = require('../../spine/base/field_path_pb.js');
goog.object.extend(proto, spine_base_field_path_pb);
goog.exportSymbol('proto.spine.validate.ConstraintViolation', null, global);
goog.exportSymbol('proto.spine.validate.ValidationError', null, global);
/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 */
proto.spine.validate.ValidationError = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, proto.spine.validate.ValidationError.repeatedFields_, null);
};
goog.inherits(proto.spine.validate.ValidationError, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   */
  proto.spine.validate.ValidationError.displayName = 'proto.spine.validate.ValidationError';
}
/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 */
proto.spine.validate.ConstraintViolation = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, proto.spine.validate.ConstraintViolation.repeatedFields_, null);
};
goog.inherits(proto.spine.validate.ConstraintViolation, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   */
  proto.spine.validate.ConstraintViolation.displayName = 'proto.spine.validate.ConstraintViolation';
}

/**
 * List of repeated fields within this message type.
 * @private {!Array<number>}
 * @const
 */
proto.spine.validate.ValidationError.repeatedFields_ = [1];



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.spine.validate.ValidationError.prototype.toObject = function(opt_includeInstance) {
  return proto.spine.validate.ValidationError.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.spine.validate.ValidationError} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.spine.validate.ValidationError.toObject = function(includeInstance, msg) {
  var f, obj = {
    constraintViolationList: jspb.Message.toObjectList(msg.getConstraintViolationList(),
    proto.spine.validate.ConstraintViolation.toObject, includeInstance)
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


/**
 * Deserializes binary data (in protobuf wire format).
 * @param {jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.spine.validate.ValidationError}
 */
proto.spine.validate.ValidationError.deserializeBinary = function(bytes) {
  var reader = new jspb.BinaryReader(bytes);
  var msg = new proto.spine.validate.ValidationError;
  return proto.spine.validate.ValidationError.deserializeBinaryFromReader(msg, reader);
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.spine.validate.ValidationError} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.spine.validate.ValidationError}
 */
proto.spine.validate.ValidationError.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    var field = reader.getFieldNumber();
    switch (field) {
    case 1:
      var value = new proto.spine.validate.ConstraintViolation;
      reader.readMessage(value,proto.spine.validate.ConstraintViolation.deserializeBinaryFromReader);
      msg.addConstraintViolation(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.spine.validate.ValidationError.prototype.serializeBinary = function() {
  var writer = new jspb.BinaryWriter();
  proto.spine.validate.ValidationError.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.spine.validate.ValidationError} message
 * @param {!jspb.BinaryWriter} writer
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.spine.validate.ValidationError.serializeBinaryToWriter = function(message, writer) {
  var f = undefined;
  f = message.getConstraintViolationList();
  if (f.length > 0) {
    writer.writeRepeatedMessage(
      1,
      f,
      proto.spine.validate.ConstraintViolation.serializeBinaryToWriter
    );
  }
};


/**
 * repeated ConstraintViolation constraint_violation = 1;
 * @return {!Array<!proto.spine.validate.ConstraintViolation>}
 */
proto.spine.validate.ValidationError.prototype.getConstraintViolationList = function() {
  return /** @type{!Array<!proto.spine.validate.ConstraintViolation>} */ (
    jspb.Message.getRepeatedWrapperField(this, proto.spine.validate.ConstraintViolation, 1));
};


/**
 * @param {!Array<!proto.spine.validate.ConstraintViolation>} value
 * @return {!proto.spine.validate.ValidationError} returns this
*/
proto.spine.validate.ValidationError.prototype.setConstraintViolationList = function(value) {
  return jspb.Message.setRepeatedWrapperField(this, 1, value);
};


/**
 * @param {!proto.spine.validate.ConstraintViolation=} opt_value
 * @param {number=} opt_index
 * @return {!proto.spine.validate.ConstraintViolation}
 */
proto.spine.validate.ValidationError.prototype.addConstraintViolation = function(opt_value, opt_index) {
  return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.spine.validate.ConstraintViolation, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.spine.validate.ValidationError} returns this
 */
proto.spine.validate.ValidationError.prototype.clearConstraintViolationList = function() {
  return this.setConstraintViolationList([]);
};



/**
 * List of repeated fields within this message type.
 * @private {!Array<number>}
 * @const
 */
proto.spine.validate.ConstraintViolation.repeatedFields_ = [2,5];



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.spine.validate.ConstraintViolation.prototype.toObject = function(opt_includeInstance) {
  return proto.spine.validate.ConstraintViolation.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.spine.validate.ConstraintViolation} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.spine.validate.ConstraintViolation.toObject = function(includeInstance, msg) {
  var f, obj = {
    msgFormat: jspb.Message.getFieldWithDefault(msg, 1, ""),
    paramList: (f = jspb.Message.getRepeatedField(msg, 2)) == null ? undefined : f,
    typeName: jspb.Message.getFieldWithDefault(msg, 7, ""),
    fieldPath: (f = msg.getFieldPath()) && spine_base_field_path_pb.FieldPath.toObject(includeInstance, f),
    fieldValue: (f = msg.getFieldValue()) && google_protobuf_any_pb.Any.toObject(includeInstance, f),
    violationList: jspb.Message.toObjectList(msg.getViolationList(),
    proto.spine.validate.ConstraintViolation.toObject, includeInstance)
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


/**
 * Deserializes binary data (in protobuf wire format).
 * @param {jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.spine.validate.ConstraintViolation}
 */
proto.spine.validate.ConstraintViolation.deserializeBinary = function(bytes) {
  var reader = new jspb.BinaryReader(bytes);
  var msg = new proto.spine.validate.ConstraintViolation;
  return proto.spine.validate.ConstraintViolation.deserializeBinaryFromReader(msg, reader);
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.spine.validate.ConstraintViolation} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.spine.validate.ConstraintViolation}
 */
proto.spine.validate.ConstraintViolation.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    var field = reader.getFieldNumber();
    switch (field) {
    case 1:
      var value = /** @type {string} */ (reader.readString());
      msg.setMsgFormat(value);
      break;
    case 2:
      var value = /** @type {string} */ (reader.readString());
      msg.addParam(value);
      break;
    case 7:
      var value = /** @type {string} */ (reader.readString());
      msg.setTypeName(value);
      break;
    case 3:
      var value = new spine_base_field_path_pb.FieldPath;
      reader.readMessage(value,spine_base_field_path_pb.FieldPath.deserializeBinaryFromReader);
      msg.setFieldPath(value);
      break;
    case 4:
      var value = new google_protobuf_any_pb.Any;
      reader.readMessage(value,google_protobuf_any_pb.Any.deserializeBinaryFromReader);
      msg.setFieldValue(value);
      break;
    case 5:
      var value = new proto.spine.validate.ConstraintViolation;
      reader.readMessage(value,proto.spine.validate.ConstraintViolation.deserializeBinaryFromReader);
      msg.addViolation(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.spine.validate.ConstraintViolation.prototype.serializeBinary = function() {
  var writer = new jspb.BinaryWriter();
  proto.spine.validate.ConstraintViolation.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.spine.validate.ConstraintViolation} message
 * @param {!jspb.BinaryWriter} writer
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.spine.validate.ConstraintViolation.serializeBinaryToWriter = function(message, writer) {
  var f = undefined;
  f = message.getMsgFormat();
  if (f.length > 0) {
    writer.writeString(
      1,
      f
    );
  }
  f = message.getParamList();
  if (f.length > 0) {
    writer.writeRepeatedString(
      2,
      f
    );
  }
  f = message.getTypeName();
  if (f.length > 0) {
    writer.writeString(
      7,
      f
    );
  }
  f = message.getFieldPath();
  if (f != null) {
    writer.writeMessage(
      3,
      f,
      spine_base_field_path_pb.FieldPath.serializeBinaryToWriter
    );
  }
  f = message.getFieldValue();
  if (f != null) {
    writer.writeMessage(
      4,
      f,
      google_protobuf_any_pb.Any.serializeBinaryToWriter
    );
  }
  f = message.getViolationList();
  if (f.length > 0) {
    writer.writeRepeatedMessage(
      5,
      f,
      proto.spine.validate.ConstraintViolation.serializeBinaryToWriter
    );
  }
};


/**
 * optional string msg_format = 1;
 * @return {string}
 */
proto.spine.validate.ConstraintViolation.prototype.getMsgFormat = function() {
  return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
};


/**
 * @param {string} value
 * @return {!proto.spine.validate.ConstraintViolation} returns this
 */
proto.spine.validate.ConstraintViolation.prototype.setMsgFormat = function(value) {
  return jspb.Message.setProto3StringField(this, 1, value);
};


/**
 * repeated string param = 2;
 * @return {!Array<string>}
 */
proto.spine.validate.ConstraintViolation.prototype.getParamList = function() {
  return /** @type {!Array<string>} */ (jspb.Message.getRepeatedField(this, 2));
};


/**
 * @param {!Array<string>} value
 * @return {!proto.spine.validate.ConstraintViolation} returns this
 */
proto.spine.validate.ConstraintViolation.prototype.setParamList = function(value) {
  return jspb.Message.setField(this, 2, value || []);
};


/**
 * @param {string} value
 * @param {number=} opt_index
 * @return {!proto.spine.validate.ConstraintViolation} returns this
 */
proto.spine.validate.ConstraintViolation.prototype.addParam = function(value, opt_index) {
  return jspb.Message.addToRepeatedField(this, 2, value, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.spine.validate.ConstraintViolation} returns this
 */
proto.spine.validate.ConstraintViolation.prototype.clearParamList = function() {
  return this.setParamList([]);
};


/**
 * optional string type_name = 7;
 * @return {string}
 */
proto.spine.validate.ConstraintViolation.prototype.getTypeName = function() {
  return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 7, ""));
};


/**
 * @param {string} value
 * @return {!proto.spine.validate.ConstraintViolation} returns this
 */
proto.spine.validate.ConstraintViolation.prototype.setTypeName = function(value) {
  return jspb.Message.setProto3StringField(this, 7, value);
};


/**
 * optional spine.base.FieldPath field_path = 3;
 * @return {?proto.spine.base.FieldPath}
 */
proto.spine.validate.ConstraintViolation.prototype.getFieldPath = function() {
  return /** @type{?proto.spine.base.FieldPath} */ (
    jspb.Message.getWrapperField(this, spine_base_field_path_pb.FieldPath, 3));
};


/**
 * @param {?proto.spine.base.FieldPath|undefined} value
 * @return {!proto.spine.validate.ConstraintViolation} returns this
*/
proto.spine.validate.ConstraintViolation.prototype.setFieldPath = function(value) {
  return jspb.Message.setWrapperField(this, 3, value);
};


/**
 * Clears the message field making it undefined.
 * @return {!proto.spine.validate.ConstraintViolation} returns this
 */
proto.spine.validate.ConstraintViolation.prototype.clearFieldPath = function() {
  return this.setFieldPath(undefined);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.spine.validate.ConstraintViolation.prototype.hasFieldPath = function() {
  return jspb.Message.getField(this, 3) != null;
};


/**
 * optional google.protobuf.Any field_value = 4;
 * @return {?proto.google.protobuf.Any}
 */
proto.spine.validate.ConstraintViolation.prototype.getFieldValue = function() {
  return /** @type{?proto.google.protobuf.Any} */ (
    jspb.Message.getWrapperField(this, google_protobuf_any_pb.Any, 4));
};


/**
 * @param {?proto.google.protobuf.Any|undefined} value
 * @return {!proto.spine.validate.ConstraintViolation} returns this
*/
proto.spine.validate.ConstraintViolation.prototype.setFieldValue = function(value) {
  return jspb.Message.setWrapperField(this, 4, value);
};


/**
 * Clears the message field making it undefined.
 * @return {!proto.spine.validate.ConstraintViolation} returns this
 */
proto.spine.validate.ConstraintViolation.prototype.clearFieldValue = function() {
  return this.setFieldValue(undefined);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.spine.validate.ConstraintViolation.prototype.hasFieldValue = function() {
  return jspb.Message.getField(this, 4) != null;
};


/**
 * repeated ConstraintViolation violation = 5;
 * @return {!Array<!proto.spine.validate.ConstraintViolation>}
 */
proto.spine.validate.ConstraintViolation.prototype.getViolationList = function() {
  return /** @type{!Array<!proto.spine.validate.ConstraintViolation>} */ (
    jspb.Message.getRepeatedWrapperField(this, proto.spine.validate.ConstraintViolation, 5));
};


/**
 * @param {!Array<!proto.spine.validate.ConstraintViolation>} value
 * @return {!proto.spine.validate.ConstraintViolation} returns this
*/
proto.spine.validate.ConstraintViolation.prototype.setViolationList = function(value) {
  return jspb.Message.setRepeatedWrapperField(this, 5, value);
};


/**
 * @param {!proto.spine.validate.ConstraintViolation=} opt_value
 * @param {number=} opt_index
 * @return {!proto.spine.validate.ConstraintViolation}
 */
proto.spine.validate.ConstraintViolation.prototype.addViolation = function(opt_value, opt_index) {
  return jspb.Message.addToRepeatedWrapperField(this, 5, opt_value, proto.spine.validate.ConstraintViolation, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.spine.validate.ConstraintViolation} returns this
 */
proto.spine.validate.ConstraintViolation.prototype.clearViolationList = function() {
  return this.setViolationList([]);
};


goog.object.extend(exports, proto.spine.validate);

// Generated by Spine ProtoJs Plugin

let ObjectParser = require('../../../client/parser/object-parser.js').default;
let TypeParsers = require('../../../client/parser/type-parsers.js').default;

proto.spine.validate.ConstraintViolation.Parser = function() {
  ObjectParser.call(this);
};
proto.spine.validate.ConstraintViolation.Parser.prototype = Object.create(ObjectParser.prototype);
proto.spine.validate.ConstraintViolation.Parser.prototype.constructor = proto.spine.validate.ConstraintViolation.Parser;
proto.spine.validate.ConstraintViolation.Parser.prototype.fromObject = function(obj) {
  if (obj === null) {
    return null;
  }
  
  let msg = new proto.spine.validate.ConstraintViolation();
  
  if (obj.msgFormat !== undefined) {
    if (obj.msgFormat !== null) {
      let value = obj.msgFormat;
      msg.setMsgFormat(value);
    }
  }
  
  if (obj.param !== undefined && obj.param !== null) {
    obj.param.forEach(
      (listItem, index, array) => {
        if (listItem !== null) {
          let value = listItem;
          msg.addParam(value);
        }
      }
    );
  }
  
  if (obj.typeName !== undefined) {
    if (obj.typeName !== null) {
      let value = obj.typeName;
      msg.setTypeName(value);
    }
  }
  
  if (obj.fieldPath !== undefined) {
    if (obj.fieldPath === null) {
      msg.setFieldPath(null);
    } else {
      let value = TypeParsers.parserFor('type.spine.io/spine.base.FieldPath').fromObject(obj.fieldPath);
      msg.setFieldPath(value);
    }
  }
  
  if (obj.fieldValue !== undefined) {
    if (obj.fieldValue === null) {
      msg.setFieldValue(null);
    } else {
      let value = TypeParsers.parserFor('type.googleapis.com/google.protobuf.Any').fromObject(obj.fieldValue);
      msg.setFieldValue(value);
    }
  }
  
  if (obj.violation !== undefined && obj.violation !== null) {
    obj.violation.forEach(
      (listItem, index, array) => {
        if (listItem === null) {
          msg.addViolation(null);
        } else {
          let value = TypeParsers.parserFor('type.spine.io/spine.validate.ConstraintViolation').fromObject(listItem);
          msg.addViolation(value);
        }
      }
    );
  }
  return msg;
};

proto.spine.validate.ValidationError.Parser = function() {
  ObjectParser.call(this);
};
proto.spine.validate.ValidationError.Parser.prototype = Object.create(ObjectParser.prototype);
proto.spine.validate.ValidationError.Parser.prototype.constructor = proto.spine.validate.ValidationError.Parser;
proto.spine.validate.ValidationError.Parser.prototype.fromObject = function(obj) {
  if (obj === null) {
    return null;
  }
  
  let msg = new proto.spine.validate.ValidationError();
  
  if (obj.constraintViolation !== undefined && obj.constraintViolation !== null) {
    obj.constraintViolation.forEach(
      (listItem, index, array) => {
        if (listItem === null) {
          msg.addConstraintViolation(null);
        } else {
          let value = TypeParsers.parserFor('type.spine.io/spine.validate.ConstraintViolation').fromObject(listItem);
          msg.addConstraintViolation(value);
        }
      }
    );
  }
  return msg;
};

// Generated by Spine ProtoJs Plugin
proto.spine.validate.ConstraintViolation.typeUrl = function() {
  return 'type.spine.io/spine.validate.ConstraintViolation';
};

// Generated by Spine ProtoJs Plugin
proto.spine.validate.ValidationError.typeUrl = function() {
  return 'type.spine.io/spine.validate.ValidationError';
};