{"id":13724040,"url":"https://github.com/emicklei/proto","last_synced_at":"2025-05-13T17:09:22.195Z","repository":{"id":37502395,"uuid":"80157540","full_name":"emicklei/proto","owner":"emicklei","description":"parser for Google ProtocolBuffers definition","archived":false,"fork":false,"pushed_at":"2024-12-18T12:28:02.000Z","size":1410,"stargazers_count":601,"open_issues_count":0,"forks_count":67,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-04-24T01:55:38.039Z","etag":null,"topics":["formatter","golang-package","parser","proto2","proto3","protobuf","protobuf-parser","protocol-buffers"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/emicklei.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"emicklei"}},"created_at":"2017-01-26T21:30:48.000Z","updated_at":"2025-04-05T18:21:52.000Z","dependencies_parsed_at":"2023-01-22T18:30:17.749Z","dependency_job_id":"b47f58c2-fa19-4ecd-8a26-f9884b98057a","html_url":"https://github.com/emicklei/proto","commit_stats":{"total_commits":222,"total_committers":20,"mean_commits":11.1,"dds":0.6441441441441442,"last_synced_commit":"b1541788363d9380427f56b2d9fce54c9b10c16e"},"previous_names":["emicklei/proto3"],"tags_count":50,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emicklei%2Fproto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emicklei%2Fproto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emicklei%2Fproto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emicklei%2Fproto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/emicklei","download_url":"https://codeload.github.com/emicklei/proto/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253990468,"owners_count":21995774,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["formatter","golang-package","parser","proto2","proto3","protobuf","protobuf-parser","protocol-buffers"],"created_at":"2024-08-03T01:01:49.011Z","updated_at":"2025-05-13T17:09:17.177Z","avatar_url":"https://github.com/emicklei.png","language":"Go","funding_links":["https://github.com/sponsors/emicklei"],"categories":["Serialization","Go"],"sub_categories":["HTTP Clients"],"readme":"# proto\n\n[![Go](https://github.com/emicklei/proto/actions/workflows/go.yml/badge.svg)](https://github.com/emicklei/proto/actions/workflows/go.yml)\n[![Go Report Card](https://goreportcard.com/badge/github.com/emicklei/proto)](https://goreportcard.com/report/github.com/emicklei/proto)\n[![GoDoc](https://pkg.go.dev/badge/github.com/emicklei/proto)](https://pkg.go.dev/github.com/emicklei/proto)\n[![codecov](https://codecov.io/gh/emicklei/proto/branch/master/graph/badge.svg)](https://codecov.io/gh/emicklei/proto)\n\nPackage in Go for parsing Google Protocol Buffers [.proto files version 2 + 3](https://developers.google.com/protocol-buffers/docs/reference/proto3-spec)\n\n### install\n\n    go get -u -v github.com/emicklei/proto\n\n### usage\n\n\tpackage main\n\n\timport (\n\t\t\"fmt\"\n\t\t\"os\"\n\n\t\t\"github.com/emicklei/proto\"\n\t)\n\n\tfunc main() {\n\t\treader, _ := os.Open(\"test.proto\")\n\t\tdefer reader.Close()\n\n\t\tparser := proto.NewParser(reader)\n\t\tdefinition, _ := parser.Parse()\n\n\t\tproto.Walk(definition,\n\t\t\tproto.WithService(handleService),\n\t\t\tproto.WithMessage(handleMessage))\n\t}\n\n\tfunc handleService(s *proto.Service) {\n\t\tfmt.Println(s.Name)\n\t}\n\n\tfunc handleMessage(m *proto.Message) {\n\t\tlister := new(optionLister)\n\t\tfor _, each := range m.Elements {\n\t\t\teach.Accept(lister)\n\t\t}\n\t\tfmt.Println(m.Name)\n\t}\n\n\ttype optionLister struct {\n\t\tproto.NoopVisitor\n\t}\n\n\tfunc (l optionLister) VisitOption(o *proto.Option) {\n\t\tfmt.Println(o.Name)\n\t}\n\n### validation\n\nCurrent parser implementation is not completely validating `.proto` definitions.\nIn many but not all cases, the parser will report syntax errors when reading unexpected charaters or tokens.\nUse some linting tools (e.g. https://github.com/uber/prototool) or `protoc` for full validation.\n\n### contributions\n\nSee [proto-contrib](https://github.com/emicklei/proto-contrib) for other contributions on top of this package such as protofmt, proto2xsd and proto2gql.\n[protobuf2map](https://github.com/emicklei/protobuf2map) is a small package for inspecting serialized protobuf messages using its `.proto` definition.\n\n© 2017-2022, [ernestmicklei.com](http://ernestmicklei.com).  MIT License. Contributions welcome.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femicklei%2Fproto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femicklei%2Fproto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femicklei%2Fproto/lists"}