MCPcopy Index your code
hub / github.com/openai/plugins / _read_json

Function _read_json

plugins/codex-security/scripts/finalize_scan_contract.py:61–70  ·  view source on GitHub ↗
(path: Path)

Source from the content-addressed store, hash-verified

59
60
61def _read_json(path: Path) -> dict[str, Any]:
62 try:
63 payload = _loads_json(path.read_text(encoding="utf-8"))
64 except FileNotFoundError as exc:
65 raise ContractError(f"missing required contract artifact: {path}") from exc
66 except ValueError as exc:
67 raise ContractError(f"{path}: invalid JSON: {exc}") from exc
68 if not isinstance(payload, dict):
69 raise ContractError(f"{path}: expected a JSON object")
70 return payload
71
72
73def _write_json(path: Path, payload: Any) -> None:

Callers 1

validate_against_schemaFunction · 0.70

Calls 2

_loads_jsonFunction · 0.85
ContractErrorClass · 0.85

Tested by

no test coverage detected