MCPcopy Index your code
hub / github.com/emicklei/proto

github.com/emicklei/proto @proto2xsd-0.2

Chat with this repo
repository ↗ · DeepWiki ↗ · release proto2xsd-0.2 ↗ · + Follow
324 symbols 940 edges 43 files 183 documented · 56% 25 cross-repo links
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

proto

Build Status Go Report Card GoDoc

Package in Go for parsing Google Protocol Buffers [.proto files version 2 + 3] (https://developers.google.com/protocol-buffers/docs/reference/proto3-spec)

This repository also includes 2 commands. The protofmt tool is for formatting .proto files and the proto2xsd tool is for generating XSD files from .proto version 3 files.

usage as package

parser := proto.NewParser(reader)
definition, err := parser.Parse()
if err != nil {
    log.Fatalln("proto parsing failed", err)
}

formatter := proto.NewFormatter(writer," ")
formatter.Format(definition)

usage of proto2xsd command

> proto2xsd -help
    Usage of proto2xsd [flags] [path ...]
    -w  write result to an XSD files instead of stdout

See folder cmd/proto2xsd/README.md for more details.

usage of protofmt command

> protofmt -help
    Usage of protofmt [flags] [path ...]
    -w  write result to (source) files instead of stdout

See folder cmd/protofmt/README.md for more details.

how to install

go get -u -v github.com/emicklei/proto

© 2017, ernestmicklei.com. MIT License. Contributions welcome.

Extension points exported contracts — how you extend this code

Visitee (Interface)
Visitee is implemented by all Proto elements. [17 implementers]
visitor.go
Documented (Interface)
Documented is for types that may have an associated comment (not inlined). [12 implementers]
visitor.go
Visitor (Interface)
Visitor is for dispatching Proto elements. [3 implementers]
visitor.go

Core symbols most depended-on inside this repo

scanIgnoreWhitespace
called by 71
parser.go
unexpected
called by 57
parser.go
String
called by 42
range.go
leftAligned
called by 36
aligned.go
notAligned
called by 24
aligned.go
takeLastComment
called by 18
comment.go
parse
called by 17
enum.go
Parse
called by 16
parser.go

Shape

Method 200
Function 83
Struct 34
Interface 6
TypeAlias 1

Languages

Go100%

Modules by API surface

visitor.go41 symbols
proto_test.go23 symbols
formatter.go20 symbols
scanner.go17 symbols
field.go14 symbols
service.go13 symbols
enum.go13 symbols
comment.go13 symbols
option.go12 symbols
formatter_utils.go12 symbols
oneof.go11 symbols
scanner_test.go9 symbols

For agents

$ claude mcp add proto \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact