Documentation
¶
Overview ¶
Package contract enforces the funcd contract type profile (ADR-0058): the bounded, language-agnostic subset of JSON Schema 2020-12 that a function's I/O contract may use — "the def" (the discipline JTD and WIT apply). A contract is GENERATED from the author's code type (typia / pydantic) and then run through Check before it is shipped or embedded, so a contract can never advertise a shape a peer runtime (or the registry) can't honor.
Supported: scalars (string + format date-time/uuid/email/uri, pattern, length; integer + format int32/int64; number; boolean), string enums, CLOSED objects (additionalProperties:false), arrays, string-keyed maps (additionalProperties:<type>, no properties), DISCRIMINATED unions (oneOf + discriminator), optional/nullable, and the explicit `Json` form (the empty schema {} — arbitrary JSON).
Forbidden (Check returns a fault.Invalid naming the construct): OPEN records (additionalProperties true/absent on a record), NON-DISCRIMINATED oneOf/anyOf/allOf, not, if/then/else, external/recursive $ref, and recursive types (which require $ref).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Check ¶
Check reports whether a JSON Schema (a generated function I/O contract) lies within the funcd profile. It returns nil when every construct is supported, or a fault.Invalid whose message names the first unsupported construct and its JSON-pointer-ish path. A nil/empty input is treated as the `Json` (any) form — valid.
Types ¶
This section is empty.