-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add proto file documentation in markdown (#31)
- Loading branch information
1 parent
87bcec3
commit 75a1933
Showing
6 changed files
with
624 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
# Protocol Documentation | ||
<a name="top"></a> | ||
|
||
{{range .Files}} | ||
|
||
{{.Description}} | ||
|
||
{{range .Services}} | ||
<a name="{{.FullName | anchor}}"></a> | ||
|
||
### {{.Name}} Service | ||
{{.Description}} | ||
|
||
| Method Name | Request Type | Response Type | Description | | ||
| ----------- | ------------ | ------------- | ------------| | ||
{{range .Methods -}} | ||
| {{.Name}} | [{{.RequestLongType}}](#{{.RequestFullType | anchor}}){{if .RequestStreaming}} stream{{end}} | [{{.ResponseLongType}}](#{{.ResponseFullType | anchor}}){{if .ResponseStreaming}} stream{{end}} | {{br .Description}} | | ||
{{end}} | ||
{{end}} <!-- end services --> | ||
|
||
## Messages | ||
|
||
{{range .Messages}} | ||
<a name="{{.FullName | anchor}}"></a> | ||
|
||
### {{.LongName}} | ||
{{.Description}} | ||
|
||
{{if .HasFields}} | ||
| Field | Type | Label | Description | | ||
| ----- | ---- | ----- | ----------- | | ||
{{range .Fields -}} | ||
| {{.Name}} | [{{.LongType}}](#{{.FullType | anchor}}) | {{.Label}} | {{if (index .Options "deprecated"|default false)}}**Deprecated.** {{end}}{{br .Description}}{{if .DefaultValue}}<br/><br/>Default: {{.DefaultValue}}{{end}} | | ||
{{end}} | ||
{{end}} | ||
|
||
{{if .HasExtensions}} | ||
| Extension | Type | Base | Number | Description | | ||
| --------- | ---- | ---- | ------ | ----------- | | ||
{{range .Extensions -}} | ||
| {{.Name}} | {{.LongType}} | {{.ContainingLongType}} | {{.Number}} | {{br .Description}}{{if .DefaultValue}}<br/><br/>Default: {{.DefaultValue}}{{end}} | | ||
{{end}} | ||
{{end}} | ||
|
||
{{end}} <!-- end messages --> | ||
|
||
{{range .Enums}} | ||
<a name="{{.FullName | anchor}}"></a> | ||
|
||
### {{.LongName}} | ||
{{.Description}} | ||
|
||
| Name | Number | Description | | ||
| ---- | ------ | ----------- | | ||
{{range .Values -}} | ||
| {{.Name}} | {{.Number}} | {{br .Description}} | | ||
{{end}} | ||
|
||
{{end}} <!-- end enums --> | ||
|
||
{{if .HasExtensions}} | ||
<a name="extensions"></a> | ||
|
||
### File-level Extensions | ||
| Extension | Type | Base | Number | Description | | ||
| --------- | ---- | ---- | ------ | ----------- | | ||
{{range .Extensions -}} | ||
| {{.Name}} | {{.LongType}} | {{.ContainingLongType}} | {{.Number}} | {{br .Description}}{{if .DefaultValue}}<br/><br/>Default: `{{.DefaultValue}}`{{end}} | | ||
{{end}} | ||
{{end}} <!-- end HasExtensions --> | ||
|
||
{{end}} | ||
|
||
## Scalar Value Types | ||
|
||
| .proto Type | Notes | C++ | Java | Python | Go | C# | PHP | Ruby | | ||
| ----------- | ----- | --- | ---- | ------ | -- | -- | --- | ---- | | ||
{{range .Scalars -}} | ||
| <a name="{{.ProtoType | anchor}}" /> {{.ProtoType}} | {{.Notes}} | {{.CppType}} | {{.JavaType}} | {{.PythonType}} | {{.GoType}} | {{.CSharp}} | {{.PhpType}} | {{.RubyType}} | | ||
{{end}} | ||
|
||
## Google Protobuf Any | ||
|
||
The Any type is a special type that can represent any other type. | ||
|
||
The Any message type lets you use messages as embedded types without having their .proto definition. | ||
An Any contains an arbitrary serialized message as bytes, along with a URL that acts as a globally unique identifier for and resolves to that message's type. | ||
|
||
Documentation on how to use this field for each language: | ||
- [C++](https://protobuf.dev/reference/cpp/cpp-generated/#any) | ||
- [Java](https://protobuf.dev/reference/java/java-generated/#any) | ||
- [Python](https://protobuf.dev/reference/python/python-generated/#any) | ||
- [Go](https://pkg.go.dev/google.golang.org/protobuf/types/known/anypb) | ||
- [C#](https://learn.microsoft.com/en-us/dotnet/architecture/grpc-for-wcf-developers/protobuf-any-oneof#any) | ||
- [PHP](https://github.com/protocolbuffers/protobuf/blob/main/php/src/Google/Protobuf/Any.php) | ||
- [Ruby](https://cloud.google.com/ruby/docs/reference/google-cloud-container_analysis-v1/latest/Google-Protobuf-Any) |
Oops, something went wrong.