use*_*842 5 protocol-buffers swagger grpc
我正在尝试JSON使用https://github.com/pseudomuto/protoc-gen-doc生成 swagger文件,我找不到排除消息中 grpc 服务/字段的某些 API 的方法。
在 swagger 中找到了相关样式,但似乎找不到将其添加到 protobuf 文件中的方法http://watson-developer-cloud.github.io/api-guidelines/swagger-coding-style.html# exclude -sdks 中的操作
service MyService {
rpc ExternalApi (ExternalApiRequest) returns (ExternalApiResponse) {
option (google.api.http) = {
post: "/my/externalApi"
};
}
rpc InternalApi (InternalApiRequest) returns (InternalApiResponse) {
option (google.api.http) = {
post: "/my/internalApi"
};
}
message ExternalApiResponse {
string prefix = 1;
string id = 2; // field to exclude
}
// message to exclude
message Header { }
Run Code Online (Sandbox Code Playgroud)
有没有办法从协议缓冲区文件中排除操作/字段?
小智 0
你可以加
string id = 2 [(grpc.gateway.protoc_gen_swagger.options.openapiv2_field).read_only = true];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
511 次 |
| 最近记录: |