# Migrate for Compute Engine V1 API - Class Google::Rpc::BadRequest::FieldViolation (v2.9.0)

2.9.0 (latest) 2.8.0 2.7.0 2.6.0 2.5.1 2.4.0 2.3.0 2.2.0 2.1.1 2.0.0 1.3.0 1.2.0 1.1.0 1.0.2 0.9.0 0.8.2 0.7.0 0.6.1 0.5.0 0.4.0 0.3.0 0.2.0 0.1.1 Reference documentation and code samples for the Migrate for Compute Engine V1 API class Google::Rpc::BadRequest::FieldViolation.

A message type used to describe a single bad request field.

## Inherits

- Object

## Extended By

- Google::Protobuf::MessageExts::ClassMethods

## Includes

- Google::Protobuf::MessageExts

## Methods

### #description

    def description() -> ::String

**Returns**

- (::String) --- A description of why the request element is bad.

### #description=

    def description=(value) -> ::String

**Parameter**

- **value** (::String) --- A description of why the request element is bad.
**Returns**

- (::String) --- A description of why the request element is bad.

### #field

    def field() -> ::String

**Returns**

- (::String) --- A path that leads to a field in the request body. The value will be a
  sequence of dot-separated identifiers that identify a protocol buffer
  field.

  Consider the following:

      message CreateContactRequest {
        message EmailAddress {
          enum Type {
            TYPE_UNSPECIFIED = 0;
            HOME = 1;
            WORK = 2;
          }

          optional string email = 1;
          repeated EmailType type = 2;
        }

        string full_name = 1;
        repeated EmailAddress email_addresses = 2;
      }

  In this example, in proto `field` could take one of the following values:
  - `full_name` for a violation in the `full_name` value
  - `email_addresses[0].email` for a violation in the `email` field of the first `email_addresses` message
  - `email_addresses[2].type[1]` for a violation in the second `type` value in the third `email_addresses` message.

  In JSON, the same values are represented as:
  - `fullName` for a violation in the `fullName` value
  - `emailAddresses[0].email` for a violation in the `email` field of the first `emailAddresses` message
  - `emailAddresses[2].type[1]` for a violation in the second `type` value in the third `emailAddresses` message.

### #field=

    def field=(value) -> ::String

**Parameter**

- **value** (::String) ---

  A path that leads to a field in the request body. The value will be a
  sequence of dot-separated identifiers that identify a protocol buffer
  field.

  Consider the following:

      message CreateContactRequest {
        message EmailAddress {
          enum Type {
            TYPE_UNSPECIFIED = 0;
            HOME = 1;
            WORK = 2;
          }

          optional string email = 1;
          repeated EmailType type = 2;
        }

        string full_name = 1;
        repeated EmailAddress email_addresses = 2;
      }

  In this example, in proto `field` could take one of the following values:
  - `full_name` for a violation in the `full_name` value
  - `email_addresses[0].email` for a violation in the `email` field of the first `email_addresses` message
  - `email_addresses[2].type[1]` for a violation in the second `type` value in the third `email_addresses` message.

  In JSON, the same values are represented as:
  - `fullName` for a violation in the `fullName` value
  - `emailAddresses[0].email` for a violation in the `email` field of the first `emailAddresses` message
  - `emailAddresses[2].type[1]` for a violation in the second `type` value in the third `emailAddresses` message.
**Returns**

- (::String) --- A path that leads to a field in the request body. The value will be a
  sequence of dot-separated identifiers that identify a protocol buffer
  field.

  Consider the following:

      message CreateContactRequest {
        message EmailAddress {
          enum Type {
            TYPE_UNSPECIFIED = 0;
            HOME = 1;
            WORK = 2;
          }

          optional string email = 1;
          repeated EmailType type = 2;
        }

        string full_name = 1;
        repeated EmailAddress email_addresses = 2;
      }

  In this example, in proto `field` could take one of the following values:
  - `full_name` for a violation in the `full_name` value
  - `email_addresses[0].email` for a violation in the `email` field of the first `email_addresses` message
  - `email_addresses[2].type[1]` for a violation in the second `type` value in the third `email_addresses` message.

  In JSON, the same values are represented as:
  - `fullName` for a violation in the `fullName` value
  - `emailAddresses[0].email` for a violation in the `email` field of the first `emailAddresses` message
  - `emailAddresses[2].type[1]` for a violation in the second `type` value in the third `emailAddresses` message.

### #localized_message

    def localized_message() -> ::Google::Rpc::LocalizedMessage

**Returns**

- ([::Google::Rpc::LocalizedMessage](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-vm_migration-v1/latest/Google-Rpc-LocalizedMessage)) --- Provides a localized error message for field-level errors that is safe to return to the API consumer.

### #localized_message=

    def localized_message=(value) -> ::Google::Rpc::LocalizedMessage

**Parameter**

- **value** ([::Google::Rpc::LocalizedMessage](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-vm_migration-v1/latest/Google-Rpc-LocalizedMessage)) --- Provides a localized error message for field-level errors that is safe to return to the API consumer.
**Returns**

- ([::Google::Rpc::LocalizedMessage](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-vm_migration-v1/latest/Google-Rpc-LocalizedMessage)) --- Provides a localized error message for field-level errors that is safe to return to the API consumer.

### #reason

    def reason() -> ::String

**Returns**

- (::String) --- The reason of the field-level error. This is a constant value that identifies the proximate cause of the field-level error. It should uniquely identify the type of the FieldViolation within the scope of the google.rpc.ErrorInfo.domain. This should be at most 63 characters and match a regular expression of `[A-Z][A-Z0-9_]+[A-Z0-9]`, which represents UPPER_SNAKE_CASE.

### #reason=

    def reason=(value) -> ::String

**Parameter**

- **value** (::String) --- The reason of the field-level error. This is a constant value that identifies the proximate cause of the field-level error. It should uniquely identify the type of the FieldViolation within the scope of the google.rpc.ErrorInfo.domain. This should be at most 63 characters and match a regular expression of `[A-Z][A-Z0-9_]+[A-Z0-9]`, which represents UPPER_SNAKE_CASE.
**Returns**

- (::String) --- The reason of the field-level error. This is a constant value that identifies the proximate cause of the field-level error. It should uniquely identify the type of the FieldViolation within the scope of the google.rpc.ErrorInfo.domain. This should be at most 63 characters and match a regular expression of `[A-Z][A-Z0-9_]+[A-Z0-9]`, which represents UPPER_SNAKE_CASE.