PrototypeD
A Protobuf code generator focused on simplicity, flexibility, and ease of use.
USAGE:
prototyped <SUBCOMMAND>
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
SUBCOMMANDS:
build Compile a schema into new or existing source code
help Prints this message or the help of the given subcommand(s)
normalize Normalize a protobin by sorting all the keys of messages and maps
tojson Extract a protobin into another serialized data format
PrototypeD is a sophisticated Protobuf code generator supporting multiple languages including Rust, Python, JavaScript, TypeScript, GDScript, and C++. It includes schema translation and cross-language testing capabilities.
- Designed and implemented Protobuf code generators for multiple languages including Rust, Python, JavaScript, TypeScript, GDScript, and C++
- Created a Protobuf schema translator to convert between the Protobuf schema language and JSON
- Built a cross-language unit test framework that runs and verifies identical test suites across multiple languages
Supported Languages
- Rust: Async/await support, zero-copy parsing
- Python: Typed dictionaries, dataclasses
- JavaScript/TypeScript: ES6 modules, type definitions
- GDScript: Godot 3 and 4 compatible
- C++: Protocol buffer v3 compatible
Architecture
PrototypeD's generator architecture:
graph LR
Proto[.proto files] --> Parser --> IR[Intermediate Representation]
IR --> Generator1 --> Output1[Rust code]
IR --> Generator2 --> Output2[Python code]
IR --> Generator3 --> Output3[TS code]Schema Translation
The schema translator supports bidirectional conversion:
// Protobuf schema
message Person {
string name = 1;
int32 id = 2;
repeated string emails = 3;
}
// JSON representation
{
"message": {
"name": "Person",
"fields": [
{"name": "name", "type": "string", "id": 1},
{"name": "id", "type": "int32", "id": 2},
{"name": "emails", "type": "string", "repeated": true, "id": 3}
]
}
}Cross-Language Testing
The test framework ensures consistency:
- Identical test cases in every language
- Automated comparison of serialization/deserialization
- Schema versioning support