README.md in protobuf_transpiler-1.0.0 vs README.md in protobuf_transpiler-1.1.0

- old
+ new

@@ -35,16 +35,16 @@ Finally, following the stubs generation, the task also creates a ruby file for all the proto packages, which corresponds to the created folders in `app/stubs`, containing `require_relative` instructions to the corresponding stubs. This allows `zeitwerk` to work properly despite `grpc_tools_ruby_protoc` not respecting the naming conventions. For example if you have a gem defining proto files with this structure: ``` public - ├── mod1 - │ └── sample1.proto - ├── mod2 - │ └── sample2.proto + ├── mod1 + │ └── sample1.proto + ├── mod2 + │ └── sample2.proto ``` -you will get the follwing structure nested in `app/stubs` +you will get the following structure nested in `app/stubs`: ``` app/stubs ├── mod1 │ ├── sample1_pb.rb │ └── sample1_services_pb.rb @@ -61,19 +61,30 @@ ```bash rake grpc_stubs:annotate ``` As stated in [generate](#generate) this task is executed automatically unless you opt out after the generation step. Leveraging reflection, Messages and Services are inspected and a comment summary is prepended in the corresponding stub file. +The annotations of messages follow these conventions: +- each message is reported with its fully qualified name +- fields are indented in the lines following the message name and are reported as `name: type` +- `repeated` fields are annotated with their type enclosed in brackets (`[type]`) +- `map` fields are annotated with angular brackets: `Map<key_type, value_type>` +- `oneof` fields are annotated with their wrapper name, then each possible variant placed on a new line, further indented and prepended with `| `. + Here's an example of annotations of some messages: ``` # ===== Protobuf Annotation ===== # Test::GetJobReq # id: uint64 +# some_oneof_wrapper: +# | alternative: string +# | another: uint64 # Test::GetJobResp # id: uint64 # name: string # surname: string +# notes: [string] # ===== Protobuf Annotation ===== ``` and some rpcs: ``` # ===== Protobuf Annotation ===== @@ -81,9 +92,10 @@ # GetJob(Test::GetJobReq): Test::GetJobResp # Test::Another # GetNew(Test::GetJobReq): Test::GetJobResp # ===== Protobuf Annotation ===== ``` + ## Future extensions - Support nested messages definition ## Version numbers