|
4 | 4 | writes the result to ``src/mcp/types/v<version>/__init__.py`` with only the |
5 | 5 | fixes the raw output needs: a small JSON pre-patch for the known |
6 | 6 | ``number``-as-``integer`` schema.json defect, a header, and per-version |
7 | | -epilogue aliases. Run with ``uv run --group codegen python scripts/gen_surface_types.py [--check]``. |
| 7 | +epilogue aliases. Run with ``uv run --frozen --group codegen python scripts/gen_surface_types.py [--check]``. |
8 | 8 | """ |
9 | 9 |
|
10 | 10 | from __future__ import annotations |
|
27 | 27 |
|
28 | 28 | # schema.ts -> schema.json renders TypeScript ``number`` as JSON Schema |
29 | 29 | # ``integer`` at these sites; patch the JSON before codegen so floats validate. |
| 30 | +# TODO: drop once modelcontextprotocol/modelcontextprotocol fixes the schema.ts -> schema.json number rendering. |
30 | 31 | SCHEMA_PATCHES: dict[str, list[tuple[str, Any, Any]]] = { |
31 | 32 | "2025-11-25": [ |
32 | 33 | ("$defs/NumberSchema/properties/default/type", "integer", "number"), |
@@ -93,7 +94,7 @@ def patch_schema(schema: dict[str, Any], patches: list[tuple[str, Any, Any]]) -> |
93 | 94 | def run_codegen(schema_path: Path, output_path: Path) -> None: |
94 | 95 | """Run datamodel-code-generator (from the ``codegen`` dependency group).""" |
95 | 96 | exe = shutil.which("datamodel-codegen") |
96 | | - cmd = [exe] if exe else ["uv", "run", "--group", "codegen", "datamodel-codegen"] |
| 97 | + cmd = [exe] if exe else ["uv", "run", "--frozen", "--group", "codegen", "datamodel-codegen"] |
97 | 98 | # fmt: off |
98 | 99 | result = subprocess.run( |
99 | 100 | [ |
|
0 commit comments