Documentation
¶
Overview ¶
Package conformance — contract.go is the SINGLE source of "which proto packages make up the wire contract". Every descriptor-walking guard and every generator iterates this list, so adding the next contract package is one entry here and nothing else.
This is the only non-test file in the package, and that is deliberate: the corpus and required/unique manifest generators are `package main` under conformance/*/ and cannot import a _test.go file. Before this existed, each of them re-hardcoded the same two walk() calls, so a new package was covered only where someone remembered to add it — the exact opt-in failure mode descriptor_invariants_test.go's header warns about.
Note wire_naming_test.go deliberately does NOT walk descriptors: it reads the committed corpus JSON, which already covers every package walked here.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Contract = []ContractFile{ { Package: "fora.v1", File: forav1.File_fora_v1_fora_proto, RefPage: "../website/src/content/docs/reference/proto-fora.mdx", }, { Package: "fora.admin.v1", File: foraadminv1.File_fora_admin_v1_admin_proto, RefPage: "../website/src/content/docs/reference/proto-admin.mdx", }, }
Contract is the wire contract, in bare-name resolution order.
Functions ¶
func AssertUniqueBareNames ¶
func AssertUniqueBareNames() error
AssertUniqueBareNames reports an error when two contract packages define a message with the same bare name. The corpus keys cases by bare short name (Case.Message == the generated class/schema name), the merged JSON-Schema $defs are keyed the same way, and the {/* fora-validate: X */} doc markers resolve the same way — a cross-package duplicate would silently collide in all three. Returned as an error, not a fatal, so both a `package main` generator (which exits) and a test (which fails) can use it.
func ContractFiles ¶
func ContractFiles() []protoreflect.FileDescriptor
ContractFiles returns the contract file descriptors in resolution order.
func ContractPackages ¶
func ContractPackages() []string
ContractPackages returns the contract package names in resolution order.
func EachMessage ¶
func EachMessage(fn func(protoreflect.MessageDescriptor))
EachMessage visits every message of every contract file, including nested messages, and skipping synthetic map-entry messages (they carry no rules, no docs, and no corpus representation).
Types ¶
type ContractFile ¶
type ContractFile struct {
Package string
File protoreflect.FileDescriptor
// RefPage is the doc-coverage reference page, relative to the conformance/ directory
// (where `go test ./conformance` runs).
RefPage string
}
ContractFile is one proto package of the wire contract: its descriptor, its package name (the corpus and doc markers carry BARE message names, resolved against these in order), and the website reference page that must document every symbol it defines.
Directories
¶
| Path | Synopsis |
|---|---|
|
Command corpusgen emits the cross-language validation corpus: for every message field that carries a protovalidate field rule, a valid baseline plus boundary-violating mutants (one per constraint), each rendered as proto-JSON with Go protovalidate's verdict recorded as the oracle.
|
Command corpusgen emits the cross-language validation corpus: for every message field that carries a protovalidate field rule, a valid baseline plus boundary-violating mutants (one per constraint), each rendered as proto-JSON with Go protovalidate's verdict recorded as the oracle. |
|
Command requiredgen emits required_fields.json: per message, the JSON field names whose proto ZERO value is rejected by the field's own protovalidate rule (an enum not_in:[0], a string min_len≥1 or a pattern that rejects "", a numeric gte≥1, or an explicit required).
|
Command requiredgen emits required_fields.json: per message, the JSON field names whose proto ZERO value is rejected by the field's own protovalidate rule (an enum not_in:[0], a string min_len≥1 or a pattern that rejects "", a numeric gte≥1, or an explicit required). |
|
Command uniquegen emits unique_items.json: per message, the JSON field names of every repeated field declaring (buf.validate.field).repeated.unique — i.e.
|
Command uniquegen emits unique_items.json: per message, the JSON field names of every repeated field declaring (buf.validate.field).repeated.unique — i.e. |