Regenerate contracts#
Change a versioned contract, and the files generated from it, together with the code.
contracts/ holds each contract once; readers use it there and nothing copies it.
Contract |
File |
|---|---|
REST API |
|
MCP tools |
|
JSON schemas |
|
Typed client |
|
List a new contract file in contracts/copies.toml. tests/test_contracts.py fails on an
unlisted or missing one.
OpenAPI#
After an API change, from the repository root in the server environment:
geonemo-services openapi --output contracts/openapi/v1.json
python ci/split_openapi.py --write
python ci/docs_snapshots.py --write
The first command writes the document the server serves. CI regenerates it and fails if it differs from the committed file.
ci/split_openapi.pycuts it intocontracts/openapi/core-v1.json,contracts/openapi/agent-service-v1.jsonand each part’s<part>/openapi/<name>-v1.json. Every operation lands in exactly one file.ci/docs_snapshots.pyrewrites the committed snapshots of the admin CLI and settings (core/snapshots/core-v1.jsonand<part>/snapshots/<name>-v1.json) that the reference pages are built from.
Check without writing:
python ci/split_openapi.py --check
python ci/docs_snapshots.py --check
Then regenerate what is built from the contract: the console’s TypeScript types
(npm run generate in reference/application/console/; npm run check-generated
verifies) and the diagrams (Regenerate diagrams).
Compatibility#
A change to v1.json must keep passing the compatibility check, which rejects common
breaking changes such as removed operations or fields and tighter request limits:
python contracts/tools/check-openapi-compatibility.py OLD.json NEW.json
In CI, ci/check_openapi.py runs it against the base commit’s contract. A
reviewed, intentional break is recorded in
contracts/openapi/direct-inference-api-transition.json.
MCP tools#
contracts/mcp/tools-v1.json lists the tools with their input schemas, the skill resources
and the resource templates. Edit it to match the live registrations;
deploy/tests/test_production_mcp_canary.py compares the file with a server that has every
production part. See Add an MCP tool family. Skills keep their own list of the tools
they use in skills/contracts/geonemo-services-tools.json, and
tests/test_skills_tool_catalog.py fails when a listed tool leaves the contract or changes.
Schemas#
The agent scope schemas are generated from the scope models in the agent service’s client. After an intended model change, rerun the test with the update flag and review the diff:
GEONEMO_UPDATE_CONTRACT_SCHEMAS=1 python -m pytest \
reference/orchestration/agent-service/tests/test_agent_scope_schemas.py
Other schemas under contracts/schemas/ are edited by hand. Parts lists are checked
against parts-v1.schema.json by ci/check_parts.py.