|
|
|
|
|
by hedora
108 days ago
|
|
Yep: JSON schema Alternatively, with typescript you can write: export type FooRpcV1 : { version: 1, ... }
export type FooRpcV2 : { version: 2, ... } in zod syntax, and it'll do the right thing statically and at runtime (ask an LLM for help with the syntax). With protobufs (specifically protoc), you get some type like: export type FooRpc : { version : 1 | 2, v1fieldA? : string, v1fieldB? : int, v2fieldB? : string, v2fieldB? string }; which is 2^5 message types, even if all fields of both versions were mandatory. Then application logic needs to validate it. |
|