{"id":47573005,"url":"https://github.com/archaistvolts/protobuf-zig","last_synced_at":"2026-04-14T17:01:07.857Z","repository":{"id":155683584,"uuid":"589883461","full_name":"archaistvolts/protobuf-zig","owner":"archaistvolts","description":"A protocol buffers implementation in zig","archived":true,"fork":false,"pushed_at":"2025-07-20T11:21:33.000Z","size":522,"stargazers_count":52,"open_issues_count":2,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-04-08T06:33:36.743Z","etag":null,"topics":["zig-library","zig-package"],"latest_commit_sha":null,"homepage":"","language":"Zig","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/archaistvolts.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-01-17T06:57:46.000Z","updated_at":"2025-10-11T18:43:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"40945b14-d571-4359-a725-ce1865fa441f","html_url":"https://github.com/archaistvolts/protobuf-zig","commit_stats":null,"previous_names":["archaistvolts/protobuf-zig"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/archaistvolts/protobuf-zig","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/archaistvolts%2Fprotobuf-zig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/archaistvolts%2Fprotobuf-zig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/archaistvolts%2Fprotobuf-zig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/archaistvolts%2Fprotobuf-zig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/archaistvolts","download_url":"https://codeload.github.com/archaistvolts/protobuf-zig/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/archaistvolts%2Fprotobuf-zig/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31806209,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-14T11:13:53.975Z","status":"ssl_error","status_checked_at":"2026-04-14T11:13:53.299Z","response_time":153,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["zig-library","zig-package"],"created_at":"2026-03-30T21:00:28.884Z","updated_at":"2026-04-14T17:01:07.844Z","avatar_url":"https://github.com/archaistvolts.png","language":"Zig","funding_links":[],"categories":["Zig"],"sub_categories":[],"readme":"# Archived\nThis repo has been archived.  The author recommends using \u003chttps://github.com/Arwalk/zig-protobuf\u003e.\n\n:warning: This project is in its early early stages. expect bugs and missing features.\n\n# About\nA tool for generating zig code capable of de/serializing to the protocol buffer wire format.  Depends on [protoc](https://developers.google.com/protocol-buffers/docs/downloads) to parse .proto files.  \n\n# Status\n- [x] zig code generation\n  - [ ] recursive message types don't work yet [#1](../../issues/1). see [examples/recursive.proto](examples/recursive.proto)\n- [x] deserialization from wire format\n  - [ ] merging messages not yet implemented - 6 conformance failures\n- [x] serialization to wire format\n- [x] initial serialization to json format - 9 conformance failures\n- [w] conformance testing results: 1489/408/15 success/skip/fail.  the 408 skipped are in these categories:\n  - [ ] json input\n  - [ ] text format output\n  - [ ] jspb format output\n\n# Usage\n\n* download the [`protoc` compiler](https://protobuf.dev/downloads/)\n* make sure `protoc` is in your PATH\n\nNote: this project has been tested against\n```console\n$ protoc --version\nlibprotoc 21.5\n```\n\n\n### Build\n```console\nzig build\n```\n\n### Run tests. \nnote: some of these depend on `protoc` being available.\n```console\nzig build test\n```\n\n### Generate .zig files from .proto files\n```console\n$ zig build run -- -I examples/ examples/person.proto examples/only_enum.proto\n# writes generated content to ./gen/ by default.  \n# use --zig_out=/gen-path to specify different directory.\n```\n\nNote: all arguments after -- are forwarded to `protoc`. \n\nThis is equivalent to:\n```console\n$ zig build\n$ protoc --plugin=zig-out/bin/protoc-gen-zig --zig_out=gen -I examples/ examples/person.proto examples/only_enum.proto\n```\n\nEither of the above generate the following files in gen/:\n```console\n$ ls gen\nonly_enum.pb.zig  person.pb.zig\n```\n\n### Use the generated code\n  * see below for an example `zig test` command\n  * see [build.zig](build.zig) for a packaging example\n```zig\ntest \"readme\" {\n    // Note - the package 'protobuf' below is src/lib.zig.  this package must\n    // include itself. it can be provided in build.zig or on the command line\n    // as shown below.    \n    const std = @import(\"std\");\n    const pb = @import(\"protobuf\");\n    const Person = @import(\"generated\").person.Person;\n\n    // serialize to a writer\n    const alloc = std.testing.allocator; // could be any zig std.mem.Allocator\n    var zero = Person.initFields(.{\n        .id = 1,\n        .name = pb.extern_types.String.init(\"zero\"),\n        .kind = .NONE,\n    });\n    zero.set(.id, 0);\n    var buf = std.ArrayList(u8).init(alloc);\n    defer buf.deinit();\n    try pb.protobuf.serialize(\u0026zero.base, buf.writer());\n\n    // deserialize from a buffer\n    var ctx = pb.protobuf.context(buf.items, alloc);\n    const message = try ctx.deserialize(\u0026Person.descriptor);\n    defer message.deinit(alloc);\n    var zero_copy = try message.as(Person);\n\n    // test that they're equal\n    try std.testing.expect(zero_copy.has(.id));\n    try std.testing.expectEqual(zero.id, zero_copy.id);\n    try std.testing.expect(zero_copy.has(.name));\n    try std.testing.expectEqualStrings(zero.name.slice(), zero_copy.name.slice());\n    try std.testing.expect(zero_copy.has(.kind));\n    try std.testing.expectEqual(zero.kind, zero_copy.kind);\n\n    // serialize to json\n    // const stderr = std.io.getStdErr().writer();\n    const stderr = std.io.null_writer;\n    try pb.json.serialize(\u0026zero.base, stderr, .{\n        .pretty_print = .{ .indent_size = 2 },\n    });\n    _ = try stderr.write(\"\\n\");\n    // prints\n    //{\n    //  \"name\": \"zero\",\n    //  \"id\": 0,\n    //  \"kind\": \"NONE\"\n    //}\n}\n```\n\n```console\n$ zig test src/tests.zig --mod protobuf:protobuf:src/lib.zig --mod generated:protobuf:zig-cache/protobuf-zig/lib.zig --deps protobuf,generated\n```\n\n# Resources\n### inspired by\n* https://github.com/protobuf-c/protobuf-c\n* https://github.com/mlugg/zigpb","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farchaistvolts%2Fprotobuf-zig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farchaistvolts%2Fprotobuf-zig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farchaistvolts%2Fprotobuf-zig/lists"}