Documentation
¶
Overview ¶
Package contract builds a fixed content model and compares the public API generated from it (OpenAPI document, GraphQL introspection) with the snapshots in api/, so changes to the API surface are visible in review and checked for breaking changes in CI.
After an intended change, regenerate the snapshots:
UPDATE_API_CONTRACT=1 go test ./internal/openapi ./internal/graphql -run TestAPIContract
Index ¶
Constants ¶
const IntrospectionQuery = `` /* 893-byte string literal not displayed */
IntrospectionQuery is the standard GraphQL introspection query.
Variables ¶
This section is empty.
Functions ¶
func Compare ¶
Compare checks got against the snapshot, or rewrites the snapshot when UPDATE_API_CONTRACT is set. It returns a readable error on a mismatch.
func Encode ¶
Encode returns a stable, indented JSON encoding: object keys are sorted, and lists of named objects (GraphQL types, fields, arguments, enum values) are sorted by name, since their order is not part of the contract.
Types ¶
This section is empty.