Documentation
¶
Overview ¶
Command byteslengen emits bytes_max_len.json: per message, the JSON field names of every bytes field declaring (buf.validate.field).bytes.max_len, with the byte limit.
It exists because protoschema-plugins renders that rule as a maxLength on the base64 string that counts the padding characters, which is not exact: 32768 bytes and 32769 bytes both encode to 43692 characters, so a token one byte over the limit passes the JSON Schema while Go protovalidate rejects it. merge_schema.py and gen_jsonschema.py read this manifest and rewrite the field's pattern to allow at most ceil(4n/3) data characters, which is exact, so the generated Pydantic/Zod models, the published schemas and the strict validators refuse exactly what the Go server refuses.
Like requiredgen and uniquegen, this is a Go program because Go protovalidate is the authoritative view of the rules. Scope comes from conformance.Contract.