import statement is showing in RED for java project and the optional parameters '[(validator.field) = {string_not_empty: true, length_lt: 255}];' are also showing RED. Using Java8 + Gradle project
import "github.com/mwitkow/go-proto-validators/validator.proto";
package proto;
/**
The CryptoService takes a number of byte arrays and encrypts / decrypts them using Parcel Encryption.
*/
service CryptoService {
// Encrypts an array of byte arrays
rpc Encrypt (EncryptRequest) returns (EncryptResponse) {}
// Decrypts a ciphertext to an array of byte arrays
rpc Decrypt (DecryptRequest) returns (DecryptResponse) {}
}
message EncryptRequest {
string alias = 1 [(validator.field) = {string_not_empty: true, length_lt: 255}]; // The alias that represents the private key
string derivation_path = 2; // The derivation path to use
repeated bytes data = 3; // One or more arrays of byte arrays containing the data you wish to encrypt ([][]byte)
}
message EncryptResponse {
bytes data = 1; // The resulting ciphertext
}
message DecryptRequest {
string alias = 1; // The alias that represents the private key
string derivation_path = 2; // The derivation path to use
bytes data = 3; // The ciphertext to decrypt ([]byte)
}
message DecryptResponse {
repeated bytes data = 1; // An array of one or more byte arrays ([][]byte)
}```
I found myself a solution as a 'eureka' moment that you can first download the protobuf file (validator.proto in this case) from online and save it your project to accommodate it!!! Then the error is gone :-)