Daily Archives: 02.12.2022
Protobuf: add header parameters
They finally added it to the grpc-gateway: https://github.com/grpc-ecosystem/grpc-gateway/pull/3010/files#diff-c255ac405628aada46c25a2c9765605e9f823bc523d3739fd3fa71d4bcbf5c99. So, to use it you can just update to the version 2.14.0 or above — https://github.com/grpc-ecosystem/grpc-gateway/releases/tag/v2.14.0, and add something like this to your protofile:
1 2 3 4 5 6 7 8 9 10 |
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { summary: "Create a new foo."; parameters: { headers: { name: "My-Custom-Header"; description: "Some custom header description"; required: true; }; }; }; |