From b4fff97d14ee8807cbc4fb09d08704b5663d0926 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Mon, 27 Feb 2017 21:04:15 -0600 Subject: [PATCH] docs: specify protoc version and json_name usage --- docs/code_contribution_guidelines.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/docs/code_contribution_guidelines.md b/docs/code_contribution_guidelines.md index cb0115f5a..6733bb9d5 100644 --- a/docs/code_contribution_guidelines.md +++ b/docs/code_contribution_guidelines.md @@ -8,6 +8,7 @@ 4.3. [Code Documentation and Commenting](#CodeDocumentation)
4.4. [Model Git Commit Messages](#ModelGitCommitMessages)
4.5. [Code Spacing](#CodeSpacing)
+4.6. [Protobuf Compilation](#Protobuf)
5. [Code Approval Process](#CodeApproval)
5.1. [Code Review](#CodeReview)
5.2. [Rework Code (if needed)](#CodeRework)
@@ -328,6 +329,32 @@ Functions should _not_ just be layed out as a bare contiguous block of code. return witness ``` + +### 4.5.6. Protobuf Compilation + +The `lnd` project uses `protobuf`, and its extension [`gRPC`](www.grpc.io) in +several areas and as the primary RPC interface. In order to ensure uniformity +of all protos checked, in we require that all contributors pin against the +_exact same_ version of `protoc`. As of the writing of this article, the `lnd` +project uses [v3.0.2](https://github.com/google/protobuf/releases/tag/v3.2.0) +of `protoc`. + +Additionally, in order to maintain a uniform display of the RPC responses +rendered by `lncli`, all added or modified `protof` definitions, _must_ attach +the proper `json_name` option for all fields. An example of such an option can +be found within the definition of the `DebugLevelResponse` struct: + +```protobuf +message DebugLevelResponse { + string sub_systems = 1 [ json_name = "sub_systems" ]; +} + +``` + +Notice how the `json_name` field option corresponds with the name of the field +itself, and uses a `snake_case` style of name formatting. All added or modified +`proto` fields should adhere to the format above. + ### 5. Code Approval Process