uniquegen

command
v1.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 11, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Command uniquegen emits unique_items.json: per message, the JSON field names of every repeated field declaring (buf.validate.field).repeated.unique — i.e. the fields whose items are a SET on the wire, where Go protovalidate rejects a duplicate.

It exists because that rule reaches neither generated client on its own: protoschema-plugins emits no `uniqueItems` keyword at all, so the constraint is absent from the JSON Schema the Pydantic/Zod pipeline consumes. merge_schema.py reads this manifest and injects `uniqueItems: true` (json-schema-to-zod turns that into a `.refine(...)`), and scripts/sdk-types/gen_unique_py.py reads the SAME manifest to emit gen/python/wire/unique.py, which the hand-written wire/base.py seam enforces — datamodel-code-generator drops `uniqueItems` for Pydantic v2.

Like requiredgen, this is a Go program because Go protovalidate is the authoritative view of the rules (the same engine the conformance corpus is labeled against), and the Python bridge must not re-implement rule semantics. Scope comes from conformance.Contract.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL