首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在java工程.proto文件中进行导入

如何在java工程.proto文件中进行导入
EN

Stack Overflow用户
提问于 2020-04-17 22:04:55
回答 1查看 53关注 0票数 0

java项目的导入语句显示为红色,可选参数'(validator.field) = {string_not_empty: true,length_lt: 255};‘也显示为红色。使用Java8 + Gradle项目

代码语言:javascript
复制
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)
}```
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-12-02 16:56:54

我为自己找到了一个解决方案,你可以先从网上下载protobuf文件(在这里是validator.proto),然后保存到你的项目中去适应它!然后错误就消失了:-)

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61273558

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档