2.1.3 • Published 9 months ago
zod-to-protobuf v2.1.3
zod-to-protobuf
Summary
Convert Zod schemas to Protocol Buffers definitions.
Installation
npm install zod-to-protobuf
Usage
import { z } from 'zod'
import { zodToProtobuf } from 'zod-to-protobuf'
const schema = z.object({
name: z.string(),
age: z.number()
})
const proto = zodToProtobuf(schema)
console.log(proto)
Expected Output
syntax = "proto3";
package default;
message Message {
string name = 1;
double age = 2;
}
Options
Option | Description | Default |
---|---|---|
packageName | Name of the protobuf package | default |
rootMessageName | Name of the protobuf message | Message |
typePrefix | Prefix for each type | (empty string) |
Contributing
Contributions are welcome! Please open an issue or submit a pull request.