Help us shape the future of Go! Take the 2026 Go Developer Survey

contractcopy

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Package contractcopy is rule 6 ("knowledge has one place") for the values a TypeSpec contract declares: it reads the generated openapi/*.openapi.json for its enums and numeric limits and reports a hand-written Go or TypeScript copy of them, and a fixture scope the contract does not declare. Go is read through go/parser, TypeScript through patterns (the frontend has no Go types to ask).

Typed Go const blocks are the domain's own vocabulary and are not read.

A value that only looks like a contract value (an OAuth limit, an internal cap) carries `// contract-copy: <reason>` on its line or the line above; a bare marker is still a finding.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check

func Check(root, specDir string) ([]string, error)

Check loads the contract from specDir and scans root for copies.

Types

type Contract

type Contract struct {
	Enums  [][]string
	Limits map[int64]bool
}

Contract is what the OpenAPI documents declare: every enum (a sorted set of values) and every numeric limit.

func LoadContract

func LoadContract(dir string) (Contract, error)

LoadContract reads every *.openapi.json under dir.

Jump to

Keyboard shortcuts

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