TypeSpec is the central structural authority for new Wavenumber-owned contracts that cross language or process boundaries. This standard is independent of web, GUI, frontend, and application-framework guidance. Backend services, CLIs, configuration packages, native applications, libraries, workers, and data systems can adopt it directly.
Names a cross-cutting standard capability independently of project profile.
Returns the TypeSpec contract-authority capability rules.
Returns a named cross-cutting standard capability.
Renders the TypeSpec contract-authority capability as text or JSON.
Renders a named cross-cutting standard capability as text or JSON.
| Posture | Applies when |
|---|---|
| Required | A new Wavenumber-owned contract crosses a language or process boundary, including APIs, events, worker messages, local services, command envelopes, and shared serialized payloads. |
| Strongly recommended | A durable root object or configuration format is initially single-language but is persisted, externally consumed, tool-facing, or likely to gain another implementation. |
| Optional | A private serialized shape has one owner, no durable compatibility promise, and no likely cross-language consumer. |
| Not the authority | A format is owned upstream, or the concern is implementation behavior, effects, transactions, orchestration, or runtime-only state rather than structural data. |
TypeSpec owns names, fields, required and optional properties, scalar constraints, unions, discriminators, operation shapes, error envelopes, event payloads, and compatibility-visible evolution. Generated JSON Schema, OpenAPI, Python, Rust, TypeScript, and other outputs are projections of that authority and must not be hand-edited.
Handwritten domain code owns behavior that a structural contract cannot faithfully express: validation requiring external state, transactions, effects, identity resolution, scheduling, orchestration, and business methods.
TypeSpec governance is a cross-cutting capability, not a primary-language profile. A repository may declare one or more named contract units. The configuration surface has this shape:
[contracts]
[[contracts.units]]
id = "library-domain"
authority = "typespec"
root = "contracts/library-domain"
entrypoint = "contracts/library-domain/main.tsp"
config = "contracts/library-domain/tspconfig.yaml"
compatibility = "versioned"
toolchain_manifest = "package.json"
lockfile = "package-lock.json"
emitter_packages = ["@typespec/json-schema", "@typespec/openapi3"]
generated_policy = "docs/generated-files.md"
[contracts.units.commands]
generate = "npm run generate"
freshness = "npm run check:generated"
conformance = "npm test"
[[contracts.units.projections]]
kind = "json-schema"
output = "generated/schema/library-domain"
required = true
support = "supported"
consumer_evidence = ["tests/node/schema.test.mjs", "tests/python/conformance.py"]
[[contracts.units.projections]]
kind = "typescript"
output = "generated/typescript/library-domain"
required = true
support = "supported"
consumer_evidence = ["frontend:typecheck", "frontend:test"]
The surface represents authority ownership, source/config paths, pinned tooling, outputs, real consumer requirements, regeneration, freshness, conformance, publication, and reviewed exceptions.
The standard uses three support states: fully supported and tested, experimental, and extension seam. A projection is fully supported only when its emitter is independently installable, generation is reproducible, and consumer or conformance evidence is part of signoff.
| Projection | Reference support | Evidence |
|---|---|---|
| JSON Schema | Supported | Generated by the pinned TypeSpec emitter; consumed by Node and Python conformance tests. |
| OpenAPI | Supported when HTTP operations exist | Generated by the pinned TypeSpec emitter and used as the TypeScript input. |
| TypeScript declarations | Supported | Generated from OpenAPI and compiled by a real TypeScript consumer. |
| Python source generation | Extension seam | The reference validates JSON Schema from Python but does not claim a Python model emitter. |
| Rust source generation | Extension seam | No Rust emitter is claimed until an independently pinned generator and consumer test are added. |
The first reference floor is TypeSpec compilation, JSON Schema, one generated language projection consumed by executable code, and shared conformance vectors exercised by a second independent runtime. Python and Rust generation are added only when their emitters meet the same bar.
An exception must name the exact contract unit and construct, explain why TypeSpec is not authoritative or why a projection is lossy, identify the temporary authority, and define a review trigger. Upstream ownership is a valid boundary, but it must identify the upstream specification.
Dev-std audit validates declarations, paths, ownership, output placement, pinning posture, documentation, exceptions, and signoff wiring without installing dependencies or running arbitrary commands. Project or Rack signoff executes compilation, generation, freshness, consumer compilation, and conformance tests.
Version-matched templates are packaged resources exposed through
dev-std template copy and remain browsable in the corresponding source release
tag. A template must be private and copy-owned after adoption; it is not a
shared runtime framework.
docs/templates/typespec-contract/ is the canonical runnable
evidence for this contract. Its TypeSpec source, generated JSON Schema and
OpenAPI, generated TypeScript declarations, and Node/Python conformance
tests are exercised from clean copies during release signoff. Maintainer
commands are defined in Build Documentation.