Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
TypeScript agentic-aiagentsaiai-agentsaiagentsdeveloper-toolsfunction-callinggpt-4javascriptjsllmllmopsmcppythonremote-mcp-serverssetypescript
fix(sdk): preserve primitive JSON Schema semantics (#4316)
Alberto Schiabelab289d62245d
diff --git a/.changeset/draft4-exclusive-bounds.md b/.changeset/draft4-exclusive-bounds.mdnew file mode 100644index 000000000..9170f6da7--- /dev/null+++ b/.changeset/draft4-exclusive-bounds.md@@ -0,0 +1,5 @@+---+'@composio/json-schema-to-effect-schema': patch+---++Translate draft-4 boolean `exclusiveMinimum`/`exclusiveMaximum` flags (as emitted by OpenAPI 3.0 exporters) into their Draft 7 numeric spelling so exclusive bounds are enforced instead of silently ignored.diff --git a/.changeset/honest-schema-primitives.md b/.changeset/honest-schema-primitives.mdnew file mode 100644index 000000000..c1d3e9930--- /dev/null+++ b/.changeset/honest-schema-primitives.md@@ -0,0 +1,5 @@+---+'@composio/json-schema-to-zod': patch+---++Preserve Draft 7 acceptance across primitive, composed, referenced, conditional, and typeless schemas. Enforce sibling and object/array assertions, retain positional tuple and `additionalItems` behavior, and prevent native Zod materialization from rejecting values already accepted by the source schema.diff --git a/.github/workflows/py.test.yml b/.github/workflows/py.test.ymlindex 4c3b114ca..b1c4437c0 100644--- a/.github/workflows/py.test.yml+++ b/.github/workflows/py.test.yml@@ -88,7 +88,7 @@ jobs:uv pip install -e providers/crewaiuv pip install -e providers/langchainuv pip install -e providers/langgraph- uv pip install pytest pytest-mock+ uv pip install hypothesis pytest pytest-mock- name: Run Import Testsrun: |diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex e92dfc6e4..8a4297e45 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -187,7 +187,7 @@ importers:version: 7.8.5tsdown:specifier: 'catalog:'- version: 0.22.14(@arethetypeswrong/[email protected])([email protected])([email protected])([email protected])([email protected](@emnapi/[email protected])(@emnapi/[email protected]))+ version: 0.22.14(@arethetypeswrong/[email protected])([email protected])([email protected])([email protected])([email protected])tsx:specifier: 'catalog:'version: 4.23.12@@ -719,7 +719,7 @@ importers:version: 2.18.0(@modelcontextprotocol/[email protected](@cfworker/[email protected])([email protected]))'@modelcontextprotocol/sdk':specifier: 'catalog:'- version: 1.30.0(@cfworker/[email protected])([email protected])dotenv:specifier: 'catalog:'version: 17.4.2@@ -871,7 +871,7 @@ importers:version: link:../../packages/providers/vercel'@modelcontextprotocol/sdk':specifier: 'catalog:'- version: 1.30.0(@cfworker/[email protected])([email protected])ai:specifier: 'catalog:'version: 7.0.79([email protected])@@ -924,7 +924,7 @@ importers:version: link:../../packages/providers/openai-agents'@modelcontextprotocol/sdk':specifier: 'catalog:'- version: 1.30.0(@cfworker/[email protected])([email protected])'@openai/agents':specifier: ^0.17.0version: 0.17.0(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])([email protected])@@ -1125,7 +1125,7 @@ importers:version: link:../../packages/providers/vercel'@modelcontextprotocol/sdk':specifier: 'catalog:'- version: 1.30.0(@cfworker/[email protected])([email protected])ai:specifier: 'catalog:'version: 7.0.79([email protected])@@ -1208,7 +1208,7 @@ importers:version: 0.61.1(@effect/[email protected](@effect/[email protected]([email protected]))(@effect/[email protected](@effect/[email protected]([email protected]))([email protected]))(@effect/[email protected](@effect/[email protected](@effect/[email protected]([email protected]))([email protected]))(@effect/[email protected]([email protected]))([email protected]))(@effect/[email protected](@effect/[email protected](@effect/[email protected]([email protected]))([email protected]))(@effect/[email protected]([email protected]))(@effect/[email protected](@effect/[email protected]([email protected]))([email protected]))([email protected]))([email protected]))(@effect/[email protected]([email protected]))(@effect/[email protected](@effect/[email protected]([email protected]))([email protected]))(@effect/[email protected](@effect/[email protected](@effect/[email protected]([email protected]))([email protected]))(@effect/[email protected]([email protected]))([email protected]))([email protected])'@modelcontextprotocol/sdk':specifier: 'catalog:'- version: 1.30.0(@cfworker/[email protected])([email protected])'@zed-industries/claude-code-acp':specifier: ^0.16.2@@ -1305,7 +1305,7 @@ importers:version: 3.2.0tsdown:specifier: 'catalog:'- version: 0.22.14(@arethetypeswrong/[email protected])(@typescript/[email protected])([email protected])([email protected])([email protected](@emnapi/[email protected])(@emnapi/[email protected]))+ version: 0.22.14(@arethetypeswrong/[email protected])(@typescript/[email protected])([email protected])([email protected])([email protected])tsx:specifier: 'catalog:'version: 4.23.12@@ -1329,7 +1329,7 @@ importers:version: 3.22.1tsdown:specifier: 'catalog:'- version: 0.22.14(@arethetypeswrong/[email protected])([email protected])([email protected])([email protected])([email protected](@emnapi/[email protected])(@emnapi/[email protected]))+ version: 0.22.14(@arethetypeswrong/[email protected])([email protected])([email protected])([email protected])([email protected])typescript:specifier: 'catalog:'version: 7.0.2@@ -1344,7 +1344,7 @@ importers:version: link:../core'@modelcontextprotocol/sdk':specifier: 'catalog:'- version: 1.30.0(@cfworker/[email protected])([email protected])extract-zip:specifier: ^2.0.1version: 2.0.1([email protected])@@ -1360,7 +1360,7 @@ importers:version: 1.7.0tsdown:specifier: 'catalog:'- version: 0.22.14(@arethetypeswrong/[email protected])([email protected])([email protected])([email protected])([email protected](@emnapi/[email protected])(@emnapi/[email protected]))+ version: 0.22.14(@arethetypeswrong/[email protected])([email protected])([email protected])([email protected])([email protected])typescript:specifier: 'catalog:'version: 7.0.2@@ -1409,7 +1409,7 @@ importers:version: 7.8.0tsdown:specifier: 'catalog:'- version: 0.22.14(@arethetypeswrong/[email protected])(@typescript/[email protected])([email protected])([email protected])([email protected](@emnapi/[email protected])(@emnapi/[email protected]))+ version: 0.22.14(@arethetypeswrong/[email protected])(@typescript/[email protected])([email protected])([email protected])([email protected])tsx:specifier: 'catalog:'version: 4.23.12@@ -1440,13 +1440,13 @@ importers:version: link:../core'@earendil-works/pi-coding-agent':specifier: ^0.84.3- version: 0.84.3(@modelcontextprotocol/[email protected](@cfworker/[email protected])([email protected]))([email protected])([email protected])+ version: 0.84.3(@modelcontextprotocol/[email protected](@cfworker/[email protected])([email protected]))([email protected])([email protected])([email protected])eve:specifier: ^0.44.4version: 0.44.4(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])([email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected]))([email protected](@cloudflare/[email protected]))tsdown:specifier: 'catalog:'- version: 0.22.14(@arethetypeswrong/[email protected])([email protected])([email protected])([email protected])([email protected](@emnapi/[email protected])(@emnapi/[email protected]))+ version: 0.22.14(@arethetypeswrong/[email protected])([email protected])([email protected])([email protected])([email protected])tsx:specifier: 'catalog:'version: 4.23.12@@ -1471,7 +1471,7 @@ importers:version: link:../json-schema-to-zodtsdown:specifier: 'catalog:'- version: 0.22.14(@arethetypeswrong/[email protected])([email protected])([email protected])([email protected])([email protected](@emnapi/[email protected])(@emnapi/[email protected]))+ version: 0.22.14(@arethetypeswrong/[email protected])([email protected])([email protected])([email protected])([email protected])typescript:specifier: 'catalog:'version: 7.0.2@@ -1483,6 +1483,13 @@ importers:version: 4.4.3ts/packages/json-schema-to-zod:+ dependencies:+ '@cfworker/json-schema':+ specifier: ^4.1.1+ version: 4.1.1+ dequal:+ specifier: ^2.0.3+ version: 2.0.3devDependencies:'@types/json-schema':specifier: ^7.0.15@@ -1490,9 +1497,15 @@ importers:'@types/node':specifier: ^26.3.0version: 26.3.0+ ajv:+ specifier: ^8.20.0+ version: 8.20.0+ fast-check:+ specifier: ^4.9.0+ version: 4.9.0tsdown:specifier: 'catalog:'- version: 0.22.14(@arethetypeswrong/[email protected])([email protected])([email protected])([email protected])([email protected](@emnapi/[email protected])(@emnapi/[email protected]))+ version: 0.22.14(@arethetypeswrong/[email protected])([email protected])([email protected])([email protected])([email protected])typescript:specifier: 'catalog:'version: 7.0.2@@ -1522,7 +1535,7 @@ importers:version: 6.0.266([email protected])tsdown:specifier: 'catalog:'- version: 0.22.14(@arethetypeswrong/[email protected])([email protected])([email protected])([email protected])([email protected](@emnapi/[email protected])(@emnapi/[email protected]))+ version: 0.22.14(@arethetypeswrong/[email protected])([email protected])([email protected])([email protected])([email protected])typescript:specifier: 'catalog:'version: 7.0.2@@ -1544,10 +1557,10 @@ importers:version: link:../../core'@modelcontextprotocol/sdk':specifier: 'catalog:'- version: 1.30.0(@cfworker/[email protected])([email protected])tsdown:specifier: 'catalog:'- version: 0.22.14(@arethetypeswrong/[email protected])([email protected])([email protected])([email protected])([email protected](@emnapi/[email protected])(@emnapi/[email protected]))+ version: 0.22.14(@arethetypeswrong/[email protected])([email protected])([email protected])([email protected])([email protected])typescript:specifier: 'catalog:'version: 7.0.2@@ -1566,7 +1579,7 @@ importers:version: link:../../coretsdown:specifier: 'catalog:'- version: 0.22.14(@arethetypeswrong/[email protected])([email protected])([email protected])([email protected])([email protected](@emnapi/[email protected])(@emnapi/[email protected]))+ version: 0.22.14(@arethetypeswrong/[email protected])([email protected])([email protected])([email protected])([email protected])typescript:specifier: 'catalog:'version: 7.0.2@@ -1585,7 +1598,7 @@ importers:version: link:../../coretsdown:specifier: 'catalog:'- version: 0.22.14(@arethetypeswrong/[email protected])([email protected])([email protected])([email protected])([email protected](@emnapi/[email protected])(@emnapi/[email protected]))+ version: 0.22.14(@arethetypeswrong/[email protected])([email protected])([email protected])([email protected])([email protected])typescript:specifier: 'catalog:'version: 7.0.2@@ -1600,7 +1613,7 @@ importers:version: 1.2.9(@opentelemetry/[email protected])([email protected](@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected]))([email protected])tsdown:specifier: 'catalog:'- version: 0.22.14(@arethetypeswrong/[email protected])([email protected])([email protected])([email protected])([email protected](@emnapi/[email protected])(@emnapi/[email protected]))+ version: 0.22.14(@arethetypeswrong/[email protected])([email protected])([email protected])([email protected])([email protected])typescript:specifier: 'catalog:'version: 7.0.2@@ -1622,7 +1635,7 @@ importers:version: link:../../coretsdown:specifier: 'catalog:'- version: 0.22.14(@arethetypeswrong/[email protected])([email protected])([email protected])([email protected])([email protected](@emnapi/[email protected])(@emnapi/[email protected]))+ version: 0.22.14(@arethetypeswrong/[email protected])([email protected])([email protected])([email protected])([email protected])typescript:specifier: 'catalog:'version: 7.0.2@@ -1644,7 +1657,7 @@ importers:version: 6.0.266([email protected])tsdown:specifier: 'catalog:'- version: 0.22.14(@arethetypeswrong/[email protected])([email protected])([email protected])([email protected])([email protected](@emnapi/[email protected])(@emnapi/[email protected]))+ version: 0.22.14(@arethetypeswrong/[email protected])([email protected])([email protected])([email protected])([email protected])typescript:specifier: 'catalog:'version: 7.0.2@@ -1665,7 +1678,7 @@ importers:version: 7.3.0(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])tsdown:specifier: 'catalog:'- version: 0.22.14(@arethetypeswrong/[email protected])([email protected])([email protected])([email protected])([email protected](@emnapi/[email protected])(@emnapi/[email protected]))+ version: 0.22.14(@arethetypeswrong/[email protected])([email protected])([email protected])([email protected])([email protected])typescript:specifier: 'catalog:'version: 7.0.2@@ -1683,7 +1696,7 @@ importers:version: 0.17.0(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])([email protected])tsdown:specifier: 'catalog:'- version: 0.22.14(@arethetypeswrong/[email protected])([email protected])([email protected])([email protected])([email protected](@emnapi/[email protected])(@emnapi/[email protected]))+ version: 0.22.14(@arethetypeswrong/[email protected])([email protected])([email protected])([email protected])([email protected])typescript:specifier: 'catalog:'version: 7.0.2@@ -1704,7 +1717,7 @@ importers:version: 7.0.79([email protected])tsdown:specifier: 'catalog:'- version: 0.22.14(@arethetypeswrong/[email protected])([email protected])([email protected])([email protected])([email protected](@emnapi/[email protected])(@emnapi/[email protected]))+ version: 0.22.14(@arethetypeswrong/[email protected])([email protected])([email protected])([email protected])([email protected])typescript:specifier: 'catalog:'version: 7.0.2@@ -1769,7 +1782,7 @@ importers:version: link:@types/@babel/helper-validator-identifiertsdown:specifier: 'catalog:'- version: 0.22.14(@arethetypeswrong/[email protected])([email protected])([email protected])([email protected])([email protected](@emnapi/[email protected])(@emnapi/[email protected]))+ version: 0.22.14(@arethetypeswrong/[email protected])([email protected])([email protected])([email protected])([email protected])vitest:specifier: 'catalog:'version: 4.1.11(@opentelemetry/[email protected])(@types/[email protected])(@vitest/[email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected]))@@ -5100,6 +5113,10 @@ packages:resolution: {integrity: sha512-h5+1OzzfCC3Ef7VbtKdcv7zsstUQwUDlYpUTvjeUsJAssPgLn7QzbboPtL5ro04Mq0rPOsMzl7q5hIbRs2wD1A==}engines: {node: '>=8.0.0'}+ resolution: {integrity: sha512-7ms6T7SybUev/PQITciI0yLM2pOSFy5zpG8Ty7tQofcVaQUvrMXp6CBwqF6fThLCLOrfBtuHAtwq6Yu4XPCllg==}+ engines: {node: '>=12.17.0'}+resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==}@@ -6159,6 +6176,9 @@ packages:resolution: {integrity: sha512-bVWawvoZoBYpp6yIoQtQXHZjmz35RSVHnUOTefl8Vcjr8snTPY1wnpSPMWekcFwbxI6gtmT7rSYPFvz71ldiOA==}+ resolution: {integrity: sha512-vvuOGgcuPJAirlHvuQw1TrOiw7ptaIXXmIbNuiNOY6lNGJJH49PQ1Kj4nd783nPdQhQdicgOjVI2yI/9BD6/Ng==}+resolution: {integrity: sha512-wShJPfCS/kYkCBVzVW67wa9cnQIgHTszEK2XHNrFkOgGruuGw081aERAxfRjfdFU+WcIt8x6dvbwkTW4iZuQ8Q==}@@ -7239,7 +7259,7 @@ snapshots:'@anthropic-ai/[email protected](@anthropic-ai/[email protected]([email protected]))(@modelcontextprotocol/[email protected](@cfworker/[email protected])([email protected]))([email protected])':dependencies:'@anthropic-ai/sdk': 0.120.0([email protected])- '@modelcontextprotocol/sdk': 1.30.0(@cfworker/[email protected])([email protected])+ '@modelcontextprotocol/sdk': 1.30.0(@cfworker/[email protected])([email protected])([email protected])zod: 4.4.3optionalDependencies:'@anthropic-ai/claude-agent-sdk-darwin-arm64': 0.3.245@@ -7725,7 +7745,7 @@ snapshots:'@earendil-works/[email protected](@modelcontextprotocol/[email protected](@cfworker/[email protected])([email protected]))([email protected])([email protected])':dependencies:- '@earendil-works/pi-ai': 0.84.3(@modelcontextprotocol/[email protected](@cfworker/[email protected])([email protected]))([email protected])([email protected])+ '@earendil-works/pi-ai': 0.84.3(@modelcontextprotocol/[email protected](@cfworker/[email protected])([email protected]))([email protected])([email protected])([email protected])'@earendil-works/pi-telemetry': 0.84.3diff: 8.0.4ignore: 7.0.5@@ -7739,14 +7759,14 @@ snapshots:- ws- zod- '@earendil-works/[email protected](@modelcontextprotocol/[email protected](@cfworker/[email protected])([email protected]))([email protected])([email protected])':+ '@earendil-works/[email protected](@modelcontextprotocol/[email protected](@cfworker/[email protected])([email protected]))([email protected])([email protected])([email protected])':dependencies:'@anthropic-ai/sdk': 0.91.1([email protected])'@aws-sdk/client-bedrock-runtime': 3.1048.0'@earendil-works/pi-telemetry': 0.84.3'@google/genai': 1.52.0(@modelcontextprotocol/[email protected](@cfworker/[email protected])([email protected]))'@smithy/node-http-handler': 4.7.3- http-proxy-agent: 7.0.2+ http-proxy-agent: 7.0.2([email protected])https-proxy-agent: 7.0.6([email protected])openai: 6.40.0([email protected])([email protected])partial-json: 0.1.7@@ -7763,10 +7783,10 @@ snapshots:dependencies:'@earendil-works/pi-protocol': 0.84.3- '@earendil-works/[email protected](@modelcontextprotocol/[email protected](@cfworker/[email protected])([email protected]))([email protected])([email protected])':+ '@earendil-works/[email protected](@modelcontextprotocol/[email protected](@cfworker/[email protected])([email protected]))([email protected])([email protected])([email protected])':dependencies:'@earendil-works/pi-agent-core': 0.84.3(@modelcontextprotocol/[email protected](@cfworker/[email protected])([email protected]))([email protected])([email protected])- '@earendil-works/pi-ai': 0.84.3(@modelcontextprotocol/[email protected](@cfworker/[email protected])([email protected]))([email protected])([email protected])+ '@earendil-works/pi-ai': 0.84.3(@modelcontextprotocol/[email protected](@cfworker/[email protected])([email protected]))([email protected])([email protected])([email protected])'@earendil-works/pi-client': 0.84.3'@earendil-works/pi-protocol': 0.84.3'@earendil-works/pi-tui': 0.84.3@@ -8025,7 +8045,7 @@ snapshots:protobufjs: 7.6.5ws: 8.21.3optionalDependencies:- '@modelcontextprotocol/sdk': 1.30.0(@cfworker/[email protected])([email protected])+ '@modelcontextprotocol/sdk': 1.30.0(@cfworker/[email protected])([email protected])([email protected])transitivePeerDependencies:- bufferutil- supports-color@@ -8038,7 +8058,7 @@ snapshots:protobufjs: 7.6.5ws: 8.21.3optionalDependencies:- '@modelcontextprotocol/sdk': 1.30.0(@cfworker/[email protected])([email protected])+ '@modelcontextprotocol/sdk': 1.30.0(@cfworker/[email protected])([email protected])([email protected])transitivePeerDependencies:- bufferutil- supports-color@@ -8296,7 +8316,7 @@ snapshots:dependencies:'@langchain/core': 1.2.9(@opentelemetry/[email protected])([email protected](@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected]))([email protected])'@langchain/langgraph': 1.4.12(@langchain/[email protected](@opentelemetry/[email protected])([email protected](@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected]))([email protected]))([email protected])- '@modelcontextprotocol/sdk': 1.30.0(@cfworker/[email protected])([email protected])+ '@modelcontextprotocol/sdk': 1.30.0(@cfworker/[email protected])([email protected])([email protected])debug: 4.4.3([email protected])zod: 4.4.3optionalDependencies:@@ -8372,7 +8392,7 @@ snapshots:'@llamaindex/[email protected](@modelcontextprotocol/[email protected](@cfworker/[email protected])([email protected]))([email protected])([email protected])':optionalDependencies:- '@modelcontextprotocol/sdk': 1.30.0(@cfworker/[email protected])([email protected])+ '@modelcontextprotocol/sdk': 1.30.0(@cfworker/[email protected])([email protected])([email protected])hono: 4.13.4zod: 4.4.3@@ -8530,7 +8550,7 @@ snapshots:'@isaacs/ttlcache': 2.1.5'@lukeed/uuid': 2.0.1'@mastra/schema-compat': 1.3.4([email protected])- '@modelcontextprotocol/sdk': 1.30.0(@cfworker/[email protected])([email protected])+ '@modelcontextprotocol/sdk': 1.30.0(@cfworker/[email protected])([email protected])([email protected])'@sindresorhus/slugify': 2.2.1'@standard-schema/spec': 1.1.0ajv: 8.20.0@@ -8591,7 +8611,7 @@ snapshots:'@modelcontextprotocol/core': 2.0.0'@modelcontextprotocol/ext-apps': 1.7.5(@modelcontextprotocol/[email protected](@cfworker/[email protected])([email protected]))([email protected])'@modelcontextprotocol/node': 2.0.0(@modelcontextprotocol/[email protected])([email protected])- '@modelcontextprotocol/sdk': 1.30.0(@cfworker/[email protected])([email protected])+ '@modelcontextprotocol/sdk': 1.30.0(@cfworker/[email protected])([email protected])([email protected])'@modelcontextprotocol/server': 2.0.0'@modelcontextprotocol/server-legacy': 2.0.0([email protected])exit-hook: 5.1.0@@ -8649,7 +8669,7 @@ snapshots:'@modelcontextprotocol/[email protected](@modelcontextprotocol/[email protected](@cfworker/[email protected])([email protected]))([email protected])':dependencies:- '@modelcontextprotocol/sdk': 1.30.0(@cfworker/[email protected])([email protected])+ '@modelcontextprotocol/sdk': 1.30.0(@cfworker/[email protected])([email protected])([email protected])'@standard-schema/spec': 1.1.0zod: 4.4.3@@ -8684,7 +8704,7 @@ snapshots:transitivePeerDependencies:- supports-color+ '@modelcontextprotocol/[email protected](@cfworker/[email protected])([email protected])([email protected])':dependencies:'@hono/node-server': 2.1.1([email protected])ajv: 8.20.0@@ -8695,20 +8715,20 @@ snapshots:eventsource: 3.0.7eventsource-parser: 3.1.1express: 5.2.1- express-rate-limit: 8.6.2([email protected])+ express-rate-limit: 8.6.2([email protected])([email protected])hono: 4.13.4jose: 6.2.9json-schema-typed: 8.0.2pkce-challenge: 5.0.1raw-body: 3.0.2- zod: 3.25.76- zod-to-json-schema: 3.25.2([email protected])+ zod: 4.4.3+ zod-to-json-schema: 3.25.2([email protected])optionalDependencies:'@cfworker/json-schema': 4.1.1transitivePeerDependencies:- supports-colordependencies:'@hono/node-server': 2.1.1([email protected])ajv: 8.20.0@@ -8719,14 +8739,14 @@ snapshots:eventsource: 3.0.7eventsource-parser: 3.1.1express: 5.2.1- express-rate-limit: 8.6.2([email protected])+ express-rate-limit: 8.6.2([email protected])([email protected])hono: 4.13.4jose: 6.2.9json-schema-typed: 8.0.2pkce-challenge: 5.0.1raw-body: 3.0.2- zod: 4.4.3- zod-to-json-schema: 3.25.2([email protected])+ zod: 3.25.76+ zod-to-json-schema: 3.25.2([email protected])optionalDependencies:'@cfworker/json-schema': 4.1.1transitivePeerDependencies:@@ -8737,7 +8757,7 @@ snapshots:'@modelcontextprotocol/core': 2.0.0content-type: 1.0.5cors: 2.8.6- express-rate-limit: 8.6.2([email protected])+ express-rate-limit: 8.6.2([email protected])([email protected])pkce-challenge: 5.0.1raw-body: 3.0.2zod: 4.4.3@@ -10182,7 +10202,7 @@ snapshots:transitivePeerDependencies:- supports-colordependencies:debug: 4.4.3([email protected])express: 5.2.1@@ -10248,6 +10268,10 @@ snapshots:dependencies:pure-rand: 6.1.0+ dependencies:+ pure-rand: 8.4.2+@@ -10440,7 +10464,7 @@ snapshots:statuses: 2.0.2toidentifier: 1.0.1dependencies:agent-base: 7.1.4debug: 4.4.3([email protected])@@ -11446,6 +11470,8 @@ snapshots:+ [email protected]: {}+dependencies:tweetnacl: 1.0.3@@ -11900,7 +11926,7 @@ snapshots:'@ts-morph/common': 0.29.0code-block-writer: 13.0.3- [email protected](@arethetypeswrong/[email protected])(@typescript/[email protected])([email protected])([email protected])([email protected](@emnapi/[email protected])(@emnapi/[email protected])):+ [email protected](@arethetypeswrong/[email protected])(@typescript/[email protected])([email protected])([email protected])([email protected]):dependencies:ansis: 4.3.1cac: 7.0.0@@ -11929,7 +11955,7 @@ snapshots:- oxc-resolver- vue-tsc- [email protected](@arethetypeswrong/[email protected])([email protected])([email protected])([email protected])([email protected](@emnapi/[email protected])(@emnapi/[email protected])):+ [email protected](@arethetypeswrong/[email protected])([email protected])([email protected])([email protected])([email protected]):dependencies:ansis: 4.3.1cac: 7.0.0diff --git a/python/composio/core/models/_files.py b/python/composio/core/models/_files.pyindex 7affa239c..d250a818a 100644--- a/python/composio/core/models/_files.py+++ b/python/composio/core/models/_files.py@@ -966,6 +966,11 @@ class FileHelper(WithLogger):return schemarequired = schema.get("required") or []for _param, _schema in schema["properties"].items():+ if not isinstance(_schema, dict):+ # Boolean schemas have no description to enhance. They are+ # valid property schemas and reach this unconditional helper+ # before schema conversion.+ continueif _schema.get("type") in ["string", "integer", "number", "boolean"]:ext = f"Please provide a value of type {_schema['type']}."description = _schema.get("description", "").rstrip(".")diff --git a/python/composio/utils/schema_converter.py b/python/composio/utils/schema_converter.pyindex 85ab1b71f..57943f350 100644--- a/python/composio/utils/schema_converter.py+++ b/python/composio/utils/schema_converter.py@@ -9,6 +9,7 @@ boolean schemas (true/false values that are valid in JSON Schema draft-06+).We handle those by pre-filtering them before passing to the library."""+import decimalimport reimport typesimport typing as t@@ -22,19 +23,24 @@ from json_schema_to_pydantic import (from json_schema_to_pydantic import (create_model as create_model_from_schema,)+from jsonschema import exceptions as jsonschema_exceptionsfrom jsonschema import validators as jsonschema_validatorsfrom jsonschema.protocols import Validatorfrom pydantic import (+ AfterValidator,BaseModel,+ BeforeValidator,ConfigDict,Field,TypeAdapter,+ ValidationError,model_validator,)from pydantic import (create_model as create_pydantic_model,)from pydantic_core import core_schema+from referencing import Registryfrom composio.utils.logging import get as get_logger@@ -45,7 +51,14 @@ _EXPLICIT_DEFAULT_FIELDS_ATTRIBUTE = "__composio_explicit_default_fields__"class _UnsatisfiableSchema:- """Pydantic type for JSON schemas that reject every value."""+ """Pydantic type for JSON schemas that reject every value.++ JSON Schema (draft-06+) allows the literal ``false`` anywhere a schema is+ expected, meaning "no value is valid". This marker stands in for it during+ conversion so combiners can tell an always-rejecting member apart from an+ absent one, and so the exact validator can turn it back into ``false``.+ The literal ``true`` ("any value is valid") simply becomes ``t.Any``.+ """@staticmethoddef _reject(_value: t.Any) -> t.NoReturn:@@ -80,11 +93,128 @@ PYDANTIC_TYPE_TO_PYTHON_TYPE = {"boolean": bool,"array": t.List,"object": t.Dict,- "null": t.Optional[t.Any],+ "null": type(None),}CONTAINER_TYPE = ("array", "object")+# Keywords that constrain which instances a schema accepts. A schema whose keys+# are all outside this set (title, description, default, examples, ...) is pure+# annotation and accepts every value, exactly like the empty schema.+_ASSERTION_KEYWORDS = frozenset(+ {+ "type",+ "enum",+ "const",+ "anyOf",+ "allOf",+ "oneOf",+ "not",+ "if",+ "then",+ "else",+ "$ref",+ "properties",+ "patternProperties",+ "additionalProperties",+ "propertyNames",+ "required",+ "dependencies",+ "minProperties",+ "maxProperties",+ "items",+ "additionalItems",+ "contains",+ "minItems",+ "maxItems",+ "uniqueItems",+ "minLength",+ "maxLength",+ "pattern",+ "minimum",+ "maximum",+ "exclusiveMinimum",+ "exclusiveMaximum",+ "multipleOf",+ }+)++_SCALAR_CONSTRAINT_KEYWORDS = frozenset(+ {+ "minLength",+ "maxLength",+ "pattern",+ "minimum",+ "maximum",+ "exclusiveMinimum",+ "exclusiveMaximum",+ "multipleOf",+ }+)++_STRUCTURAL_KEYWORDS = frozenset(+ {"anyOf", "allOf", "oneOf", "not", "if", "$ref", "properties", "items"}+)++_TYPELESS_TYPE_SCOPED_KEYWORDS = frozenset(+ {+ "properties",+ "patternProperties",+ "additionalProperties",+ "propertyNames",+ "required",+ "dependencies",+ "minProperties",+ "maxProperties",+ "items",+ "additionalItems",+ "contains",+ "minItems",+ "maxItems",+ "uniqueItems",+ }+)++# Keywords each type-array member keeps when the array is rewritten to anyOf.+_TYPE_SCOPED_KEYWORDS: t.Dict[str, frozenset] = {+ "string": frozenset({"minLength", "maxLength", "pattern"}),+ "integer": frozenset(+ {"minimum", "maximum", "exclusiveMinimum", "exclusiveMaximum", "multipleOf"}+ ),+ "number": frozenset(+ {"minimum", "maximum", "exclusiveMinimum", "exclusiveMaximum", "multipleOf"}+ ),+ "array": frozenset(+ {+ "items",+ "additionalItems",+ "contains",+ "minItems",+ "maxItems",+ "uniqueItems",+ }+ ),+ "object": frozenset(+ {+ "properties",+ "patternProperties",+ "additionalProperties",+ "propertyNames",+ "required",+ "dependencies",+ "minProperties",+ "maxProperties",+ }+ ),+ "boolean": frozenset(),+ "null": frozenset(),+}++_TYPE_ARRAY_SHARED_KEYWORDS = frozenset({"enum", "const", "format"})+_TYPE_ARRAY_WRAPPER_KEYWORDS = frozenset(+ {"title", "description", "default", "examples"}+)+# Should be deprecated,# required values will always be provided by users# Non-required values are nullable(None) if default value not provided.@@ -138,6 +268,12 @@ def _filter_boolean_schemas(if not isinstance(schema, dict):return schema+ # A schema that enumerates no acceptable values rejects everything, exactly+ # like `false`. Normalizing here routes both spellings through the same+ # unsatisfiable-property handling (which tolerates the property's absence).+ if schema.get("enum") == [] or schema.get("type") == []:+ return _UnsatisfiableSchema+# Make a copy to avoid mutating the originalresult = {}for key, value in schema.items():@@ -442,6 +578,10 @@ def _mark_explicit_default_fields("""Attach recursive default-presence metadata to generated model classes."""origin = t.get_origin(annotation)arguments = t.get_args(annotation)+ if origin is t.Annotated:+ # Exact-validation wrappers must not hide the materialized type below.+ _mark_explicit_default_fields(arguments[0], schema, root_schema, visiting)+ returnif origin in (t.Union, types.UnionType):options: t.List[t.Dict[str, t.Any]] = []resolved_schema = _resolve_default_metadata_schema(schema, root_schema)@@ -999,22 +1139,40 @@ def json_schema_to_pydantic_type(:param root_schema: Full schema document used to resolve nested local references.:return: A Pydantic type."""- # Handle boolean schemas (JSON Schema draft-06+)+ # A schema may be the literal `true` or `false` instead of an object+ # (JSON Schema draft-06+), e.g. `additionalProperties: false` or a member+ # of `anyOf`. `true` accepts every value; `false` rejects every value.if isinstance(json_schema, bool):if json_schema:- return t.Any # true schema accepts any value- else:- return None # false schema - will be filtered out in union processing+ return t.Any+ return _UnsatisfiableSchema# Pre-filter boolean schemas from combinersfiltered_schema = _filter_boolean_schemas(json_schema)filtered_schema = _resolve_unsatisfiable_references(filtered_schema)document_root = root_schema if root_schema is not None else json_schema_validate_dynamic_object_policies(json_schema, document_root)- return _filtered_schema_to_pydantic_type(+ annotation = _filtered_schema_to_pydantic_type(filtered_schema,root_schema=document_root,)+ # Two layers: Pydantic materializes the value (defaults, aliases, models),+ # while the source schema decides acceptance. Keywords Pydantic cannot+ # express get a Draft 7 "exact" check that runs before Pydantic coercion.+ # Generated models already carry that check (see `_with_exact_validation`),+ # so only non-model annotations are wrapped here. When Pydantic would+ # narrow a valid value (e.g. `$ref`, `allOf`), the value is kept as-is.+ if (+ _requires_whole_schema_validation(json_schema)+ and not _is_unsatisfiable_schema(annotation)+ and not (isinstance(annotation, type) and issubclass(annotation, BaseModel))+ ):+ return _with_exact_validation_annotation(+ t.Any if _needs_permissive_materialization(json_schema) else annotation,+ json_schema,+ document_root,+ )+ return annotationdef _filtered_schema_to_pydantic_type(@@ -1026,6 +1184,33 @@ def _filtered_schema_to_pydantic_type(if schema is None or _is_unsatisfiable_schema(schema):return _UnsatisfiableSchema+ if not _ASSERTION_KEYWORDS.intersection(schema):+ # Pure-annotation schemas (only title/description/default/...) accept+ # every value, exactly like the empty schema.+ return t.Any++ schema_type = schema.get("type")+ if isinstance(schema_type, list):+ if not schema_type:+ return _UnsatisfiableSchema+ return _build_union_from_options(+ [+ {**schema, "type": member, "x-composio-strict-type": True}+ for member in schema_type+ ],+ root_schema=root_schema,+ )++ if schema_type is None and (+ "enum" in schema+ or "const" in schema+ or (+ _SCALAR_CONSTRAINT_KEYWORDS.intersection(schema)+ and not _STRUCTURAL_KEYWORDS.intersection(schema)+ )+ ):+ return _apply_scalar_constraints(t.Any, schema)+# Handle simple primitive types without complex combinersif _is_simple_primitive(schema):return _convert_simple_type(schema)@@ -1048,10 +1233,801 @@ def _is_simple_primitive(schema: t.Dict[str, t.Any]) -> bool:)+def _matches_json_type(type_: str, value: t.Any) -> bool:+ """JSON type membership per Draft 7 (booleans are not numbers, 2.0 is an integer)."""+ if type_ == "string":+ return isinstance(value, str)+ if type_ == "boolean":+ return isinstance(value, bool)+ if type_ == "null":+ return value is None+ if type_ == "integer":+ if isinstance(value, bool):+ return False+ return isinstance(value, int) or (+ isinstance(value, float) and value.is_integer()+ )+ if type_ == "number":+ return isinstance(value, (int, float)) and not isinstance(value, bool)+ if type_ == "array":+ return isinstance(value, list)+ if type_ == "object":+ return isinstance(value, dict)+ return True+++def _json_type_guard(type_: str) -> t.Callable[[t.Any], t.Any]:+ def validate(value: t.Any) -> t.Any:+ if not _matches_json_type(type_, value):+ raise ValueError(f"value is not of JSON type {type_!r}")+ return value++ return validate+++def _strict_json_type_annotation(type_: str) -> t.Any:+ """A type-checked annotation that still coerces integral floats for `integer`."""+ if type_ == "null":+ return type(None)+ base = PYDANTIC_TYPE_TO_PYTHON_TYPE.get(type_, str)+ return t.Annotated[base, BeforeValidator(_json_type_guard(type_))]++def _convert_simple_type(schema: t.Dict[str, t.Any]) -> t.Type[t.Any]:"""Convert simple primitive types directly."""type_ = schema.get("type", "string")- return t.cast(t.Type[t.Any], PYDANTIC_TYPE_TO_PYTHON_TYPE.get(type_, str))+ use_strict_type = (+ schema.get("x-composio-strict-type") is True+ or "enum" in schema+ or "const" in schema+ )+ base_type = (+ _strict_json_type_annotation(type_)+ if use_strict_type+ else t.cast(t.Type[t.Any], PYDANTIC_TYPE_TO_PYTHON_TYPE.get(type_, str))+ )+ return _apply_scalar_constraints(base_type, schema)+++def _json_values_equal(left: t.Any, right: t.Any) -> bool:+ """Compare JSON values without treating booleans as numbers."""+ if isinstance(left, bool) or isinstance(right, bool):+ return type(left) is type(right) and left == right++ if isinstance(left, list) and isinstance(right, list):+ return len(left) == len(right) and all(+ _json_values_equal(left_item, right_item)+ for left_item, right_item in zip(left, right)+ )++ if isinstance(left, dict) and isinstance(right, dict):+ return left.keys() == right.keys() and all(+ _json_values_equal(left[key], right[key]) for key in left+ )++ return bool(left == right)+++def _allowed_values_validator(+ allowed: t.Tuple[t.Any, ...],+) -> t.Callable[[t.Any], t.Any]:+ """Create a Pydantic validator for JSON Schema enum/const values."""++ def validate(value: t.Any) -> t.Any:+ if not any(_json_values_equal(value, candidate) for candidate in allowed):+ raise ValueError(f"value must be one of {allowed!r}")+ return value++ return validate+++def _is_numeric(value: t.Any) -> bool:+ return isinstance(value, (int, float)) and not isinstance(value, bool)+++def _is_json_multiple_of(value: t.Any, multiple: t.Any) -> bool:+ """Decimal-scaled multipleOf, matching the Zod and Effect converters.++ Raw float modulo misreports common decimal steps (0.3 % 0.1 != 0 in+ binary floating point); comparing through `Decimal(str(...))` recovers the+ author's decimal intent.+ """+ try:+ return (decimal.Decimal(str(value)) % decimal.Decimal(str(multiple))) == 0+ except (decimal.InvalidOperation, decimal.DivisionByZero):+ return False+++def _multiple_of_validator(multiple: t.Any) -> t.Callable[[t.Any], t.Any]:+ def validate(value: t.Any) -> t.Any:+ if _is_numeric(value) and not _is_json_multiple_of(value, multiple):+ raise ValueError(f"value is not a multiple of {multiple!r}")+ return value++ return validate+++def _compile_pattern(pattern: str) -> t.Optional[t.Pattern[str]]:+ try:+ return re.compile(pattern)+ except re.error:+ logger.warning(+ "Ignoring JSON Schema pattern %r: not a valid Python regular expression",+ pattern,+ )+ return None+++def _with_string_constraints(annotation: t.Any, schema: t.Dict[str, t.Any]) -> t.Any:+ field_constraints: t.Dict[str, t.Any] = {}+ if "minLength" in schema:+ field_constraints["min_length"] = schema["minLength"]+ if "maxLength" in schema:+ field_constraints["max_length"] = schema["maxLength"]+ if field_constraints:+ annotation = t.Annotated[annotation, Field(**field_constraints)]+ if "pattern" in schema:+ annotation = _with_pattern_constraint(annotation, schema["pattern"])+ return annotation+++def _with_pattern_constraint(annotation: t.Any, pattern: str) -> t.Any:+ """Prefer pydantic's native pattern; fall back to Python `re` when the Rust+ regex crate rejects an ECMA construct such as look-around (legal in+ Draft 7, whose regex dialect is ECMA-262)."""+ candidate = t.Annotated[annotation, Field(pattern=pattern)]+ try:+ TypeAdapter(candidate)+ return candidate+ except Exception: # noqa: BLE001 - pydantic raises SchemaError subclasses+ pass++ compiled = _compile_pattern(pattern)+ if compiled is None:+ return annotation++ def validate(value: t.Any) -> t.Any:+ if isinstance(value, str) and compiled.search(value) is None:+ raise ValueError(f"string does not match pattern {pattern!r}")+ return value++ return t.Annotated[annotation, AfterValidator(validate)]+++def _with_numeric_constraints(annotation: t.Any, schema: t.Dict[str, t.Any]) -> t.Any:+ field_constraints: t.Dict[str, t.Any] = {}+ if "minimum" in schema:+ field_constraints["gt" if schema.get("exclusiveMinimum") is True else "ge"] = (+ schema["minimum"]+ )+ if _is_numeric(schema.get("exclusiveMinimum")):+ field_constraints["gt"] = schema["exclusiveMinimum"]++ if "maximum" in schema:+ field_constraints["lt" if schema.get("exclusiveMaximum") is True else "le"] = (+ schema["maximum"]+ )+ if _is_numeric(schema.get("exclusiveMaximum")):+ field_constraints["lt"] = schema["exclusiveMaximum"]++ if field_constraints:+ annotation = t.Annotated[annotation, Field(**field_constraints)]+ if "multipleOf" in schema:+ annotation = t.Annotated[+ annotation, AfterValidator(_multiple_of_validator(schema["multipleOf"]))+ ]+ return annotation+++def _check_numeric_keywords(schema: t.Dict[str, t.Any], value: t.Any) -> None:+ minimum = schema.get("minimum")+ if _is_numeric(minimum):+ if schema.get("exclusiveMinimum") is True:+ if value <= minimum:+ raise ValueError(f"value must be greater than {minimum!r}")+ elif value < minimum:+ raise ValueError(f"value must be at least {minimum!r}")+ exclusive_minimum = schema.get("exclusiveMinimum")+ if _is_numeric(exclusive_minimum) and value <= exclusive_minimum:+ raise ValueError(f"value must be greater than {exclusive_minimum!r}")++ maximum = schema.get("maximum")+ if _is_numeric(maximum):+ if schema.get("exclusiveMaximum") is True:+ if value >= maximum:+ raise ValueError(f"value must be less than {maximum!r}")+ elif value > maximum:+ raise ValueError(f"value must be at most {maximum!r}")+ exclusive_maximum = schema.get("exclusiveMaximum")+ if _is_numeric(exclusive_maximum) and value >= exclusive_maximum:+ raise ValueError(f"value must be less than {exclusive_maximum!r}")++ if "multipleOf" in schema and not _is_json_multiple_of(value, schema["multipleOf"]):+ raise ValueError(f"value is not a multiple of {schema['multipleOf']!r}")+++def _typeless_constraint_validator(+ schema: t.Dict[str, t.Any],+) -> t.Optional[t.Callable[[t.Any], t.Any]]:+ """Draft 7 applies scalar constraints per instance type even without `type`."""+ if not _SCALAR_CONSTRAINT_KEYWORDS.intersection(schema):+ return None++ compiled_pattern = (+ _compile_pattern(schema["pattern"]) if "pattern" in schema else None+ )++ def validate(value: t.Any) -> t.Any:+ if isinstance(value, str):+ if "minLength" in schema and len(value) < schema["minLength"]:+ raise ValueError(+ f"string must contain at least {schema['minLength']} characters"+ )+ if "maxLength" in schema and len(value) > schema["maxLength"]:+ raise ValueError(+ f"string must contain at most {schema['maxLength']} characters"+ )+ if compiled_pattern is not None and compiled_pattern.search(value) is None:+ raise ValueError(f"string does not match pattern {schema['pattern']!r}")+ if _is_numeric(value):+ _check_numeric_keywords(schema, value)+ return value++ return validate+++def _apply_scalar_constraints(+ base_type: t.Type[t.Any],+ schema: t.Dict[str, t.Any],+) -> t.Type[t.Any]:+ """Apply scalar JSON Schema validation keywords to a Python annotation."""+ type_ = schema.get("type")+ annotation: t.Any = base_type++ if type_ == "string":+ annotation = _with_string_constraints(annotation, schema)+ elif type_ in ("integer", "number"):+ annotation = _with_numeric_constraints(annotation, schema)+ elif type_ is None:+ validator = _typeless_constraint_validator(schema)+ if validator is not None:+ annotation = t.Annotated[annotation, AfterValidator(validator)]++ allowed: t.Optional[t.Tuple[t.Any, ...]] = None+ if "const" in schema and "enum" in schema:+ # Both keywords assert independently, so only their intersection is+ # acceptable; a const outside the enum makes the schema unsatisfiable.+ allowed = tuple(+ candidate+ for candidate in (schema["const"],)+ if any(_json_values_equal(candidate, member) for member in schema["enum"])+ )+ elif "const" in schema:+ allowed = (schema["const"],)+ elif "enum" in schema:+ allowed = tuple(schema["enum"])++ if allowed is not None:+ if not allowed:+ return _UnsatisfiableSchema+ annotation = t.Annotated[+ annotation,+ AfterValidator(_allowed_values_validator(allowed)),+ ]++ return t.cast(t.Type[t.Any], annotation)+++def _schema_for_exact_validation(value: t.Any) -> t.Any:+ """Turn internal boolean-schema markers back into JSON Schema values.++ Conversion replaces the literal ``false`` with `_UnsatisfiableSchema`; the+ `jsonschema` validator needs the original ``false`` back.+ """+ if _is_unsatisfiable_schema(value):+ return False+ if isinstance(value, dict):+ return {key: _schema_for_exact_validation(item) for key, item in value.items()}+ if isinstance(value, list):+ return [_schema_for_exact_validation(item) for item in value]+ return value+++_EXACT_SCHEMA_MAP_KEYWORDS = frozenset(+ {+ "$defs",+ "definitions",+ "dependencies",+ "patternProperties",+ "properties",+ }+)+_EXACT_SCHEMA_ARRAY_KEYWORDS = frozenset({"allOf", "anyOf", "oneOf"})+_EXACT_SCHEMA_VALUE_KEYWORDS = frozenset(+ {+ "additionalItems",+ "additionalProperties",+ "contains",+ "else",+ "if",+ "items",+ "not",+ "propertyNames",+ "then",+ }+)++_REQUIRES_WHOLE_SCHEMA_VALIDATION = frozenset(+ {+ "$ref",+ "additionalItems",+ "contains",+ "dependencies",+ "else",+ "if",+ "maxItems",+ "maxProperties",+ "minItems",+ "minProperties",+ "not",+ "propertyNames",+ "required",+ "then",+ "uniqueItems",+ }+)+++def _contains_compound_literal(schema: t.Dict[str, t.Any]) -> bool:+ values: t.List[t.Any] = []+ if "const" in schema:+ values.append(schema["const"])+ enum = schema.get("enum")+ if isinstance(enum, list):+ values.extend(enum)+ return any(isinstance(value, (dict, list)) for value in values)+++def _one_of_needs_exact_validation(options: t.Any) -> bool:+ """Return whether two oneOf branches can accept the same JSON type."""+ if not isinstance(options, list) or len(options) < 2:+ return False++ branch_types: t.List[t.Set[str]] = []+ all_types = {"array", "boolean", "integer", "null", "number", "object", "string"}+ for option in options:+ if option is True or not isinstance(option, dict) or "type" not in option:+ branch_types.append(set(all_types))+ continue+ if option is False:+ branch_types.append(set())+ continue+ declared = option["type"]+ types = {declared} if isinstance(declared, str) else set(declared)+ if "number" in types:+ types.add("integer")+ branch_types.append(types)++ return any(+ left.intersection(right)+ for index, left in enumerate(branch_types)+ for right in branch_types[index + 1 :]+ )+++def _combiner_has_assertion_siblings(schema: t.Dict[str, t.Any], keyword: str) -> bool:+ return bool(_ASSERTION_KEYWORDS.intersection(schema) - {keyword})+++def _requires_whole_schema_validation(schema: t.Any) -> bool:+ """Whether the materializing converter needs an authoritative final guard.++ True when the schema (or any nested schema) uses a keyword that Pydantic+ field constraints cannot express faithfully: `required`, `contains`,+ `if`/`then`/`else`, `not`, `$ref`, unions (which Pydantic coerces across),+ and so on. Those schemas get a Draft 7 check on the raw value first.+ """+ if isinstance(schema, bool) or not isinstance(schema, dict):+ return False+ if (+ _REQUIRES_WHOLE_SCHEMA_VALIDATION.intersection(schema)+ or "allOf" in schema+ or (+ schema.get("type") is None+ and _TYPELESS_TYPE_SCOPED_KEYWORDS.intersection(schema)+ )+ # Pydantic unions coerce across members (`True` satisfies `integer |+ # null`), so every combiner needs the exact check, not only those with+ # sibling assertions or overlapping branches.+ or "anyOf" in schema+ or "oneOf" in schema+ or _contains_compound_literal(schema)+ ):+ return True++ for key, child in schema.items():+ if key in _EXACT_SCHEMA_MAP_KEYWORDS and isinstance(child, dict):+ if any(+ _requires_whole_schema_validation(value) for value in child.values()+ ):+ return True+ elif key in _EXACT_SCHEMA_ARRAY_KEYWORDS and isinstance(child, list):+ if any(_requires_whole_schema_validation(value) for value in child):+ return True+ elif key in _EXACT_SCHEMA_VALUE_KEYWORDS:+ values = child if isinstance(child, list) else [child]+ if any(_requires_whole_schema_validation(value) for value in values):+ return True++ return False+++def _needs_permissive_materialization(+ schema: t.Any,+ visited: t.Optional[t.Set[int]] = None,+) -> bool:+ """Detect schemas whose exact validator must not pipe into a narrower type.++ For `$ref`, `allOf`, and typeless assertions the Pydantic type the library+ builds can be narrower than what the schema accepts. Once the Draft 7 check+ has accepted the raw value, it is passed through as `t.Any` rather than+ risk a second, stricter rejection or a lossy coercion.+ """+ if isinstance(schema, bool) or not isinstance(schema, dict):+ return False+ if visited is None:+ visited = set()+ if id(schema) in visited:+ return False+ visited.add(id(schema))++ if "$ref" in schema or "allOf" in schema:+ return True+ if schema.get("type") is None and (+ _TYPELESS_TYPE_SCOPED_KEYWORDS.intersection(schema)+ or {"if", "then", "else", "not"}.intersection(schema)+ ):+ return True+ for key, child in schema.items():+ if key in _EXACT_SCHEMA_MAP_KEYWORDS and isinstance(child, dict):+ if any(+ _needs_permissive_materialization(value, visited)+ for value in child.values()+ ):+ return True+ elif key in _EXACT_SCHEMA_ARRAY_KEYWORDS and isinstance(child, list):+ if any(+ _needs_permissive_materialization(value, visited) for value in child+ ):+ return True+ elif key in _EXACT_SCHEMA_VALUE_KEYWORDS:+ values = child if isinstance(child, list) else [child]+ if any(+ _needs_permissive_materialization(value, visited) for value in values+ ):+ return True+ return False+++def _relax_exact_model_fields(+ schema: t.Dict[str, t.Any],+ base_model: t.Type[BaseModel],+) -> t.Type[BaseModel]:+ """Let exact source validation own fields the library would over-narrow."""+ properties = schema.get("properties")+ if not isinstance(properties, dict):+ return base_model++ field_definitions = {}+ for internal_name, model_field in base_model.model_fields.items():+ external_name = (+ model_field.alias if isinstance(model_field.alias, str) else internal_name+ )+ property_schema = properties.get(external_name)+ if not _needs_permissive_materialization(property_schema):+ continue++ default = ... if model_field.is_required() else model_field.default+ field_definitions[internal_name] = (+ t.Any,+ Field(+ default,+ alias=model_field.alias,+ description=model_field.description,+ examples=model_field.examples,+ title=model_field.title,+ ),+ )++ if not field_definitions:+ return base_model+ return create_pydantic_model( # type: ignore[call-overload]+ base_model.__name__,+ __base__=base_model,+ **field_definitions,+ )+++def _normalize_draft4_exclusive_bounds(value: t.Any) -> t.Any:+ """Translate OpenAPI 3.0 boolean bounds without changing nearby keywords."""+ if isinstance(value, bool) or not isinstance(value, dict):+ return value++ normalized: t.Dict[str, t.Any] = {}+ for key, child in value.items():+ if key in _EXACT_SCHEMA_MAP_KEYWORDS and isinstance(child, dict):+ normalized[key] = {+ name: _normalize_draft4_exclusive_bounds(schema)+ for name, schema in child.items()+ }+ elif key in _EXACT_SCHEMA_ARRAY_KEYWORDS and isinstance(child, list):+ normalized[key] = [+ _normalize_draft4_exclusive_bounds(schema) for schema in child+ ]+ elif key in _EXACT_SCHEMA_VALUE_KEYWORDS:+ if isinstance(child, list):+ normalized[key] = [+ _normalize_draft4_exclusive_bounds(schema) for schema in child+ ]+ else:+ normalized[key] = _normalize_draft4_exclusive_bounds(child)+ else:+ # Values under enum/const/default/examples are instance data, not+ # schemas, and must remain byte-for-byte equivalent.+ normalized[key] = child++ if normalized.get("exclusiveMinimum") is True and _is_numeric(+ normalized.get("minimum")+ ):+ normalized["exclusiveMinimum"] = normalized.pop("minimum")+ elif isinstance(normalized.get("exclusiveMinimum"), bool):+ normalized.pop("exclusiveMinimum")++ if normalized.get("exclusiveMaximum") is True and _is_numeric(+ normalized.get("maximum")+ ):+ normalized["exclusiveMaximum"] = normalized.pop("maximum")+ elif isinstance(normalized.get("exclusiveMaximum"), bool):+ normalized.pop("exclusiveMaximum")++ return normalized+++def _exact_validation_multiple_of(+ _validator: t.Any,+ multiple: t.Any,+ instance: t.Any,+ _schema: t.Any,+) -> t.Iterator[t.Any]:+ if _is_numeric(instance) and not _is_json_multiple_of(instance, multiple):+ yield jsonschema_exceptions.ValidationError(+ f"{instance!r} is not a multiple of {multiple!r}"+ )+++_PATTERN_MATCHER_CACHE: t.Dict[str, t.Optional[t.Callable[[str], bool]]] = {}+++def _pattern_matcher(pattern: str) -> t.Optional[t.Callable[[str], bool]]:+ """Match `pattern` with pydantic's linear-time Rust regex when it can+ compile it, falling back to Python `re` only for ECMA-only constructs."""+ if pattern in _PATTERN_MATCHER_CACHE:+ return _PATTERN_MATCHER_CACHE[pattern]+ matcher: t.Optional[t.Callable[[str], bool]] = None+ if _pattern_supported_by_pydantic(pattern):+ adapter = TypeAdapter(t.Annotated[str, Field(pattern=pattern)])++ def match_with_pydantic(value: str) -> bool:+ try:+ adapter.validate_python(value, strict=True)+ except ValidationError:+ return False+ return True++ matcher = match_with_pydantic+ else:+ compiled = _compile_pattern(pattern)+ if compiled is not None:++ def match_with_re(value: str) -> bool:+ return compiled.search(value) is not None++ matcher = match_with_re+ _PATTERN_MATCHER_CACHE[pattern] = matcher+ return matcher+++def _exact_validation_pattern(+ _validator: Validator,+ pattern: t.Any,+ instance: t.Any,+ _schema: t.Any,+) -> t.Iterator[t.Any]:+ if not isinstance(instance, str) or not isinstance(pattern, str):+ return+ matcher = _pattern_matcher(pattern)+ if matcher is not None and not matcher(instance):+ yield jsonschema_exceptions.ValidationError(+ f"{instance!r} does not match {pattern!r}"+ )+++# A bare registry resolves only references inside the schema document and+# raises on anything else; jsonschema's default registry falls back to+# fetching unknown URIs over the network.+_LOCAL_ONLY_REGISTRY: Registry[t.Any] = Registry()+++def _reject_external_references(schema: t.Any) -> None:+ """Fail at conversion time on any `$ref` that is not a local JSON Pointer.++ Only schema positions are walked; `const`, `default`, `enum`, and+ `examples` hold instance data.+ """+ if isinstance(schema, list):+ for item in schema:+ _reject_external_references(item)+ return+ if not isinstance(schema, dict):+ return+ reference = schema.get("$ref")+ if isinstance(reference, str) and not reference.startswith("#"):+ raise ValueError(+ f"External schema reference {reference!r} is not supported; "+ "only local references (#/...) are resolved"+ )+ for keyword, value in schema.items():+ if keyword in _SCHEMA_VALUED_KEYWORDS or keyword in _SCHEMA_LIST_KEYWORDS:+ _reject_external_references(value)+ elif keyword in _SCHEMA_MAP_KEYWORDS:+ if isinstance(value, dict):+ for entry in value.values():+ _reject_external_references(entry)+ elif keyword == "items":+ _reject_external_references(value)+ elif keyword == "dependencies" and isinstance(value, dict):+ for entry in value.values():+ if isinstance(entry, (dict, bool)):+ _reject_external_references(entry)+++def _is_closed_object_branch(branch: t.Any) -> bool:+ return (+ isinstance(branch, dict)+ and isinstance(branch.get("properties"), dict)+ and len(branch["properties"]) > 0+ and "additionalProperties" not in branch+ and "patternProperties" not in branch+ and "$ref" not in branch+ )+++def _close_all_of_branches(schema: t.Any) -> t.Any:+ """Apply the omitted-`additionalProperties` strictness rule once per `allOf`.++ Draft 7 already lets sibling object branches accept each other's keys, so+ the exact validator only needs the strictness a lone named-property object+ would have had: the union of every branch's declared keys, applied at the+ `allOf` node. Mirrors `parseAllOf` in @composio/json-schema-to-zod and+ `openAllOfBranches` in @composio/json-schema-to-effect-schema.+ """+ if isinstance(schema, list):+ return [_close_all_of_branches(item) for item in schema]+ if not isinstance(schema, dict):+ return schema++ result: t.Dict[str, t.Any] = {}+ for key, value in schema.items():+ if key in _EXACT_SCHEMA_MAP_KEYWORDS and isinstance(value, dict):+ result[key] = {+ name: _close_all_of_branches(child) for name, child in value.items()+ }+ elif key in _EXACT_SCHEMA_ARRAY_KEYWORDS or key in _EXACT_SCHEMA_VALUE_KEYWORDS:+ result[key] = _close_all_of_branches(value)+ else:+ result[key] = value++ branches = schema.get("allOf")+ if (+ isinstance(branches, list)+ and len(branches) >= 2+ and all(_is_closed_object_branch(branch) for branch in branches)+ and not {"properties", "patternProperties", "additionalProperties"}+ & set(schema)+ ):+ result["properties"] = {+ name: True for branch in branches for name in branch["properties"]+ }+ result["additionalProperties"] = False+ return result+++def _validate_json_schema(+ schema: t.Dict[str, t.Any],+ root_schema: t.Dict[str, t.Any],+) -> t.Callable[[t.Any], t.Any]:+ """Compile an exact JSON Schema acceptance check for a Pydantic model."""+ validation_schema = _close_all_of_branches(+ _normalize_draft4_exclusive_bounds(_schema_for_exact_validation(schema))+ )+ validation_root = _close_all_of_branches(+ _normalize_draft4_exclusive_bounds(_schema_for_exact_validation(root_schema))+ )+ _reject_external_references(validation_root)+ _reject_external_references(validation_schema)+ # The SDK contract is Draft 7 plus the OpenAPI 3.0 boolean spelling for+ # exclusive bounds. Falling the entire document back to Draft 4 would make+ # `contains`, `const`, `if`/`then`/`else`, and `propertyNames` disappear.+ validator_class = jsonschema_validators.Draft7Validator+ # Align multipleOf with the decimal-scaled checks in the Zod and Effect+ # converters instead of raw float modulo.+ # `pattern` goes through pydantic's Rust regex where possible so a+ # backtracking pattern cannot stall validation (Python `re` is exponential+ # on inputs such as `(a+)+$`).+ validator_class = jsonschema_validators.extend(+ validator_class,+ {+ "multipleOf": _exact_validation_multiple_of,+ "pattern": _exact_validation_pattern,+ },+ )+ validator = validator_class(+ validation_root,+ registry=_LOCAL_ONLY_REGISTRY,+ ).evolve(schema=validation_schema)++ def validate(value: t.Any) -> t.Any:+ error = next(validator.iter_errors(value), None)+ if error is not None:+ location = ".".join(str(part) for part in error.path)+ message = f"{location}: {error.message}" if location else error.message+ raise ValueError(message)+ return value++ return validate+++def _with_exact_validation_annotation(+ annotation: t.Any,+ schema: t.Dict[str, t.Any],+ root_schema: t.Dict[str, t.Any],+) -> t.Type[t.Any]:+ """Validate the raw value before Pydantic coercion or default handling."""+ validate_schema = _validate_json_schema(schema, root_schema)+ return t.cast(+ t.Type[t.Any],+ t.Annotated[annotation, BeforeValidator(validate_schema)],+ )+++def _with_exact_validation(+ model: t.Type[BaseModel],+ schema: t.Dict[str, t.Any],+ root_schema: t.Dict[str, t.Any],+) -> t.Type[t.Any]:+ """Keep model materialization while enforcing the source schema first."""+ validate_schema = _validate_json_schema(schema, root_schema)++ def validate_source_schema(cls, value: t.Any) -> t.Any:+ return validate_schema(value)++ validator = model_validator(mode="before")(+ t.cast(t.Any, classmethod(validate_source_schema))+ )++ name = model.__name__+ return t.cast(+ t.Type[BaseModel],+ type(+ name,+ (model,),+ {+ "__module__": __name__,+ "__qualname__": name,+ "_validate_source_schema": validator,+ },+ ),+ )def _convert_object_with_unsatisfiable_properties(@@ -1083,7 +2059,7 @@ def _convert_object_with_unsatisfiable_properties(],}base_model = create_model_from_schema(- base_schema,+ _normalize_schema_for_library(base_schema),allow_undefined_array_items=True,allow_undefined_type=True,)@@ -1118,6 +2094,130 @@ def _convert_object_with_unsatisfiable_properties()+_TYPE_ARRAY_CHILD_KEYWORDS_MAPS = (+ "properties",+ "patternProperties",+ "$defs",+ "definitions",+)+_TYPE_ARRAY_CHILD_KEYWORDS_LISTS = ("anyOf", "allOf", "oneOf")+_TYPE_ARRAY_CHILD_KEYWORDS_SCHEMAS = (+ "items",+ "additionalItems",+ "additionalProperties",+ "contains",+ "propertyNames",+ "not",+ "if",+ "then",+ "else",+)+++_PYDANTIC_PATTERN_SUPPORT_CACHE: t.Dict[str, bool] = {}+++def _pattern_supported_by_pydantic(pattern: str) -> bool:+ cached = _PYDANTIC_PATTERN_SUPPORT_CACHE.get(pattern)+ if cached is not None:+ return cached+ try:+ TypeAdapter(t.Annotated[str, Field(pattern=pattern)])+ supported = True+ except Exception: # noqa: BLE001 - pydantic raises SchemaError subclasses+ supported = False+ _PYDANTIC_PATTERN_SUPPORT_CACHE[pattern] = supported+ return supported+++def _normalize_schema_for_library(schema: t.Any) -> t.Any:+ """Rewrite constructs the json-schema-to-pydantic library mishandles.++ - `type: [...]` becomes an equivalent `anyOf` of single-type schemas: the+ library applies every sibling constraint to every union member, so+ `{"type": ["string", "number"], "minLength": 2, "minimum": 10}` raises+ `TypeError` at validation time when a valid string hits the numeric+ constraint. Scoping constraints per member is semantically identical+ under Draft 7 (mismatched-type keywords are ignored).+ - `pattern` values the Rust regex crate rejects (ECMA look-around) are+ dropped from the library input; the exact-validation layer still+ enforces them through Python `re`.+ """+ if not isinstance(schema, dict):+ return schema++ result: t.Dict[str, t.Any] = {}+ for key, value in schema.items():+ if key in _TYPE_ARRAY_CHILD_KEYWORDS_MAPS and isinstance(value, dict):+ result[key] = {+ name: _normalize_schema_for_library(child)+ for name, child in value.items()+ }+ elif key in _TYPE_ARRAY_CHILD_KEYWORDS_LISTS and isinstance(value, list):+ result[key] = [_normalize_schema_for_library(child) for child in value]+ elif key in _TYPE_ARRAY_CHILD_KEYWORDS_SCHEMAS:+ result[key] = _normalize_schema_for_library(value)+ else:+ result[key] = value++ pattern = result.get("pattern")+ if isinstance(pattern, str) and not _pattern_supported_by_pydantic(pattern):+ del result["pattern"]++ # Draft-4 boolean exclusive flags: the library reads the boolean itself as+ # the numeric bound (lt=True becomes "less than 1"). Translate them to the+ # Draft 7 numeric spelling before the library sees them.+ if result.get("exclusiveMinimum") is True and _is_numeric(result.get("minimum")):+ result["exclusiveMinimum"] = result.pop("minimum")+ elif isinstance(result.get("exclusiveMinimum"), bool):+ del result["exclusiveMinimum"]+ if result.get("exclusiveMaximum") is True and _is_numeric(result.get("maximum")):+ result["exclusiveMaximum"] = result.pop("maximum")+ elif isinstance(result.get("exclusiveMaximum"), bool):+ del result["exclusiveMaximum"]++ # A one-member type array is the same as the bare type, and collapsing it+ # lets the constraint scoping below apply.+ if isinstance(result.get("type"), list) and len(result["type"]) == 1:+ result["type"] = result["type"][0]++ # The library applies scalar keywords unconditionally, so a keyword that+ # does not scope to the declared type (or any keyword on a typeless+ # schema) raises TypeError at validation time on mismatched instances.+ # Drop them from the library input; the exact-validation layer that wraps+ # every object conversion still enforces them per Draft 7.+ declared_type = result.get("type")+ if isinstance(declared_type, str):+ scoped_keywords = _TYPE_SCOPED_KEYWORDS.get(declared_type)+ if scoped_keywords is not None:+ for keyword in _SCALAR_CONSTRAINT_KEYWORDS - scoped_keywords:+ result.pop(keyword, None)+ elif declared_type is None:+ for keyword in _SCALAR_CONSTRAINT_KEYWORDS:+ result.pop(keyword, None)++ type_ = result.get("type")+ if not isinstance(type_, list) or len(type_) < 2:+ return result++ members = []+ for member in type_:+ member_schema: t.Dict[str, t.Any] = {"type": member}+ scoped = _TYPE_SCOPED_KEYWORDS.get(member, frozenset())+ for keyword in scoped | _TYPE_ARRAY_SHARED_KEYWORDS:+ if keyword in result:+ member_schema[keyword] = result[keyword]+ members.append(member_schema)++ wrapper: t.Dict[str, t.Any] = {+ key: value+ for key, value in result.items()+ if key in _TYPE_ARRAY_WRAPPER_KEYWORDS+ }+ wrapper["anyOf"] = members+ return wrapper++def _convert_with_library(schema: t.Dict[str, t.Any],*,@@ -1137,18 +2237,30 @@ def _convert_with_library()except (SchemaError, CombinerError) as e:logger.debug(- f"Library schema conversion failed: {e}, falling back to string"+ f"Library schema conversion failed: {e}, preserving exact validation"+ )+ return _with_exact_validation_annotation(+ t.Any,+ schema,+ document_root,)- return strexcept Exception as e:logger.debug(- f"Unexpected error in schema conversion: {e}, falling back to string"+ f"Unexpected error in schema conversion: {e}, preserving exact validation")- return str- return apply_object_policy(+ return _with_exact_validation_annotation(+ t.Any,+ schema,+ document_root,+ )+ return _with_exact_validation(+ apply_object_policy(+ schema,+ _apply_nested_object_policies(schema, base_model, document_root),+ root_schema=document_root,+ ),schema,- _apply_nested_object_policies(schema, base_model, document_root),- root_schema=document_root,+ document_root,)# A property-less object with no dynamic-key constraints accepts and# preserves arbitrary content. Modelling it as an empty Pydantic@@ -1160,25 +2272,38 @@ def _convert_with_library(try:base_model = create_model_from_schema(- schema,+ _normalize_schema_for_library(schema),allow_undefined_array_items=True,allow_undefined_type=True,)except (SchemaError, CombinerError) as e:logger.debug(- f"Library schema conversion failed: {e}, falling back to string"+ f"Library schema conversion failed: {e}, preserving exact validation"+ )+ return _with_exact_validation_annotation(+ t.Any,+ schema,+ document_root,)- return strexcept Exception as e:logger.debug(- f"Unexpected error in schema conversion: {e}, falling back to string"+ f"Unexpected error in schema conversion: {e}, preserving exact validation"+ )+ return _with_exact_validation_annotation(+ t.Any,+ schema,+ document_root,)- return str- return apply_object_policy(+ base_model = _relax_exact_model_fields(schema, base_model)+ return _with_exact_validation(+ apply_object_policy(+ schema,+ _apply_nested_object_policies(schema, base_model, document_root),+ root_schema=document_root,+ ),schema,- _apply_nested_object_policies(schema, base_model, document_root),- root_schema=document_root,+ document_root,)try:@@ -1206,13 +2331,17 @@ def _convert_with_library(return _convert_simple_type(schema)except (SchemaError, CombinerError) as e:- logger.debug(f"Library schema conversion failed: {e}, falling back to string")- return str+ logger.debug(+ f"Library schema conversion failed: {e}, preserving exact validation"+ )+ document_root = root_schema if root_schema is not None else schema+ return _with_exact_validation_annotation(t.Any, schema, document_root)except Exception as e:logger.debug(- f"Unexpected error in schema conversion: {e}, falling back to string"+ f"Unexpected error in schema conversion: {e}, preserving exact validation")- return str+ document_root = root_schema if root_schema is not None else schema+ return _with_exact_validation_annotation(t.Any, schema, document_root)def _handle_toplevel_combiner(@@ -1228,14 +2357,34 @@ def _handle_toplevel_combiner(try:# Try direct conversion - library handles anyOf/oneOf/allOf at top levelresult = create_model_from_schema(- schema,+ _normalize_schema_for_library(schema),allow_undefined_array_items=True,allow_undefined_type=True,)if result is type(None):- return t.Optional[t.Any]- # If result is a type (like a Union or Optional), return it directly- # If result is a model class, return it+ return type(None)+ if "allOf" in schema:+ options = schema.get("allOf")+ requires_object = isinstance(options, list) and any(+ isinstance(option, dict) and option.get("type") == "object"+ for option in options+ )+ if (+ requires_object+ and isinstance(result, type)+ and issubclass(result, BaseModel)+ ):+ document_root = root_schema if root_schema is not None else schema+ return _with_exact_validation(result, schema, document_root)++ # The library models scalar intersections as object models.+ # Preserve the JSON value and let exact validation own acceptance.+ return t.Any+ # A library model for anyOf/oneOf drops sibling assertions such as+ # `required` and exclusive oneOf matching; let the source schema own it.+ if isinstance(result, type) and issubclass(result, BaseModel):+ document_root = root_schema if root_schema is not None else schema+ return _with_exact_validation(result, schema, document_root)return resultexcept (SchemaError, CombinerError):pass@@ -1277,7 +2426,7 @@ def _build_union_from_options(pydantic_types.append(ptype)if len(pydantic_types) == 0:- return t.Optional[t.Any] if has_null else _UnsatisfiableSchema # type: ignore+ return type(None) if has_null else _UnsatisfiableSchemaif len(pydantic_types) == 1:base_type = pydantic_types[0]diff --git a/python/composio/utils/shared.py b/python/composio/utils/shared.pyindex 37512dfca..d4ed0ffc5 100644--- a/python/composio/utils/shared.py+++ b/python/composio/utils/shared.py@@ -19,11 +19,12 @@ from composio.exceptions import InvalidParams, InvalidSchemaErrorfrom composio.utils.json_schema import dereference_json_schemafrom composio.utils.logging import get as get_loggerfrom composio.utils.schema_converter import (+ _EXPLICIT_DEFAULT_FIELDS_ATTRIBUTE,CONTAINER_TYPE,FALLBACK_VALUES,PYDANTIC_TYPE_TO_PYTHON_TYPE,- _EXPLICIT_DEFAULT_FIELDS_ATTRIBUTE,_mark_explicit_default_fields,+ _with_exact_validation,apply_object_policy,json_schema_to_pydantic_type,)@@ -471,7 +472,7 @@ def _coerce_default_value(def json_schema_to_pydantic_field(name: str,- json_schema: t.Dict[str, t.Any],+ json_schema: t.Union[t.Dict[str, t.Any], bool],required: t.List[str],skip_default: bool = False,*,@@ -486,19 +487,23 @@ def json_schema_to_pydantic_field(:param root_schema: Full schema document used to resolve local references.:return: A Pydantic field definition."""- description = json_schema.get("description")- if "oneOf" in json_schema:+ # A property schema may be the literal `true`/`false` (JSON Schema+ # draft-06+); those carry no metadata, so read annotations from an empty+ # object and let `json_schema_to_pydantic_type` decide the type.+ schema_object = json_schema if isinstance(json_schema, dict) else {}+ description = schema_object.get("description")+ if "oneOf" in schema_object:description = " | ".join(- [option.get("description", "") for option in json_schema["oneOf"]]+ [option.get("description", "") for option in schema_object["oneOf"]])description = f"Any of the following options(separated by |): {description}"- examples = json_schema.get("examples", [])- default = json_schema.get("default")+ examples = schema_object.get("examples", [])+ default = schema_object.get("default")# Coerce default value to match expected type from schemaif default is not None:- default = _coerce_default_value(default, json_schema)+ default = _coerce_default_value(default, schema_object)# Check if the field name is a reserved Pydantic nameoriginal_name = name@@ -588,10 +593,17 @@ def json_schema_to_model(setattr(base_model, _EXPLICIT_DEFAULT_FIELDS_ATTRIBUTE, frozenset())else:_mark_explicit_default_fields(base_model, json_schema, json_schema)- return apply_object_policy(+ # Exact acceptance is shared with `json_schema_to_pydantic_type` so every+ # Python entry point agrees with the Zod and Effect converters about which+ # inputs a schema admits.+ return _with_exact_validation(+ apply_object_policy(+ json_schema,+ base_model,+ model_name=model_name,+ ),+ json_schema,json_schema,- base_model,- model_name=model_name,)@@ -616,41 +628,27 @@ def pydantic_model_from_param_schema(param_schema: t.Dict) -> t.Type:required_props = param_schema.get("required", [])if param_schema.get("type") == "array":- # print("param_schema inside array - ", param_schema)- item_schema = param_schema.get("items")- if item_schema:- ItemType = t.cast(- t.Type,- json_schema_to_pydantic_type(- json_schema=item_schema,- ),- )- return t.List[ItemType] # type: ignore- return t.List+ return t.cast(t.Type, json_schema_to_pydantic_type(param_schema))for prop_name, prop_info in param_schema.get("properties", {}).items():- prop_type = prop_info.get("type")- prop_title = prop_info.get("title", prop_name).replace(" ", "")- prop_default = prop_info.get("default", FALLBACK_VALUES.get(prop_type))- if (- prop_type is not None- and prop_type in PYDANTIC_TYPE_TO_PYTHON_TYPE- and prop_type not in CONTAINER_TYPE- ):- signature_prop_type = PYDANTIC_TYPE_TO_PYTHON_TYPE[prop_type]- elif prop_type is None:- # Schema uses anyOf/allOf/oneOf/$ref instead of a top-level "type" key.- # Delegate to json_schema_to_pydantic_type which handles all combiners.- signature_prop_type = t.cast(- t.Type,- json_schema_to_pydantic_type(json_schema=prop_info),- )- else:- signature_prop_type = pydantic_model_from_param_schema(prop_info)+ prop_object = prop_info if isinstance(prop_info, dict) else {}+ prop_type = prop_object.get("type")+ prop_title = prop_object.get("title", prop_name).replace(" ", "")+ fallback = (+ FALLBACK_VALUES.get(prop_type) if isinstance(prop_type, str) else None+ )+ prop_default = prop_object.get("default", fallback)+ signature_prop_type = t.cast(+ t.Type,+ json_schema_to_pydantic_type(+ json_schema=prop_info,+ root_schema=param_schema,+ ),+ )field_kwargs = {- "description": prop_info.get(- "description", prop_info.get("desc", prop_title)+ "description": prop_object.get(+ "description", prop_object.get("desc", prop_title)),}@@ -673,13 +671,17 @@ def pydantic_model_from_param_schema(param_schema: t.Dict) -> t.Type:)if not required_fields and not optional_fields:- return t.Dict+ # Nothing to materialize: let the shared converter pick the annotation+ # so `allOf`/`anyOf`/`$ref` and typeless assertions keep the same exact+ # validation and permissive materialization as the other entry points.+ return t.cast(t.Type, json_schema_to_pydantic_type(param_schema))- return create_model( # type: ignore+ model = create_model( # type: ignoreparam_title,**required_fields,**optional_fields,)+ return _with_exact_validation(model, param_schema, param_schema)def get_signature_format_from_schema_params(diff --git a/python/providers/gemini/composio_gemini/provider.py b/python/providers/gemini/composio_gemini/provider.pyindex 0a33e10d5..b463be141 100644--- a/python/providers/gemini/composio_gemini/provider.py+++ b/python/providers/gemini/composio_gemini/provider.py@@ -9,6 +9,8 @@ import types as pytypesimport typing as tfrom inspect import Parameter, Signature+from pydantic import BaseModel+from composio.client.types import Toolfrom composio.core.provider import AgenticProviderfrom composio.core.provider.agentic import AgenticProviderExecuteFn@@ -16,7 +18,9 @@ from composio.utils.shared import (ToolSchemaAliases,alias_tool_input_schema,get_pydantic_signature_format_from_schema_params,+ json_schema_to_model,normalize_tool_arguments,+ validate_and_serialize_tool_arguments,)# google-genai is only needed for handle_response (backward compat)@@ -83,7 +87,8 @@ class GeminiProvider(AgenticProvider[t.Callable, list[t.Callable]], name="geminidef __init__(self, **kwargs: t.Any):super().__init__(**kwargs)self._executors: t.Dict[- str, t.Tuple[AgenticProviderExecuteFn, ToolSchemaAliases]+ str,+ t.Tuple[AgenticProviderExecuteFn, ToolSchemaAliases, t.Type[BaseModel]],] = {}def wrap_tool(@@ -100,14 +105,21 @@ class GeminiProvider(AgenticProvider[t.Callable, list[t.Callable]], name="gemini2. Store it in the AFC ``function_map`` for automatic execution"""aliases = alias_tool_input_schema(schema=tool.input_parameters)- self._executors[tool.slug] = (execute_tool, aliases)+ args_schema = json_schema_to_model(+ aliases.schema,+ skip_default=self.skip_default,+ )+ self._executors[tool.slug] = (execute_tool, aliases, args_schema)def function(**kwargs: t.Any) -> t.Dict:"""Composio tool execution wrapper."""kwargs = _to_serializable(kwargs)+ kwargs = validate_and_serialize_tool_arguments(+ args_schema,+ normalize_tool_arguments(kwargs),+ )kwargs = aliases.restore_arguments(kwargs)- # Normalize defensively so a stringified payload is coerced to a dict (issue #2406).- result = execute_tool(tool.slug, normalize_tool_arguments(kwargs))+ result = execute_tool(tool.slug, kwargs)return _process_execution_result(result)# Create a real function object (passes inspect.isfunction)@@ -186,11 +198,14 @@ class GeminiProvider(AgenticProvider[t.Callable, list[t.Callable]], name="geminiif fc.name not in self._executors:continue- execute_tool, aliases = self._executors[fc.name]- arguments = aliases.restore_arguments(dict(fc.args))- result = execute_tool(- slug=fc.name, arguments=normalize_tool_arguments(arguments)+ # Same validate -> serialize -> alias sequence as the AFC callable.+ execute_tool, aliases, args_schema = self._executors[fc.name]+ arguments = validate_and_serialize_tool_arguments(+ args_schema,+ normalize_tool_arguments(_to_serializable(dict(fc.args))),)+ arguments = aliases.restore_arguments(arguments)+ result = execute_tool(slug=fc.name, arguments=arguments)processed = _process_execution_result(result)function_responses.append(diff --git a/python/pyproject.toml b/python/pyproject.tomlindex d67a42872..7c7edc9bf 100644--- a/python/pyproject.toml+++ b/python/pyproject.toml@@ -34,6 +34,7 @@ dev = ["pytest>=9.1.1","pytest-timeout>=2.4.0","pytest-mock>=3.15.1",+ "hypothesis>=6.140.3","requests>=2.34.2","ruff>=0.16.0",# Langchain provider demodiff --git a/python/tests/fixtures/json-schema-conversion/object-cases.json b/python/tests/fixtures/json-schema-conversion/object-cases.jsonindex 8f85ec595..3c9ef6a60 100644--- a/python/tests/fixtures/json-schema-conversion/object-cases.json+++ b/python/tests/fixtures/json-schema-conversion/object-cases.json@@ -645,6 +645,333 @@}]},+ {+ "id": "primitive-boolean-property-schemas",+ "description": "Boolean property schemas accept every value for true and reject every supplied value for false.",+ "schema": {+ "type": "object",+ "properties": { "allowed": true, "forbidden": false },+ "required": ["allowed"]+ },+ "instances": [+ { "input": { "allowed": { "nested": 1 } }, "accepted": true },+ { "input": { "allowed": 42, "forbidden": "present" }, "accepted": false }+ ]+ },+ {+ "id": "primitive-empty-and-null-schemas",+ "description": "An empty schema accepts any value while a pure null schema accepts only null.",+ "schema": {+ "type": "object",+ "properties": { "anything": {}, "nullOnly": { "type": "null" } },+ "required": ["anything", "nullOnly"]+ },+ "instances": [+ { "input": { "anything": 42, "nullOnly": null }, "accepted": true },+ { "input": { "anything": null, "nullOnly": "not-null" }, "accepted": false }+ ]+ },+ {+ "id": "primitive-type-array-union",+ "description": "Every member of a JSON Schema type array remains accepted.",+ "schema": {+ "type": "object",+ "properties": { "value": { "type": ["string", "integer", "null"] } },+ "required": ["value"]+ },+ "instances": [+ { "input": { "value": "ready" }, "accepted": true },+ { "input": { "value": 2 }, "accepted": true },+ { "input": { "value": null }, "accepted": true },+ { "input": { "value": true }, "accepted": false }+ ]+ },+ {+ "id": "primitive-enum-intersects-declared-type",+ "description": "Enum values cannot bypass the schema's declared JSON type.",+ "schema": {+ "type": "object",+ "properties": { "value": { "type": "string", "enum": [1, "ready"] } },+ "required": ["value"]+ },+ "instances": [+ { "input": { "value": "ready" }, "accepted": true },+ { "input": { "value": 1 }, "accepted": false },+ { "input": { "value": "other" }, "accepted": false }+ ]+ },+ {+ "id": "primitive-null-only-unions",+ "description": "A union containing only null accepts only null.",+ "schema": {+ "type": "object",+ "properties": {+ "typeArray": { "type": ["null"] },+ "anyOf": { "anyOf": [{ "type": "null" }] }+ },+ "required": ["typeArray", "anyOf"]+ },+ "instances": [+ { "input": { "typeArray": null, "anyOf": null }, "accepted": true },+ { "input": { "typeArray": "anything", "anyOf": null }, "accepted": false },+ { "input": { "typeArray": null, "anyOf": 1 }, "accepted": false }+ ]+ },+ {+ "id": "primitive-scalar-constraints",+ "description": "String and numeric constraints survive conversion together.",+ "schema": {+ "type": "object",+ "properties": {+ "code": { "type": "string", "pattern": "^[A-Z]{2}$", "minLength": 2, "maxLength": 2 },+ "count": { "type": "number", "exclusiveMinimum": 0, "multipleOf": 2 }+ },+ "required": ["code", "count"]+ },+ "instances": [+ { "input": { "code": "OK", "count": 2 }, "accepted": true },+ { "input": { "code": "ok", "count": 2 }, "accepted": false },+ { "input": { "code": "OK", "count": 0 }, "accepted": false },+ { "input": { "code": "OK", "count": 3 }, "accepted": false }+ ]+ },+ {+ "id": "primitive-independent-numeric-bounds",+ "description": "Inclusive and numeric exclusive bounds apply independently under Draft 7.",+ "schema": {+ "type": "object",+ "properties": {+ "lower": { "type": "number", "minimum": 0, "exclusiveMinimum": 5 },+ "upper": { "type": "number", "maximum": 10, "exclusiveMaximum": 5 }+ },+ "required": ["lower", "upper"]+ },+ "instances": [+ { "input": { "lower": 6, "upper": 4 }, "accepted": true },+ { "input": { "lower": 1, "upper": 4 }, "accepted": false },+ { "input": { "lower": 6, "upper": 9 }, "accepted": false },+ { "input": { "lower": 5, "upper": 5 }, "accepted": false }+ ]+ },+ {+ "id": "primitive-const-intersects-declared-type",+ "description": "A const that conflicts with the declared type is unsatisfiable.",+ "schema": {+ "type": "object",+ "properties": { "value": { "type": "string", "const": 1 } },+ "required": ["value"]+ },+ "instances": [+ { "input": { "value": 1 }, "accepted": false },+ { "input": { "value": "1" }, "accepted": false }+ ]+ },+ {+ "id": "primitive-compound-enum-values",+ "description": "Enum values may contain any JSON value, including objects and arrays.",+ "schema": {+ "type": "object",+ "properties": {+ "value": { "enum": [{ "mode": "safe" }, ["ready", 1]] }+ },+ "required": ["value"]+ },+ "instances": [+ { "input": { "value": { "mode": "safe" } }, "accepted": true },+ { "input": { "value": ["ready", 1] }, "accepted": true },+ { "input": { "value": ["ready", true] }, "accepted": false },+ { "input": { "value": { "mode": true } }, "accepted": false },+ { "input": { "value": { "mode": "unsafe" } }, "accepted": false }+ ]+ },+ {+ "id": "primitive-const-null-and-false",+ "description": "Falsy consts keep their identity: null and false accept only themselves.",+ "schema": {+ "type": "object",+ "properties": { "maybe": { "const": null }, "flag": { "const": false } },+ "required": ["maybe", "flag"]+ },+ "instances": [+ { "input": { "maybe": null, "flag": false }, "accepted": true },+ { "input": { "maybe": null, "flag": 0 }, "accepted": false },+ { "input": { "maybe": "null", "flag": false }, "accepted": false }+ ]+ },+ {+ "id": "primitive-enum-boolean-number-identity",+ "description": "Enum membership distinguishes booleans from the numbers they equal in most host languages.",+ "schema": {+ "type": "object",+ "properties": { "bits": { "enum": [0, 1] }, "toggle": { "enum": [true] } },+ "required": ["bits", "toggle"]+ },+ "instances": [+ { "input": { "bits": 1, "toggle": true }, "accepted": true },+ { "input": { "bits": 0, "toggle": true }, "accepted": true },+ { "input": { "bits": true, "toggle": true }, "accepted": false },+ { "input": { "bits": 1, "toggle": 1 }, "accepted": false },+ { "input": { "bits": false, "toggle": true }, "accepted": false }+ ]+ },+ {+ "id": "primitive-enum-with-null-member",+ "description": "A null enum member is accepted alongside other literal values.",+ "schema": {+ "type": "object",+ "properties": { "value": { "enum": ["a", null] } },+ "required": ["value"]+ },+ "instances": [+ { "input": { "value": "a" }, "accepted": true },+ { "input": { "value": null }, "accepted": true },+ { "input": { "value": "b" }, "accepted": false }+ ]+ },+ {+ "id": "primitive-const-constraint-conjunction",+ "description": "A const must still satisfy sibling constraints; a conflict rejects everything.",+ "schema": {+ "type": "object",+ "properties": { "code": { "type": "string", "const": "a", "minLength": 2 } },+ "required": ["code"]+ },+ "instances": [+ { "input": { "code": "a" }, "accepted": false },+ { "input": { "code": "ab" }, "accepted": false }+ ]+ },+ {+ "id": "primitive-inclusive-numeric-boundaries",+ "description": "Draft 7 minimum and maximum are inclusive bounds.",+ "schema": {+ "type": "object",+ "properties": { "count": { "type": "integer", "minimum": 5, "maximum": 10 } },+ "required": ["count"]+ },+ "instances": [+ { "input": { "count": 5 }, "accepted": true },+ { "input": { "count": 10 }, "accepted": true },+ { "input": { "count": 4 }, "accepted": false },+ { "input": { "count": 11 }, "accepted": false }+ ]+ },+ {+ "id": "primitive-const-narrows-enum",+ "description": "When const and enum are both present, only their intersection is accepted.",+ "schema": {+ "type": "object",+ "properties": { "value": { "enum": ["a", "b"], "const": "b" } },+ "required": ["value"]+ },+ "instances": [+ { "input": { "value": "b" }, "accepted": true },+ { "input": { "value": "a" }, "accepted": false }+ ]+ },+ {+ "id": "primitive-compound-const-deep-equality",+ "description": "A compound const compares by deep JSON equality, including boolean identity inside containers.",+ "schema": {+ "type": "object",+ "properties": { "value": { "const": { "a": [1, "x", null] } } },+ "required": ["value"]+ },+ "instances": [+ { "input": { "value": { "a": [1, "x", null] } }, "accepted": true },+ { "input": { "value": { "a": [1, "x", null], "b": 1 } }, "accepted": false },+ { "input": { "value": { "a": [true, "x", null] } }, "accepted": false },+ { "input": { "value": { "a": [1, "x"] } }, "accepted": false }+ ]+ },+ {+ "id": "primitive-unicode-code-point-length",+ "description": "String length constraints count Unicode code points, not UTF-16 code units.",+ "schema": {+ "type": "object",+ "properties": { "glyph": { "type": "string", "maxLength": 1 } },+ "required": ["glyph"]+ },+ "instances": [+ { "input": { "glyph": "𝄞" }, "accepted": true },+ { "input": { "glyph": "ab" }, "accepted": false }+ ]+ },+ {+ "id": "primitive-typeless-constraint-scoping",+ "description": "Draft 7 applies string constraints to string instances even without a declared type.",+ "schema": {+ "type": "object",+ "properties": { "value": { "enum": ["a", "abc"], "minLength": 2 } },+ "required": ["value"]+ },+ "instances": [+ { "input": { "value": "abc" }, "accepted": true },+ { "input": { "value": "a" }, "accepted": false }+ ]+ },+ {+ "id": "primitive-float-multiple-of",+ "description": "Decimal multipleOf checks tolerate binary floating-point representation error.",+ "divergesFromJsonSchema": "A literal Draft 7 multipleOf uses raw float arithmetic and rejects 0.3 for 0.1; every Composio converter scales decimals before comparing.",+ "schema": {+ "type": "object",+ "properties": { "step": { "type": "number", "multipleOf": 0.1 } },+ "required": ["step"]+ },+ "instances": [+ { "input": { "step": 0.3 }, "accepted": true },+ { "input": { "step": 0.35 }, "accepted": false }+ ]+ },+ {+ "id": "primitive-draft4-boolean-exclusive-bounds",+ "description": "OpenAPI 3.0 style boolean exclusiveMinimum/exclusiveMaximum flags turn the paired bound exclusive.",+ "schema": {+ "type": "object",+ "properties": {+ "lower": { "type": "number", "minimum": 5, "exclusiveMinimum": true },+ "upper": { "type": "number", "maximum": 5, "exclusiveMaximum": true }+ },+ "required": ["lower", "upper"]+ },+ "instances": [+ { "input": { "lower": 6, "upper": 4 }, "accepted": true },+ { "input": { "lower": 5, "upper": 4 }, "accepted": false },+ { "input": { "lower": 6, "upper": 5 }, "accepted": false }+ ]+ },+ {+ "id": "primitive-type-array-constraint-scoping",+ "description": "Constraints on a type array apply only to instances of their matching type.",+ "schema": {+ "type": "object",+ "properties": {+ "value": { "type": ["string", "number"], "minLength": 2, "minimum": 10 }+ },+ "required": ["value"]+ },+ "instances": [+ { "input": { "value": "ab" }, "accepted": true },+ { "input": { "value": 15 }, "accepted": true },+ { "input": { "value": "a" }, "accepted": false },+ { "input": { "value": 5 }, "accepted": false },+ { "input": { "value": true }, "accepted": false }+ ]+ },+ {+ "id": "primitive-empty-enum-optional-property",+ "description": "An optional property with an empty enum rejects every supplied value but tolerates absence.",+ "schema": {+ "type": "object",+ "properties": { "value": { "enum": [] } },+ "required": []+ },+ "instances": [+ { "input": {}, "accepted": true },+ { "input": { "value": null }, "accepted": false }+ ]+ },{"id": "additional-property-default-materialization","description": "Composio divergence: a schema-valued `additionalProperties` also materializes defaults in Zod and Pydantic while Effect leaves the input unchanged.",@@ -677,6 +1004,170 @@"python": { "output": { "name": "a", "extra": { "enabled": false } } }}]+ },+ {+ "id": "composition-fixed-tuple-items",+ "description": "Draft 7 tuple items preserve position, optional shorter arrays, and an additionalItems false bound.",+ "schema": {+ "$schema": "http://json-schema.org/draft-07/schema#",+ "type": "object",+ "properties": {+ "value": {+ "type": "array",+ "items": [{ "type": "string" }, { "type": "integer" }],+ "additionalItems": false+ }+ },+ "required": ["value"]+ },+ "instances": [+ { "input": { "value": [] }, "accepted": true },+ { "input": { "value": ["ready"] }, "accepted": true },+ { "input": { "value": ["ready", 2] }, "accepted": true },+ { "input": { "value": [2, "ready"] }, "accepted": false },+ { "input": { "value": ["ready", 2, true] }, "accepted": false }+ ]+ },+ {+ "id": "composition-open-tuple-items",+ "description": "Tuple items default to Draft 7 and allow unconstrained trailing values unless additionalItems closes them.",+ "schema": {+ "type": "object",+ "properties": {+ "value": {+ "type": "array",+ "items": [{ "type": "string" }, { "type": "integer" }]+ }+ },+ "required": ["value"]+ },+ "instances": [+ { "input": { "value": ["ready", 2, { "extra": true }] }, "accepted": true },+ { "input": { "value": ["ready", "wrong"] }, "accepted": false }+ ]+ },+ {+ "id": "composition-false-tuple-position",+ "description": "A false positional schema rejects a value only when that position is present.",+ "schema": {+ "$schema": "http://json-schema.org/draft-07/schema#",+ "type": "object",+ "properties": {+ "value": {+ "type": "array",+ "items": [{ "type": "string" }, false],+ "additionalItems": false+ }+ },+ "required": ["value"]+ },+ "instances": [+ { "input": { "value": ["ready"] }, "accepted": true },+ { "input": { "value": ["ready", "forbidden"] }, "accepted": false }+ ]+ },+ {+ "id": "composition-allof-object-intersection",+ "description": "Every allOf object branch remains required after conversion.",+ "schema": {+ "type": "object",+ "properties": {+ "value": {+ "allOf": [+ {+ "type": "object",+ "properties": { "a": { "type": "string" } },+ "required": ["a"],+ "additionalProperties": true+ },+ {+ "type": "object",+ "properties": { "b": { "type": "integer" } },+ "required": ["b"],+ "additionalProperties": true+ }+ ]+ }+ },+ "required": ["value"]+ },+ "instances": [+ { "input": { "value": { "a": "ready", "b": 2 } }, "accepted": true },+ { "input": { "value": { "a": "ready" } }, "accepted": false },+ { "input": { "value": { "b": 2 } }, "accepted": false }+ ]+ },+ {+ "id": "composition-allof-closed-object-branches",+ "description": "Closed allOf object branches merge instead of rejecting each other's keys; the union of declared keys stays strict.",+ "schema": {+ "type": "object",+ "properties": {+ "value": {+ "allOf": [+ {+ "type": "object",+ "properties": { "a": { "type": "string" } },+ "required": ["a"]+ },+ {+ "type": "object",+ "properties": { "b": { "type": "string" } },+ "required": ["b"]+ }+ ]+ }+ },+ "required": ["value"]+ },+ "instances": [+ { "input": { "value": { "a": "ready", "b": "set" } }, "accepted": true },+ { "input": { "value": { "a": "ready" } }, "accepted": false },+ { "input": { "value": { "a": "ready", "b": "set", "c": 1 } }, "accepted": false }+ ]+ },+ {+ "id": "composition-scalar-allof",+ "description": "Scalar allOf branches combine rather than selecting the first branch.",+ "schema": {+ "type": "object",+ "properties": {+ "value": {+ "allOf": [+ { "type": "string", "minLength": 2 },+ { "type": "string", "pattern": "^[A-Z]+$" }+ ]+ }+ },+ "required": ["value"]+ },+ "instances": [+ { "input": { "value": "OK" }, "accepted": true },+ { "input": { "value": "O" }, "accepted": false },+ { "input": { "value": "ok" }, "accepted": false }+ ]+ },+ {+ "id": "composition-oneof-exclusive-match",+ "description": "oneOf accepts exactly one matching branch, not a plain union of branches.",+ "schema": {+ "type": "object",+ "properties": {+ "value": {+ "oneOf": [+ { "type": "number", "minimum": 0 },+ { "type": "number", "maximum": 0 }+ ]+ }+ },+ "required": ["value"]+ },+ "instances": [+ { "input": { "value": 1 }, "accepted": true },+ { "input": { "value": -1 }, "accepted": true },+ { "input": { "value": 0 }, "accepted": false },+ { "input": { "value": "0" }, "accepted": false }+ ]}]}diff --git a/python/tests/test_files.py b/python/tests/test_files.pyindex a835ce54e..d0eed7ac0 100644--- a/python/tests/test_files.py+++ b/python/tests/test_files.py@@ -3384,6 +3384,24 @@ class TestEnhanceSchemaDescriptionsEmptySchema:assert "string" in descriptionassert "required" in description+ def test_boolean_property_schemas_are_left_unchanged(self, file_helper):+ schema = {+ "type": "object",+ "properties": {+ "anything": True,+ "never": False,+ "query": {"type": "string"},+ },+ "required": ["anything", "query"],+ }++ result = file_helper.enhance_schema_descriptions(schema)++ assert result["properties"]["anything"] is True+ assert result["properties"]["never"] is False+ assert "string" in result["properties"]["query"]["description"]+ assert "required" in result["properties"]["query"]["description"]+class TestFromPathSensitiveGuard:"""`FileUploadable.from_path` is the single upload primitive in the Pythondiff --git a/python/tests/test_gemini_provider.py b/python/tests/test_gemini_provider.pyindex 7badbd17d..7c5f04a6c 100644--- a/python/tests/test_gemini_provider.py+++ b/python/tests/test_gemini_provider.py@@ -225,7 +225,9 @@ class TestWrapTool:provider.wrap_tool(tool, execute_tool)assert "GITHUB_STAR_REPO" in provider._executors- stored_execute_tool, _aliases = provider._executors["GITHUB_STAR_REPO"]+ stored_execute_tool, _aliases, _args_schema = provider._executors[+ "GITHUB_STAR_REPO"+ ]assert stored_execute_tool is execute_tooldef test_callable_executes_correctly(self):@@ -277,9 +279,8 @@ class TestWrapTool:converted to plain dicts before reaching execute_tool so the ComposioAPI can JSON-serialize them."""- from pydantic import BaseModel-from composio_gemini import GeminiProvider+ from pydantic import BaseModelclass FakeQuery(BaseModel):use_case: str = ""@@ -319,6 +320,61 @@ class TestWrapTool:assert isinstance(call_args["queries"][0], dict)assert call_args["queries"][0]["use_case"] == "summarize email"+ @pytest.mark.parametrize(+ ("property_schema", "invalid", "valid"),+ [+ (+ {"minLength": 2, "required": ["x"]},+ {},+ {"x": 1},+ ),+ (+ {"type": "array", "contains": {"const": 1}},+ [2],+ [1, 2],+ ),+ (+ {+ "type": "number",+ "if": {"minimum": 0},+ "then": {"maximum": 10},+ },+ 20,+ 5,+ ),+ ],+ ids=["typeless-object", "contains", "conditional"],+ )+ def test_callable_validates_assertions_missing_from_function_declaration(+ self,+ property_schema,+ invalid,+ valid,+ ):+ """AFC type generation is lossy, so the callable validates the source schema."""+ from composio_gemini import GeminiProvider+ from pydantic import ValidationError++ provider = GeminiProvider()+ tool = create_mock_tool(+ "VALIDATE_SOURCE_SCHEMA",+ "test",+ input_parameters={+ "type": "object",+ "properties": {"value": property_schema},+ "required": ["value"],+ },+ )+ execute_tool = create_mock_execute_tool()+ func = provider.wrap_tool(tool, execute_tool)++ with pytest.raises(ValidationError):+ func(value=invalid)+ execute_tool.assert_not_called()++ func(value=valid)+ assert execute_tool.call_args.args[1] == {"value": valid}+def test_array_param_has_parameterized_type(self):"""Array parameters must produce List[X], not bare List.@@ -598,6 +654,40 @@ class TestHandleResponse:arguments={"repo": "composio/composio"},)+ def test_rejects_invalid_arguments_like_afc(self):+ """Manual function calling validates the source schema like the AFC callable."""+ from composio_gemini import GeminiProvider+ from pydantic import ValidationError++ provider = GeminiProvider()+ tool = create_mock_tool(+ "VALIDATE_SOURCE_SCHEMA",+ "test",+ input_parameters={+ "type": "object",+ "properties": {"value": {"type": "integer", "minimum": 1}},+ "required": ["value"],+ },+ )+ execute_tool = create_mock_execute_tool()+ provider.wrap_tools([tool], execute_tool)++ response = self._create_mock_response(+ [("VALIDATE_SOURCE_SCHEMA", {"value": 0})]+ )+ with pytest.raises(ValidationError):+ provider.handle_response(response)+ execute_tool.assert_not_called()++ response = self._create_mock_response(+ [("VALIDATE_SOURCE_SCHEMA", {"value": 3})]+ )+ _responses, executed = provider.handle_response(response)+ assert executed is True+ execute_tool.assert_called_once_with(+ slug="VALIDATE_SOURCE_SCHEMA", arguments={"value": 3}+ )+def test_no_function_calls(self):from composio_gemini import GeminiProviderdiff --git a/python/tests/test_schema_composition_parity.py b/python/tests/test_schema_composition_parity.pynew file mode 100644index 000000000..ef32c9901--- /dev/null+++ b/python/tests/test_schema_composition_parity.py@@ -0,0 +1,53 @@+"""Cross-entry-point checks for composed JSON Schema conversion."""++import pytest+from pydantic import TypeAdapter, ValidationError++from composio.utils.shared import pydantic_model_from_param_schema+from tests.fixtures.json_schema_conversion_corpus import find_case++COMPOSITION_CASE_IDS = (+ "composition-fixed-tuple-items",+ "composition-open-tuple-items",+ "composition-false-tuple-position",+ "composition-allof-object-intersection",+ "composition-scalar-allof",+ "composition-oneof-exclusive-match",+)++[email protected]("case_id", COMPOSITION_CASE_IDS)+def test_legacy_model_entry_point_matches_shared_composition_corpus(+ case_id: str,+) -> None:+ case = find_case(case_id)+ model = pydantic_model_from_param_schema(+ {**case.schema_, "title": f"Composition_{case_id}"}+ )++ for instance in case.instances:+ if instance.accepted_for("python"):+ model.model_validate(instance.input)+ else:+ with pytest.raises(ValidationError):+ model.model_validate(instance.input)+++def test_standalone_draft7_tuple_preserves_positional_validation() -> None:+ adapter = TypeAdapter(+ pydantic_model_from_param_schema(+ {+ "title": "StandaloneTuple",+ "type": "array",+ "items": [{"type": "string"}, {"type": "integer"}],+ "additionalItems": False,+ }+ )+ )++ assert adapter.validate_python([]) == []+ assert adapter.validate_python(["ready"]) == ["ready"]+ assert adapter.validate_python(["ready", 2]) == ["ready", 2]+ for value in ([2, "ready"], ["ready", 2, True]):+ with pytest.raises(ValidationError):+ adapter.validate_python(value)diff --git a/python/tests/test_schema_parser.py b/python/tests/test_schema_parser.pyindex d58c676b6..a6bdb025c 100644--- a/python/tests/test_schema_parser.py+++ b/python/tests/test_schema_parser.py@@ -11,8 +11,6 @@ import pytestfrom pydantic import BaseModel, TypeAdapter, ValidationErrorfrom pydantic.fields import PydanticUndefined-from tests.fixtures.json_schema_conversion_corpus import find_case, load_object_cases-from composio.utils.shared import (get_signature_format_from_schema_params,json_schema_to_fields_dict,@@ -21,6 +19,7 @@ from composio.utils.shared import (json_schema_to_pydantic_type,pydantic_model_from_param_schema,)+from tests.fixtures.json_schema_conversion_corpus import find_case, load_object_casesclass TestJsonSchemaToPydanticField:@@ -429,6 +428,13 @@ class TestPydanticModelFromParamSchema:pydantic_model_from_param_schema(param_schema)+def _materialized(annotation: t.Any) -> t.Any:+ """Strip the exact-validation `Annotated` wrapper to reach the Pydantic type."""+ while t.get_origin(annotation) is t.Annotated:+ annotation = t.get_args(annotation)[0]+ return annotation++class TestJsonSchemaToPydanticType:"""Test cases for json_schema_to_pydantic_type function."""@@ -446,12 +452,12 @@ class TestJsonSchemaToPydanticType:assert result == expected_typedef test_anyof_null_only_preserves_nullability(self):- """Test that anyOf with only null maps to Optional[Any] instead of str."""- result = json_schema_to_pydantic_type({"anyOf": [{"type": "null"}]})+ """Test that anyOf with only null accepts no non-null value."""+ result = _materialized(+ json_schema_to_pydantic_type({"anyOf": [{"type": "null"}]})+ )- assert t.get_origin(result) is t.Union- assert t.Any in t.get_args(result)- assert type(None) in t.get_args(result)+ assert result is type(None)def test_array_type(self):"""Test array type conversion."""@@ -493,13 +499,17 @@ class TestJsonSchemaToPydanticType:]}result_4 = json_schema_to_pydantic_type(json_schema_4)- assert hasattr(result_4, "__origin__")- assert result_4.__origin__ is t.Union- assert len(result_4.__args__) == 4- assert str in result_4.__args__- assert int in result_4.__args__- assert bool in result_4.__args__- assert float in result_4.__args__+ union_4 = t.get_args(result_4)[0]+ assert t.get_origin(union_4) is t.Union+ assert len(t.get_args(union_4)) == 4+ assert str in t.get_args(union_4)+ assert int in t.get_args(union_4)+ assert bool in t.get_args(union_4)+ assert float in t.get_args(union_4)+ # `integer` is a subset of `number`, so 42 matches two branches and+ # must be rejected by oneOf's exactly-one rule.+ with pytest.raises(ValidationError):+ TypeAdapter(result_4).validate_python(42)# Test 5 typesjson_schema_5 = {@@ -512,9 +522,9 @@ class TestJsonSchemaToPydanticType:]}result_5 = json_schema_to_pydantic_type(json_schema_5)- assert hasattr(result_5, "__origin__")- assert result_5.__origin__ is t.Union- assert len(result_5.__args__) == 5+ union_5 = t.get_args(result_5)[0]+ assert t.get_origin(union_5) is t.Union+ assert len(t.get_args(union_5)) == 5# Test 6 types (stress test, avoiding null which expands to Optional[Any])json_schema_6 = {@@ -528,14 +538,14 @@ class TestJsonSchemaToPydanticType:]}result_6 = json_schema_to_pydantic_type(json_schema_6)- assert hasattr(result_6, "__origin__")- assert result_6.__origin__ is t.Union- assert len(result_6.__args__) == 6+ union_6 = t.get_args(result_6)[0]+ assert t.get_origin(union_6) is t.Union+ assert len(t.get_args(union_6)) == 6def test_oneof_single_type(self):"""Test oneOf with single type returns the type directly."""json_schema = {"oneOf": [{"type": "string"}]}- result = json_schema_to_pydantic_type(json_schema)+ result = _materialized(json_schema_to_pydantic_type(json_schema))assert result is str# Single type should not create a Unionassert not hasattr(result, "__origin__")@@ -553,7 +563,7 @@ class TestJsonSchemaToPydanticType:},]}- result = json_schema_to_pydantic_type(json_schema)+ result = _materialized(json_schema_to_pydantic_type(json_schema))assert hasattr(result, "__origin__")assert result.__origin__ is t.Unionassert len(result.__args__) == 3@@ -595,21 +605,25 @@ class TestJsonSchemaToPydanticType:# Test with different oneOf valuesinstance1 = model_class(flexible_field="hello", normal_field="world")- instance2 = model_class(flexible_field=42, normal_field="world")instance3 = model_class(flexible_field=True, normal_field="world")instance4 = model_class(flexible_field=3.14, normal_field="world")assert instance1.flexible_field == "hello"- assert instance2.flexible_field == 42assert instance3.flexible_field is Trueassert instance4.flexible_field == 3.14- def test_fallback_to_string(self):- """Test that missing type defaults to string."""+ # Draft 7 `oneOf` requires exactly one branch to match. An integer+ # satisfies both {"type": "integer"} and {"type": "number"}, so it is+ # rejected — the Zod and Effect converters agree.+ with pytest.raises(ValidationError):+ model_class(flexible_field=42, normal_field="world")++ def test_empty_schema_accepts_any_value(self):+ """An empty JSON Schema accepts every value."""json_schema = {} # No type specifiedresult = json_schema_to_pydantic_type(json_schema)- assert result is str+ assert result is t.Anydef test_unsupported_type_fallback(self):"""Test that unsupported types fall back to string (graceful degradation)."""@@ -624,7 +638,7 @@ class TestJsonSchemaToPydanticType:json_schema = {"anyOf": [{"type": "object", "additionalProperties": {}}, {"type": "null"}]}- result = json_schema_to_pydantic_type(json_schema)+ result = _materialized(json_schema_to_pydantic_type(json_schema))# Should return Optional[dict], not str (to allow both dict and None)assert hasattr(result, "__origin__")assert result.__origin__ is t.Union@@ -644,7 +658,7 @@ class TestJsonSchemaToPydanticType:{"type": "null"},]}- result = json_schema_to_pydantic_type(json_schema)+ result = _materialized(json_schema_to_pydantic_type(json_schema))# Should return Optional[BaseModel subclass] (Union with None)assert hasattr(result, "__origin__")assert result.__origin__ is t.Union@@ -663,19 +677,19 @@ class TestJsonSchemaToPydanticType:json_schema = {"anyOf": [{"type": "string"}, {"type": "integer"}, {"type": "object"}]}- result = json_schema_to_pydantic_type(json_schema)+ result = _materialized(json_schema_to_pydantic_type(json_schema))assert hasattr(result, "__origin__")assert result.__origin__ is t.Uniondef test_anyof_single_type(self):"""Test anyOf with single type returns the type directly."""json_schema = {"anyOf": [{"type": "string"}]}- result = json_schema_to_pydantic_type(json_schema)+ result = _materialized(json_schema_to_pydantic_type(json_schema))assert result is strassert not hasattr(result, "__origin__")def test_allof_single_option(self):- """Test allOf with single option."""+ """A single allOf option preserves its acceptance behavior."""json_schema = {"allOf": [{@@ -685,29 +699,28 @@ class TestJsonSchemaToPydanticType:}]}- result = json_schema_to_pydantic_type(json_schema)- assert isinstance(result, type)- assert issubclass(result, BaseModel)+ adapter = TypeAdapter(json_schema_to_pydantic_type(json_schema))+ result = adapter.validate_python({"name": "Ada"})+ assert adapter.dump_python(result, mode="json") == {"name": "Ada"}+ with pytest.raises(ValidationError):+ adapter.validate_python({"name": 42})def test_allof_multiple_options_with_type(self):"""Test allOf with multiple options where one has type."""json_schema = {"allOf": [{"description": "Some description"}, {"type": "string"}]}- result = json_schema_to_pydantic_type(json_schema)- # The library creates an AllOfModel class that combines the schemas- # or returns str depending on the schema structure- assert result is not None- # Either it's str or a model class (both are valid)- assert result is str or (- isinstance(result, type) and issubclass(result, BaseModel)- )+ adapter = TypeAdapter(json_schema_to_pydantic_type(json_schema))+ assert adapter.validate_python("value") == "value"+ with pytest.raises(ValidationError):+ adapter.validate_python(42)def test_allof_empty_options(self):"""Test allOf with empty options accepts any value."""json_schema = {"allOf": []}- result = json_schema_to_pydantic_type(json_schema)- assert result is t.Any+ adapter = TypeAdapter(json_schema_to_pydantic_type(json_schema))+ assert adapter.validate_python(42) == 42+ assert adapter.validate_python({"anything": True}) == {"anything": True}class TestJsonSchemaToFieldsDict:@@ -1044,7 +1057,7 @@ class TestBooleanSchemas:True, # Boolean schema]}- result = json_schema_to_pydantic_type(json_schema)+ result = _materialized(json_schema_to_pydantic_type(json_schema))# Should handle gracefully, creating a union including Anyassert result is not None# The result should include Any type from the true schema@@ -1061,45 +1074,38 @@ class TestBooleanSchemas:False, # Boolean schema - should be filtered out]}- result = json_schema_to_pydantic_type(json_schema)+ result = _materialized(json_schema_to_pydantic_type(json_schema))# Should handle gracefully, false schema filtered out leaving just stringassert result is str@pytest.mark.unit@pytest.mark.schemadef test_boolean_schema_in_allof_with_type(self):- """Test that boolean schemas in allOf don't crash when combined with typed schema."""+ """A true allOf branch leaves the typed branch unchanged."""json_schema = {"allOf": [{"type": "string"},True,]}- result = json_schema_to_pydantic_type(json_schema)- # Should not crash - may return str or an AllOf model- assert result is not None- # Either it's str or a model class (library creates AllOfModel)- assert result is str or (- isinstance(result, type) and issubclass(result, BaseModel)- )+ adapter = TypeAdapter(json_schema_to_pydantic_type(json_schema))+ assert adapter.validate_python("value") == "value"+ with pytest.raises(ValidationError):+ adapter.validate_python(42)@pytest.mark.unit@pytest.mark.schemadef test_boolean_schema_in_allof_single(self):- """Test that single boolean schema in allOf returns appropriate type."""+ """A single true allOf branch accepts every value."""json_schema = {"allOf": [True]}- result = json_schema_to_pydantic_type(json_schema)- # Single true schema filtered to {} - library may return Any or a model- assert result is not None- # Could be Any, or a generated model (both are valid)- assert result is t.Any or (- isinstance(result, type) and issubclass(result, BaseModel)- )+ adapter = TypeAdapter(json_schema_to_pydantic_type(json_schema))+ assert adapter.validate_python(42) == 42+ assert adapter.validate_python({"anything": True}) == {"anything": True}@pytest.mark.unit@pytest.mark.schemadef test_boolean_schema_in_oneof(self):- """Test that boolean schemas in oneOf don't crash."""+ """A true branch still participates in oneOf's exactly-one rule."""json_schema = {"oneOf": [{"type": "string"},@@ -1107,10 +1113,10 @@ class TestBooleanSchemas:]}result = json_schema_to_pydantic_type(json_schema)- # Should handle gracefully- assert result is not None- assert hasattr(result, "__origin__")- assert result.__origin__ is t.Union+ adapter = TypeAdapter(result)+ assert adapter.validate_python(42) == 42+ with pytest.raises(ValidationError):+ adapter.validate_python("matches both branches")@pytest.mark.unit@pytest.mark.schema@@ -1122,9 +1128,11 @@ class TestBooleanSchemas:@pytest.mark.unit@pytest.mark.schemadef test_standalone_false_schema(self):- """Test that standalone false schema returns None (to be filtered out)."""- result = json_schema_to_pydantic_type(False)- assert result is None+ """Test that standalone false schema rejects every value."""+ adapter = TypeAdapter(json_schema_to_pydantic_type(False))+ for value in (None, "value", 1, {}, []):+ with pytest.raises(ValidationError):+ adapter.validate_python(value)@pytest.mark.unit@pytest.mark.schema@@ -1153,7 +1161,7 @@ class TestBooleanSchemas:{"type": "integer"},]}- result = json_schema_to_pydantic_type(json_schema)+ result = _materialized(json_schema_to_pydantic_type(json_schema))# Should create union of Any and int (false filtered out)assert result is not Noneassert hasattr(result, "__origin__")diff --git a/python/tests/test_schema_primitive_parity.py b/python/tests/test_schema_primitive_parity.pynew file mode 100644index 000000000..832d9b4b0--- /dev/null+++ b/python/tests/test_schema_primitive_parity.py@@ -0,0 +1,47 @@+"""Cross-entry-point checks for primitive JSON Schema conversion."""++import pytest+from pydantic import ValidationError++from composio.utils.shared import pydantic_model_from_param_schema+from tests.fixtures.json_schema_conversion_corpus import find_case++PRIMITIVE_CASE_IDS = (+ "primitive-boolean-property-schemas",+ "primitive-empty-and-null-schemas",+ "primitive-type-array-union",+ "primitive-null-only-unions",+ "primitive-enum-intersects-declared-type",+ "primitive-scalar-constraints",+ "primitive-independent-numeric-bounds",+ "primitive-const-intersects-declared-type",+ "primitive-compound-enum-values",+ "primitive-const-null-and-false",+ "primitive-enum-boolean-number-identity",+ "primitive-enum-with-null-member",+ "primitive-const-constraint-conjunction",+ "primitive-inclusive-numeric-boundaries",+ "primitive-const-narrows-enum",+ "primitive-compound-const-deep-equality",+ "primitive-unicode-code-point-length",+ "primitive-typeless-constraint-scoping",+ "primitive-float-multiple-of",+ "primitive-draft4-boolean-exclusive-bounds",+ "primitive-type-array-constraint-scoping",+ "primitive-empty-enum-optional-property",+)++[email protected]("case_id", PRIMITIVE_CASE_IDS)+def test_legacy_model_entry_point_matches_shared_primitive_corpus(case_id: str) -> None:+ case = find_case(case_id)+ model = pydantic_model_from_param_schema(+ {**case.schema_, "title": f"Primitive_{case_id}"}+ )++ for instance in case.instances:+ if instance.accepted_for("python"):+ model.model_validate(instance.input)+ else:+ with pytest.raises(ValidationError):+ model.model_validate(instance.input)diff --git a/python/tests/test_schema_property_semantics.py b/python/tests/test_schema_property_semantics.pynew file mode 100644index 000000000..b7c809eca--- /dev/null+++ b/python/tests/test_schema_property_semantics.py@@ -0,0 +1,215 @@+"""Property-based acceptance parity for scalar JSON Schema conversion.++The oracle is the `jsonschema` Draft 7 validator: for every generated scalar+schema and instance, the converted Pydantic artifacts must agree with it.++The generator deliberately stays inside the semantics the converters claim to+support today; shrinking an exclusion is the way to turn a fixed behavior into+a permanent regression guard. The remaining exclusions are deliberate+divergences or oracle limits, not open bugs:++- ``multipleOf`` is always an integer: the converters check decimal multiples+ through decimal scaling (see the ``primitive-float-multiple-of`` corpus+ case), while the oracle uses raw float modulo+- draft-4 boolean ``exclusiveMinimum``/``exclusiveMaximum`` are never+ generated: they are not Draft 7, so the oracle cannot express them (the+ ``primitive-draft4-boolean-exclusive-bounds`` corpus case covers them)+"""++import typing as t++import pytest+from hypothesis import HealthCheck, given, settings+from hypothesis import strategies as st+from jsonschema import Draft7Validator+from pydantic import TypeAdapter, ValidationError++from composio.utils.schema_converter import json_schema_to_pydantic_type+from composio.utils.shared import pydantic_model_from_param_schema++SCALAR_TYPES = ("string", "integer", "number", "boolean", "null")++PATTERN_POOL = ("^[a-z]+$", "^[A-Z]{2}$", "[0-9]", "^a.*z$", "^(?=.*[a-y])a")++scalar_values = st.one_of(+ st.none(),+ st.booleans(),+ st.integers(min_value=-100, max_value=100),+ st.floats(+ min_value=-100,+ max_value=100,+ allow_nan=False,+ allow_infinity=False,+ ),+ st.text(+ alphabet=st.characters(min_codepoint=97, max_codepoint=122),+ max_size=6,+ ),+)+++def scalar_schemas(draw: st.DrawFn) -> dict[str, t.Any]:+ schema: dict[str, t.Any] = {}+ declared: tuple[str, ...] = ()++ if draw(st.booleans()):+ members = draw(+ st.lists(st.sampled_from(SCALAR_TYPES), min_size=1, max_size=3, unique=True)+ )+ if len(members) == 1 and draw(st.booleans()):+ schema["type"] = members[0]+ declared = (members[0],)+ else:+ schema["type"] = members+ declared = tuple(members)++ literal_kind = draw(st.sampled_from(("none", "enum", "const", "both")))+ if literal_kind in ("enum", "both"):+ schema["enum"] = draw(+ st.lists(scalar_values, min_size=1, max_size=4, unique_by=repr)+ )+ if literal_kind in ("const", "both"):+ schema["const"] = draw(scalar_values)++ # Constraints attach independently of the declared type (or its absence):+ # Draft 7 scopes every scalar keyword to matching instance types anyway.+ del declared+ if draw(st.booleans()):+ schema["minLength"] = draw(st.integers(min_value=0, max_value=4))+ if draw(st.booleans()):+ schema["maxLength"] = draw(st.integers(min_value=0, max_value=6))+ if draw(st.booleans()):+ schema["pattern"] = draw(st.sampled_from(PATTERN_POOL))+ if draw(st.booleans()):+ schema["minimum"] = draw(st.integers(min_value=-20, max_value=20))+ if draw(st.booleans()):+ schema["maximum"] = draw(st.integers(min_value=-20, max_value=20))+ if draw(st.booleans()):+ schema["exclusiveMinimum"] = draw(st.integers(min_value=-20, max_value=20))+ if draw(st.booleans()):+ schema["exclusiveMaximum"] = draw(st.integers(min_value=-20, max_value=20))+ if draw(st.booleans()):+ schema["multipleOf"] = draw(st.integers(min_value=1, max_value=5))++ return schema+++def schema_and_instance(draw: st.DrawFn) -> tuple[dict[str, t.Any], t.Any]:+ schema = draw(scalar_schemas())++ pools: list[st.SearchStrategy[t.Any]] = [scalar_values]+ interesting: list[t.Any] = []+ if "enum" in schema:+ interesting.extend(schema["enum"])+ if "const" in schema:+ interesting.append(schema["const"])+ for keyword in ("minimum", "maximum", "exclusiveMinimum", "exclusiveMaximum"):+ if keyword in schema:+ bound = schema[keyword]+ interesting.extend((bound, bound + 1, bound - 1))+ if interesting:+ pools.append(st.sampled_from(interesting))++ return schema, draw(st.one_of(pools))+++def _oracle_accepts(object_schema: dict[str, t.Any], instance: t.Any) -> bool:+ return Draft7Validator(object_schema).is_valid(instance)+++def _pydantic_accepts(annotation: t.Any, instance: t.Any) -> bool:+ try:+ TypeAdapter(annotation).validate_python(instance)+ return True+ except ValidationError:+ return False+++def _wrap(schema: dict[str, t.Any]) -> dict[str, t.Any]:+ return {+ "type": "object",+ "properties": {"value": schema},+ "required": ["value"],+ "title": "PropertyCase",+ }+++@settings(+ max_examples=200,+ deadline=None,+ suppress_health_check=[HealthCheck.too_slow],+)+@given(schema_and_instance())+def test_object_conversion_matches_draft7_oracle(+ case: tuple[dict[str, t.Any], t.Any],+) -> None:+ """`json_schema_to_pydantic_type` on an object schema must agree with Draft 7."""+ schema, value = case+ object_schema = _wrap(schema)+ instance = {"value": value}++ expected = _oracle_accepts(object_schema, instance)+ actual = _pydantic_accepts(json_schema_to_pydantic_type(object_schema), instance)++ assert actual == expected, (+ f"object path disagreed with Draft 7 oracle for schema={schema!r} "+ f"value={value!r}: oracle={expected} converted={actual}"+ )+++@settings(+ max_examples=200,+ deadline=None,+ suppress_health_check=[HealthCheck.too_slow],+)+@given(schema_and_instance())+def test_legacy_model_matches_draft7_oracle(+ case: tuple[dict[str, t.Any], t.Any],+) -> None:+ """`pydantic_model_from_param_schema` enforces exact Draft 7 acceptance."""+ schema, value = case+ object_schema = _wrap(schema)+ instance = {"value": value}++ expected = _oracle_accepts(object_schema, instance)+ model = pydantic_model_from_param_schema(object_schema)+ try:+ model.model_validate(instance)+ actual = True+ except ValidationError:+ actual = False++ assert actual == expected, (+ f"legacy path disagreed with Draft 7 oracle for schema={schema!r} "+ f"value={value!r}: oracle={expected} converted={actual}"+ )+++@settings(+ max_examples=200,+ deadline=None,+ suppress_health_check=[HealthCheck.too_slow],+)+@given(schema_and_instance())+def test_toplevel_conversion_never_rejects_draft7_valid_input(+ case: tuple[dict[str, t.Any], t.Any],+) -> None:+ """The top-level scalar path may coerce, but must not over-reject."""+ schema, value = case++ if not Draft7Validator(schema).is_valid(value):+ return++ annotation = json_schema_to_pydantic_type(schema)+ assert _pydantic_accepts(annotation, value), (+ f"top-level path rejected a Draft 7-valid instance for schema={schema!r} "+ f"value={value!r}"+ )diff --git a/python/tests/test_schema_semantic_regressions.py b/python/tests/test_schema_semantic_regressions.pynew file mode 100644index 000000000..580bfa304--- /dev/null+++ b/python/tests/test_schema_semantic_regressions.py@@ -0,0 +1,424 @@+"""Regression matrix for whole-schema JSON Schema acceptance.++These cases combine keywords that previously took different conversion paths.+Every fixture is checked against the Draft 7 oracle before the public Pydantic+entry point, so a passing test cannot merely preserve two matching mistakes.+"""++import json+import threading+import time+import typing as t+from http.server import BaseHTTPRequestHandler, HTTPServer++import pytest+from jsonschema import Draft7Validator+from pydantic import TypeAdapter, ValidationError++from composio.utils.schema_converter import json_schema_to_pydantic_type+from composio.utils.shared import (+ json_schema_to_model,+ pydantic_model_from_param_schema,+)++REJECTION_CASES: tuple[tuple[str, dict[str, t.Any], t.Any], ...] = (+ (+ "typeless scalar dispatch must not discard object assertions",+ {"minLength": 2, "required": ["x"]},+ {},+ ),+ (+ "anyOf must compose with adjacent assertions",+ {+ "type": "string",+ "minLength": 2,+ "anyOf": [{"const": "a"}, {"const": "abc"}],+ },+ "a",+ ),+ (+ "allOf must compose with adjacent assertions",+ {"type": "string", "maxLength": 1, "allOf": [{"pattern": "^ab"}]},+ "ab",+ ),+ (+ "oneOf must compose with adjacent assertions",+ {+ "type": "number",+ "minimum": 10,+ "oneOf": [{"maximum": 5}, {"minimum": 0}],+ },+ 7,+ ),+ (+ "not must compose with adjacent assertions",+ {"type": "string", "minLength": 2, "not": {"const": "x"}},+ "a",+ ),+ (+ "if and then are a complete conditional without else",+ {"if": {"type": "string"}, "then": {"minLength": 2}},+ "a",+ ),+ (+ "conditionals must compose with adjacent primitive assertions",+ {+ "type": "number",+ "if": {"minimum": 0},+ "then": {"maximum": 10},+ "else": {"minimum": -10},+ },+ 20,+ ),+ (+ "contains must be enforced for typed arrays",+ {"type": "array", "contains": {"const": 1}},+ [2],+ ),+ (+ "uniqueItems must be enforced for typed arrays",+ {"type": "array", "uniqueItems": True},+ [1, 1],+ ),+ (+ "minItems must be enforced for typed arrays",+ {"type": "array", "minItems": 2},+ [1],+ ),+ (+ "maxItems must be enforced for typed arrays",+ {"type": "array", "maxItems": 1},+ [1, 2],+ ),+ (+ "propertyNames must be enforced for typed objects",+ {"type": "object", "propertyNames": {"pattern": "^x"}},+ {"bad": 1},+ ),+ (+ "required must be enforced for property-less typed objects",+ {"type": "object", "required": ["x"]},+ {},+ ),+ (+ "local references must constrain direct converter callers",+ {+ "$defs": {"positive": {"type": "number", "minimum": 1}},+ "$ref": "#/$defs/positive",+ },+ 0,+ ),+)+++ ("name", "schema", "value"),+ REJECTION_CASES,+ ids=[case[0] for case in REJECTION_CASES],+)+def test_whole_schema_rejections_match_draft7(+ name: str,+ schema: dict[str, t.Any],+ value: t.Any,+) -> None:+ del name+ Draft7Validator.check_schema(schema)+ assert not Draft7Validator(schema).is_valid(value)++ adapter = TypeAdapter(json_schema_to_pydantic_type(schema))+ with pytest.raises(ValidationError):+ adapter.validate_python(value)++[email protected]("literal_keyword", ["const", "enum"])+def test_typed_object_compound_literals_do_not_fall_back_to_string(+ literal_keyword: str,+) -> None:+ literal = {} if literal_keyword == "const" else [{}]+ schema = {+ "type": "object",+ "properties": {"x": {"type": "string", "default": "generated"}},+ literal_keyword: literal,+ }+ Draft7Validator.check_schema(schema)++ adapter = TypeAdapter(json_schema_to_pydantic_type(schema))+ result = adapter.validate_python({})+ assert adapter.dump_python(result, mode="json") == {}+++ ("schema", "value"),+ [+ (+ {+ "type": "array",+ "minimum": 0,+ "exclusiveMinimum": True,+ "contains": {"const": 1},+ },+ [2],+ ),+ (+ {+ "type": "object",+ "minimum": 0,+ "exclusiveMinimum": True,+ "propertyNames": {"pattern": "^x"},+ },+ {"bad": 1},+ ),+ ],+ ids=["contains", "property-names"],+)+def test_draft4_bounds_do_not_disable_draft7_siblings(+ schema: dict[str, t.Any],+ value: t.Any,+) -> None:+ adapter = TypeAdapter(json_schema_to_pydantic_type(schema))+ with pytest.raises(ValidationError):+ adapter.validate_python(value)+++def test_scalar_allof_acceptance_survives_pydantic_materialization() -> None:+ schema = {+ "title": "ScalarAllOf",+ "type": "object",+ "properties": {+ "value": {+ "allOf": [+ {"type": "string", "minLength": 2},+ {"type": "string", "pattern": "^[A-Z]+$"},+ ]+ }+ },+ "required": ["value"],+ }+ Draft7Validator.check_schema(schema)+ assert Draft7Validator(schema).is_valid({"value": "OK"})++ annotations = (+ json_schema_to_pydantic_type(schema),+ json_schema_to_model(schema),+ pydantic_model_from_param_schema(schema),+ )+ for annotation in annotations:+ TypeAdapter(annotation).validate_python({"value": "OK"})+++ ("schema", "value"),+ [+ ({"properties": {"x": {"type": "string"}}}, 42),+ ({"required": ["x"]}, 42),+ ({"items": {"type": "string"}}, 42),+ ({"minItems": 2}, {"not": "an array"}),+ ({"propertyNames": {"pattern": "^x"}}, 42),+ ({"dependencies": {"a": ["b"]}}, 42),+ ({"not": {"type": "string"}}, 42),+ ({"if": {"type": "string"}, "then": {"minLength": 2}}, 42),+ ],+)+def test_typeless_assertions_accept_nonmatching_instance_types(+ schema: dict[str, t.Any],+ value: t.Any,+) -> None:+ Draft7Validator.check_schema(schema)+ assert Draft7Validator(schema).is_valid(value)+ TypeAdapter(json_schema_to_pydantic_type(schema)).validate_python(value)+++def test_direct_local_ref_accepts_a_valid_referenced_value() -> None:+ schema = {+ "$defs": {"positive": {"type": "number", "minimum": 1}},+ "$ref": "#/$defs/positive",+ }+ Draft7Validator.check_schema(schema)+ assert Draft7Validator(schema).is_valid(2)+ TypeAdapter(json_schema_to_pydantic_type(schema)).validate_python(2)+++def test_nested_typeless_object_assertion_accepts_a_non_object_property() -> None:+ schema = {+ "title": "NestedTypelessObject",+ "type": "object",+ "properties": {+ "value": {"properties": {"x": {"type": "string"}}},+ },+ "required": ["value"],+ }+ value = {"value": 42}+ Draft7Validator.check_schema(schema)+ assert Draft7Validator(schema).is_valid(value)++ annotations = (+ json_schema_to_pydantic_type(schema),+ json_schema_to_model(schema),+ pydantic_model_from_param_schema(schema),+ )+ for annotation in annotations:+ TypeAdapter(annotation).validate_python(value)++[email protected]("entry_point", ("pydantic_type", "model", "param_schema"))+def test_external_ref_is_refused_without_network_io(entry_point: str) -> None:+ """A remote `$ref` must never make the validator fetch over the network."""+ requests: list[str] = []++ class Handler(BaseHTTPRequestHandler):+ def do_GET(self) -> None: # noqa: N802 - http.server API+ requests.append(self.path)+ body = json.dumps({"type": "string"}).encode()+ self.send_response(200)+ self.send_header("Content-Type", "application/json")+ self.send_header("Content-Length", str(len(body)))+ self.end_headers()+ self.wfile.write(body)++ def log_message(self, *args: t.Any) -> None:+ pass++ server = HTTPServer(("127.0.0.1", 0), Handler)+ thread = threading.Thread(target=server.serve_forever, daemon=True)+ thread.start()+ try:+ url = f"http://127.0.0.1:{server.server_address[1]}/schema"+ schema = {+ "title": "ExternalRef",+ "type": "object",+ "properties": {"value": {"$ref": url}},+ "required": ["value"],+ }+ converters: t.Dict[str, t.Callable[..., t.Any]] = {+ "pydantic_type": json_schema_to_pydantic_type,+ "model": json_schema_to_model,+ "param_schema": pydantic_model_from_param_schema,+ }+ convert = converters[entry_point]+ with pytest.raises(ValueError, match="External schema reference"):+ annotation = convert(schema)+ TypeAdapter(annotation).validate_python({"value": "x"})+ finally:+ server.shutdown()+ server.server_close()+ assert requests == []+++def test_backtracking_pattern_rejects_in_linear_time() -> None:+ schema = {+ "type": "object",+ "properties": {"value": {"type": "string", "pattern": "(a+)+$"}},+ }+ value = {"value": "a" * 24 + "!"}+ assert not Draft7Validator(schema).is_valid(value)+ model = json_schema_to_model(schema)++ started = time.perf_counter()+ with pytest.raises(ValidationError):+ model.model_validate(value)+ assert time.perf_counter() - started < 0.2++ model.model_validate({"value": "aaa"})++[email protected]("combiner", ("anyOf", "oneOf"))+def test_simple_union_rejects_bool_for_integer_or_null(combiner: str) -> None:+ schema = {combiner: [{"type": "integer"}, {"type": "null"}]}+ assert not Draft7Validator(schema).is_valid(True)++ adapter = TypeAdapter(json_schema_to_pydantic_type(schema))+ with pytest.raises(ValidationError):+ adapter.validate_python(True)+ assert adapter.validate_python(1) == 1+ assert adapter.validate_python(None) is None++[email protected]("combiner", ("anyOf", "oneOf"))+def test_toplevel_combiner_model_keeps_sibling_assertions(combiner: str) -> None:+ schema = {+ combiner: [{"type": "object", "properties": {"a": {"type": "string"}}}],+ "required": ["a"],+ }+ assert not Draft7Validator(schema).is_valid({})++ adapter = TypeAdapter(json_schema_to_pydantic_type(schema))+ with pytest.raises(ValidationError):+ adapter.validate_python({})+ assert adapter.dump_python(adapter.validate_python({"a": "x"}), mode="json") == {+ "a": "x"+ }+++def test_property_less_param_schema_keeps_assertions() -> None:+ schema = {"title": "NonEmpty", "type": "object", "minProperties": 1}+ assert not Draft7Validator(schema).is_valid({})++ adapter = TypeAdapter(pydantic_model_from_param_schema(schema))+ with pytest.raises(ValidationError):+ adapter.validate_python({})+ assert adapter.validate_python({"k": 1}) == {"k": 1}+++def test_exact_validated_array_items_keep_materialized_defaults() -> None:+ schema = {+ "type": "object",+ "title": "DynamicArrayArguments",+ "patternProperties": {+ "^items_": {+ "type": "array",+ "items": {+ "type": "object",+ "properties": {+ "null_default": {+ "anyOf": [{"type": "string"}, {"type": "null"}],+ "default": None,+ }+ },+ },+ }+ },+ "additionalProperties": False,+ }+ adapter = TypeAdapter(json_schema_to_pydantic_type(schema))+ assert adapter.dump_python(+ adapter.validate_python({"items_a": [{}]}), mode="json"+ ) == {"items_a": [{"null_default": None}]}+++def test_property_less_param_schema_admits_non_objects() -> None:+ schema = {"title": "Either", "anyOf": [{"type": "string"}, {"type": "object"}]}+ assert Draft7Validator(schema).is_valid("x")++ adapter = TypeAdapter(pydantic_model_from_param_schema(schema))+ assert adapter.validate_python("x") == "x"+ assert adapter.validate_python({"k": 1}) == {"k": 1}+ with pytest.raises(ValidationError):+ adapter.validate_python(1)diff --git a/ts/packages/core/test/fixtures/json-schema-conversion/object-cases.json b/ts/packages/core/test/fixtures/json-schema-conversion/object-cases.jsonindex 8f85ec595..3c9ef6a60 100644--- a/ts/packages/core/test/fixtures/json-schema-conversion/object-cases.json+++ b/ts/packages/core/test/fixtures/json-schema-conversion/object-cases.json@@ -645,6 +645,333 @@}]},+ {+ "id": "primitive-boolean-property-schemas",+ "description": "Boolean property schemas accept every value for true and reject every supplied value for false.",+ "schema": {+ "type": "object",+ "properties": { "allowed": true, "forbidden": false },+ "required": ["allowed"]+ },+ "instances": [+ { "input": { "allowed": { "nested": 1 } }, "accepted": true },+ { "input": { "allowed": 42, "forbidden": "present" }, "accepted": false }+ ]+ },+ {+ "id": "primitive-empty-and-null-schemas",+ "description": "An empty schema accepts any value while a pure null schema accepts only null.",+ "schema": {+ "type": "object",+ "properties": { "anything": {}, "nullOnly": { "type": "null" } },+ "required": ["anything", "nullOnly"]+ },+ "instances": [+ { "input": { "anything": 42, "nullOnly": null }, "accepted": true },+ { "input": { "anything": null, "nullOnly": "not-null" }, "accepted": false }+ ]+ },+ {+ "id": "primitive-type-array-union",+ "description": "Every member of a JSON Schema type array remains accepted.",+ "schema": {+ "type": "object",+ "properties": { "value": { "type": ["string", "integer", "null"] } },+ "required": ["value"]+ },+ "instances": [+ { "input": { "value": "ready" }, "accepted": true },+ { "input": { "value": 2 }, "accepted": true },+ { "input": { "value": null }, "accepted": true },+ { "input": { "value": true }, "accepted": false }+ ]+ },+ {+ "id": "primitive-enum-intersects-declared-type",+ "description": "Enum values cannot bypass the schema's declared JSON type.",+ "schema": {+ "type": "object",+ "properties": { "value": { "type": "string", "enum": [1, "ready"] } },+ "required": ["value"]+ },+ "instances": [+ { "input": { "value": "ready" }, "accepted": true },+ { "input": { "value": 1 }, "accepted": false },+ { "input": { "value": "other" }, "accepted": false }+ ]+ },+ {+ "id": "primitive-null-only-unions",+ "description": "A union containing only null accepts only null.",+ "schema": {+ "type": "object",+ "properties": {+ "typeArray": { "type": ["null"] },+ "anyOf": { "anyOf": [{ "type": "null" }] }+ },+ "required": ["typeArray", "anyOf"]+ },+ "instances": [+ { "input": { "typeArray": null, "anyOf": null }, "accepted": true },+ { "input": { "typeArray": "anything", "anyOf": null }, "accepted": false },+ { "input": { "typeArray": null, "anyOf": 1 }, "accepted": false }+ ]+ },+ {+ "id": "primitive-scalar-constraints",+ "description": "String and numeric constraints survive conversion together.",+ "schema": {+ "type": "object",+ "properties": {+ "code": { "type": "string", "pattern": "^[A-Z]{2}$", "minLength": 2, "maxLength": 2 },+ "count": { "type": "number", "exclusiveMinimum": 0, "multipleOf": 2 }+ },+ "required": ["code", "count"]+ },+ "instances": [+ { "input": { "code": "OK", "count": 2 }, "accepted": true },+ { "input": { "code": "ok", "count": 2 }, "accepted": false },+ { "input": { "code": "OK", "count": 0 }, "accepted": false },+ { "input": { "code": "OK", "count": 3 }, "accepted": false }+ ]+ },+ {+ "id": "primitive-independent-numeric-bounds",+ "description": "Inclusive and numeric exclusive bounds apply independently under Draft 7.",+ "schema": {+ "type": "object",+ "properties": {+ "lower": { "type": "number", "minimum": 0, "exclusiveMinimum": 5 },+ "upper": { "type": "number", "maximum": 10, "exclusiveMaximum": 5 }+ },+ "required": ["lower", "upper"]+ },+ "instances": [+ { "input": { "lower": 6, "upper": 4 }, "accepted": true },+ { "input": { "lower": 1, "upper": 4 }, "accepted": false },+ { "input": { "lower": 6, "upper": 9 }, "accepted": false },+ { "input": { "lower": 5, "upper": 5 }, "accepted": false }+ ]+ },+ {+ "id": "primitive-const-intersects-declared-type",+ "description": "A const that conflicts with the declared type is unsatisfiable.",+ "schema": {+ "type": "object",+ "properties": { "value": { "type": "string", "const": 1 } },+ "required": ["value"]+ },+ "instances": [+ { "input": { "value": 1 }, "accepted": false },+ { "input": { "value": "1" }, "accepted": false }+ ]+ },+ {+ "id": "primitive-compound-enum-values",+ "description": "Enum values may contain any JSON value, including objects and arrays.",+ "schema": {+ "type": "object",+ "properties": {+ "value": { "enum": [{ "mode": "safe" }, ["ready", 1]] }+ },+ "required": ["value"]+ },+ "instances": [+ { "input": { "value": { "mode": "safe" } }, "accepted": true },+ { "input": { "value": ["ready", 1] }, "accepted": true },+ { "input": { "value": ["ready", true] }, "accepted": false },+ { "input": { "value": { "mode": true } }, "accepted": false },+ { "input": { "value": { "mode": "unsafe" } }, "accepted": false }+ ]+ },+ {+ "id": "primitive-const-null-and-false",+ "description": "Falsy consts keep their identity: null and false accept only themselves.",+ "schema": {+ "type": "object",+ "properties": { "maybe": { "const": null }, "flag": { "const": false } },+ "required": ["maybe", "flag"]+ },+ "instances": [+ { "input": { "maybe": null, "flag": false }, "accepted": true },+ { "input": { "maybe": null, "flag": 0 }, "accepted": false },+ { "input": { "maybe": "null", "flag": false }, "accepted": false }+ ]+ },+ {+ "id": "primitive-enum-boolean-number-identity",+ "description": "Enum membership distinguishes booleans from the numbers they equal in most host languages.",+ "schema": {+ "type": "object",+ "properties": { "bits": { "enum": [0, 1] }, "toggle": { "enum": [true] } },+ "required": ["bits", "toggle"]+ },+ "instances": [+ { "input": { "bits": 1, "toggle": true }, "accepted": true },+ { "input": { "bits": 0, "toggle": true }, "accepted": true },+ { "input": { "bits": true, "toggle": true }, "accepted": false },+ { "input": { "bits": 1, "toggle": 1 }, "accepted": false },+ { "input": { "bits": false, "toggle": true }, "accepted": false }+ ]+ },+ {+ "id": "primitive-enum-with-null-member",+ "description": "A null enum member is accepted alongside other literal values.",+ "schema": {+ "type": "object",+ "properties": { "value": { "enum": ["a", null] } },+ "required": ["value"]+ },+ "instances": [+ { "input": { "value": "a" }, "accepted": true },+ { "input": { "value": null }, "accepted": true },+ { "input": { "value": "b" }, "accepted": false }+ ]+ },+ {+ "id": "primitive-const-constraint-conjunction",+ "description": "A const must still satisfy sibling constraints; a conflict rejects everything.",+ "schema": {+ "type": "object",+ "properties": { "code": { "type": "string", "const": "a", "minLength": 2 } },+ "required": ["code"]+ },+ "instances": [+ { "input": { "code": "a" }, "accepted": false },+ { "input": { "code": "ab" }, "accepted": false }+ ]+ },+ {+ "id": "primitive-inclusive-numeric-boundaries",+ "description": "Draft 7 minimum and maximum are inclusive bounds.",+ "schema": {+ "type": "object",+ "properties": { "count": { "type": "integer", "minimum": 5, "maximum": 10 } },+ "required": ["count"]+ },+ "instances": [+ { "input": { "count": 5 }, "accepted": true },+ { "input": { "count": 10 }, "accepted": true },+ { "input": { "count": 4 }, "accepted": false },+ { "input": { "count": 11 }, "accepted": false }+ ]+ },+ {+ "id": "primitive-const-narrows-enum",+ "description": "When const and enum are both present, only their intersection is accepted.",+ "schema": {+ "type": "object",+ "properties": { "value": { "enum": ["a", "b"], "const": "b" } },+ "required": ["value"]+ },+ "instances": [+ { "input": { "value": "b" }, "accepted": true },+ { "input": { "value": "a" }, "accepted": false }+ ]+ },+ {+ "id": "primitive-compound-const-deep-equality",+ "description": "A compound const compares by deep JSON equality, including boolean identity inside containers.",+ "schema": {+ "type": "object",+ "properties": { "value": { "const": { "a": [1, "x", null] } } },+ "required": ["value"]+ },+ "instances": [+ { "input": { "value": { "a": [1, "x", null] } }, "accepted": true },+ { "input": { "value": { "a": [1, "x", null], "b": 1 } }, "accepted": false },+ { "input": { "value": { "a": [true, "x", null] } }, "accepted": false },+ { "input": { "value": { "a": [1, "x"] } }, "accepted": false }+ ]+ },+ {+ "id": "primitive-unicode-code-point-length",+ "description": "String length constraints count Unicode code points, not UTF-16 code units.",+ "schema": {+ "type": "object",+ "properties": { "glyph": { "type": "string", "maxLength": 1 } },+ "required": ["glyph"]+ },+ "instances": [+ { "input": { "glyph": "𝄞" }, "accepted": true },+ { "input": { "glyph": "ab" }, "accepted": false }+ ]+ },+ {+ "id": "primitive-typeless-constraint-scoping",+ "description": "Draft 7 applies string constraints to string instances even without a declared type.",+ "schema": {+ "type": "object",+ "properties": { "value": { "enum": ["a", "abc"], "minLength": 2 } },+ "required": ["value"]+ },+ "instances": [+ { "input": { "value": "abc" }, "accepted": true },+ { "input": { "value": "a" }, "accepted": false }+ ]+ },+ {+ "id": "primitive-float-multiple-of",+ "description": "Decimal multipleOf checks tolerate binary floating-point representation error.",+ "divergesFromJsonSchema": "A literal Draft 7 multipleOf uses raw float arithmetic and rejects 0.3 for 0.1; every Composio converter scales decimals before comparing.",+ "schema": {+ "type": "object",+ "properties": { "step": { "type": "number", "multipleOf": 0.1 } },+ "required": ["step"]+ },+ "instances": [+ { "input": { "step": 0.3 }, "accepted": true },+ { "input": { "step": 0.35 }, "accepted": false }+ ]+ },+ {+ "id": "primitive-draft4-boolean-exclusive-bounds",+ "description": "OpenAPI 3.0 style boolean exclusiveMinimum/exclusiveMaximum flags turn the paired bound exclusive.",+ "schema": {+ "type": "object",+ "properties": {+ "lower": { "type": "number", "minimum": 5, "exclusiveMinimum": true },+ "upper": { "type": "number", "maximum": 5, "exclusiveMaximum": true }+ },+ "required": ["lower", "upper"]+ },+ "instances": [+ { "input": { "lower": 6, "upper": 4 }, "accepted": true },+ { "input": { "lower": 5, "upper": 4 }, "accepted": false },+ { "input": { "lower": 6, "upper": 5 }, "accepted": false }+ ]+ },+ {+ "id": "primitive-type-array-constraint-scoping",+ "description": "Constraints on a type array apply only to instances of their matching type.",+ "schema": {+ "type": "object",+ "properties": {+ "value": { "type": ["string", "number"], "minLength": 2, "minimum": 10 }+ },+ "required": ["value"]+ },+ "instances": [+ { "input": { "value": "ab" }, "accepted": true },+ { "input": { "value": 15 }, "accepted": true },+ { "input": { "value": "a" }, "accepted": false },+ { "input": { "value": 5 }, "accepted": false },+ { "input": { "value": true }, "accepted": false }+ ]+ },+ {+ "id": "primitive-empty-enum-optional-property",+ "description": "An optional property with an empty enum rejects every supplied value but tolerates absence.",+ "schema": {+ "type": "object",+ "properties": { "value": { "enum": [] } },+ "required": []+ },+ "instances": [+ { "input": {}, "accepted": true },+ { "input": { "value": null }, "accepted": false }+ ]+ },{"id": "additional-property-default-materialization","description": "Composio divergence: a schema-valued `additionalProperties` also materializes defaults in Zod and Pydantic while Effect leaves the input unchanged.",@@ -677,6 +1004,170 @@"python": { "output": { "name": "a", "extra": { "enabled": false } } }}]+ },+ {+ "id": "composition-fixed-tuple-items",+ "description": "Draft 7 tuple items preserve position, optional shorter arrays, and an additionalItems false bound.",+ "schema": {+ "$schema": "http://json-schema.org/draft-07/schema#",+ "type": "object",+ "properties": {+ "value": {+ "type": "array",+ "items": [{ "type": "string" }, { "type": "integer" }],+ "additionalItems": false+ }+ },+ "required": ["value"]+ },+ "instances": [+ { "input": { "value": [] }, "accepted": true },+ { "input": { "value": ["ready"] }, "accepted": true },+ { "input": { "value": ["ready", 2] }, "accepted": true },+ { "input": { "value": [2, "ready"] }, "accepted": false },+ { "input": { "value": ["ready", 2, true] }, "accepted": false }+ ]+ },+ {+ "id": "composition-open-tuple-items",+ "description": "Tuple items default to Draft 7 and allow unconstrained trailing values unless additionalItems closes them.",+ "schema": {+ "type": "object",+ "properties": {+ "value": {+ "type": "array",+ "items": [{ "type": "string" }, { "type": "integer" }]+ }+ },+ "required": ["value"]+ },+ "instances": [+ { "input": { "value": ["ready", 2, { "extra": true }] }, "accepted": true },+ { "input": { "value": ["ready", "wrong"] }, "accepted": false }+ ]+ },+ {+ "id": "composition-false-tuple-position",+ "description": "A false positional schema rejects a value only when that position is present.",+ "schema": {+ "$schema": "http://json-schema.org/draft-07/schema#",+ "type": "object",+ "properties": {+ "value": {+ "type": "array",+ "items": [{ "type": "string" }, false],+ "additionalItems": false+ }+ },+ "required": ["value"]+ },+ "instances": [+ { "input": { "value": ["ready"] }, "accepted": true },+ { "input": { "value": ["ready", "forbidden"] }, "accepted": false }+ ]+ },+ {+ "id": "composition-allof-object-intersection",+ "description": "Every allOf object branch remains required after conversion.",+ "schema": {+ "type": "object",+ "properties": {+ "value": {+ "allOf": [+ {+ "type": "object",+ "properties": { "a": { "type": "string" } },+ "required": ["a"],+ "additionalProperties": true+ },+ {+ "type": "object",+ "properties": { "b": { "type": "integer" } },+ "required": ["b"],+ "additionalProperties": true+ }+ ]+ }+ },+ "required": ["value"]+ },+ "instances": [+ { "input": { "value": { "a": "ready", "b": 2 } }, "accepted": true },+ { "input": { "value": { "a": "ready" } }, "accepted": false },+ { "input": { "value": { "b": 2 } }, "accepted": false }+ ]+ },+ {+ "id": "composition-allof-closed-object-branches",+ "description": "Closed allOf object branches merge instead of rejecting each other's keys; the union of declared keys stays strict.",+ "schema": {+ "type": "object",+ "properties": {+ "value": {+ "allOf": [+ {+ "type": "object",+ "properties": { "a": { "type": "string" } },+ "required": ["a"]+ },+ {+ "type": "object",+ "properties": { "b": { "type": "string" } },+ "required": ["b"]+ }+ ]+ }+ },+ "required": ["value"]+ },+ "instances": [+ { "input": { "value": { "a": "ready", "b": "set" } }, "accepted": true },+ { "input": { "value": { "a": "ready" } }, "accepted": false },+ { "input": { "value": { "a": "ready", "b": "set", "c": 1 } }, "accepted": false }+ ]+ },+ {+ "id": "composition-scalar-allof",+ "description": "Scalar allOf branches combine rather than selecting the first branch.",+ "schema": {+ "type": "object",+ "properties": {+ "value": {+ "allOf": [+ { "type": "string", "minLength": 2 },+ { "type": "string", "pattern": "^[A-Z]+$" }+ ]+ }+ },+ "required": ["value"]+ },+ "instances": [+ { "input": { "value": "OK" }, "accepted": true },+ { "input": { "value": "O" }, "accepted": false },+ { "input": { "value": "ok" }, "accepted": false }+ ]+ },+ {+ "id": "composition-oneof-exclusive-match",+ "description": "oneOf accepts exactly one matching branch, not a plain union of branches.",+ "schema": {+ "type": "object",+ "properties": {+ "value": {+ "oneOf": [+ { "type": "number", "minimum": 0 },+ { "type": "number", "maximum": 0 }+ ]+ }+ },+ "required": ["value"]+ },+ "instances": [+ { "input": { "value": 1 }, "accepted": true },+ { "input": { "value": -1 }, "accepted": true },+ { "input": { "value": 0 }, "accepted": false },+ { "input": { "value": "0" }, "accepted": false }+ ]}]}diff --git a/ts/packages/json-schema-to-effect-schema/src/index.ts b/ts/packages/json-schema-to-effect-schema/src/index.tsindex 9e74acc09..1f9889bf1 100644--- a/ts/packages/json-schema-to-effect-schema/src/index.ts+++ b/ts/packages/json-schema-to-effect-schema/src/index.ts@@ -56,6 +56,53 @@ const isObjectSchema = (schema: JsonObject): boolean =>const hasNamedProperties = (schema: JsonObject): boolean =>isJsonObject(schema.properties) && Object.keys(schema.properties).length > 0;+const isClosedObjectBranch = (branch: unknown): branch is JsonObject =>+ isJsonObject(branch) &&+ isObjectSchema(branch) &&+ hasNamedProperties(branch) &&+ branch.additionalProperties === undefined &&+ branch.patternProperties === undefined &&+ branch.$ref === undefined;++// Sibling `allOf` object branches must not reject each other's keys, so each+// closed branch is materialized open and the strictness a lone named-property+// object would have had is re-applied once, over the union of every branch's+// properties. Mirrors `parseAllOf` in @composio/json-schema-to-zod.+const openAllOfBranches = (source: JsonObject, normalized: JsonObject): void => {+ const sourceBranches = source.allOf;+ const branches = normalized.allOf;+ if (!Array.isArray(sourceBranches) || !Array.isArray(branches) || branches.length < 2) {+ return;+ }++ const closed = sourceBranches.map(isClosedObjectBranch);+ if (!closed.some(Boolean)) {+ return;+ }++ branches.forEach((branch, index) => {+ if (closed[index] && isJsonObject(branch)) {+ branch.additionalProperties = true;+ }+ });++ if (+ !closed.every(Boolean) ||+ normalized.properties !== undefined ||+ normalized.patternProperties !== undefined ||+ normalized.additionalProperties !== undefined+ ) {+ return;+ }++ normalized.properties = Object.fromEntries(+ sourceBranches.flatMap(branch =>+ Object.keys((branch as JsonObject).properties as JsonObject).map(key => [key, true])+ )+ );+ normalized.additionalProperties = false;+};+const appendAllOf = (schema: JsonObject, constraint: JsonObject): void => {const current = schema.allOf;schema.allOf = Array.isArray(current) ? [...current, constraint] : [constraint];@@ -87,6 +134,26 @@ const normalizeBounds = (schema: JsonObject): void => {}};+// OpenAPI 3.0 / JSON Schema draft-4 express exclusive bounds as a boolean flag+// on `minimum`/`maximum`. The Draft 7 interpreter expects numeric+// `exclusiveMinimum`/`exclusiveMaximum` and would silently ignore the flag,+// turning an exclusive bound into an inclusive one.+const normalizeExclusiveBounds = (schema: JsonObject): void => {+ if (schema.exclusiveMinimum === true && typeof schema.minimum === 'number') {+ schema.exclusiveMinimum = schema.minimum;+ delete schema.minimum;+ } else if (typeof schema.exclusiveMinimum === 'boolean') {+ delete schema.exclusiveMinimum;+ }++ if (schema.exclusiveMaximum === true && typeof schema.maximum === 'number') {+ schema.exclusiveMaximum = schema.maximum;+ delete schema.maximum;+ } else if (typeof schema.exclusiveMaximum === 'boolean') {+ delete schema.exclusiveMaximum;+ }+};+const normalizeFormats = (schema: JsonObject): void => {if (schema.type === 'number' && schema.format === 'int64') {schema.type = 'integer';@@ -132,6 +199,7 @@ const normalizeNullable = (schema: JsonObject): JsonObject => {const normalizeSchemaNode = (value: unknown,+ draft: SchemaDraft,seen: WeakMap<object, InterpreterSchema | boolean>): InterpreterSchema | boolean => {if (typeof value === 'boolean') {@@ -152,14 +220,17 @@ const normalizeSchemaNode = (for (const [key, child] of Object.entries(value)) {if (schemaMapKeywords.has(key) && isJsonObject(child)) {normalized[key] = Object.fromEntries(- Object.entries(child).map(([name, nested]) => [name, normalizeSchemaNode(nested, seen)])+ Object.entries(child).map(([name, nested]) => [+ name,+ normalizeSchemaNode(nested, draft, seen),+ ]));} else if (schemaArrayKeywords.has(key) && Array.isArray(child)) {- normalized[key] = child.map(nested => normalizeSchemaNode(nested, seen));+ normalized[key] = child.map(nested => normalizeSchemaNode(nested, draft, seen));} else if (schemaValueKeywords.has(key)) {normalized[key] = Array.isArray(child)- ? child.map(nested => normalizeSchemaNode(nested, seen))- : normalizeSchemaNode(child, seen);+ ? child.map(nested => normalizeSchemaNode(nested, draft, seen))+ : normalizeSchemaNode(child, draft, seen);} else {normalized[key] = child;}@@ -178,15 +249,23 @@ const normalizeSchemaNode = (normalized.additionalProperties = false;}+ openAllOfBranches(value, normalized);+normalizeBounds(normalized);+ // Draft 4 is the dialect that defines the boolean spelling, and the+ // interpreter honors it there; rewriting would hand it a numeric bound it+ // ignores under that draft.+ if (draft !== '4') {+ normalizeExclusiveBounds(normalized);+ }normalizeFormats(normalized);const withNullable = normalizeNullable(normalized);seen.set(value, withNullable as InterpreterSchema);return withNullable as InterpreterSchema;};-const normalizeJsonSchema = (schema: JsonObject): InterpreterSchema =>- normalizeSchemaNode(schema, new WeakMap()) as InterpreterSchema;+const normalizeJsonSchema = (schema: JsonObject, draft: SchemaDraft): InterpreterSchema =>+ normalizeSchemaNode(schema, draft, new WeakMap()) as InterpreterSchema;// Walks the same child positions `normalizeSchemaNode` does, so a node is// visited exactly where the interpreter would descend into it.@@ -450,8 +529,9 @@ export const jsonSchemaToEffectSchema = (jsonSchema: JsonObject,options: JsonSchemaToEffectSchemaOptions = {}): Schema.Schema<unknown> => {- const normalizedSchema = normalizeJsonSchema(jsonSchema);- const validator = new Validator(normalizedSchema, options.draft ?? '7', false);+ const draft = options.draft ?? '7';+ const normalizedSchema = normalizeJsonSchema(jsonSchema, draft);+ const validator = new Validator(normalizedSchema, draft, false);assertSchemaIsInterpretable(normalizedSchema);const formatIssues = options.formatIssues ?? defaultFormatIssues;diff --git a/ts/packages/json-schema-to-effect-schema/test/json-schema-to-effect-schema.test.ts b/ts/packages/json-schema-to-effect-schema/test/json-schema-to-effect-schema.test.tsindex 5bc16e50e..f100982b1 100644--- a/ts/packages/json-schema-to-effect-schema/test/json-schema-to-effect-schema.test.ts+++ b/ts/packages/json-schema-to-effect-schema/test/json-schema-to-effect-schema.test.ts@@ -56,6 +56,17 @@ describe('jsonSchemaToEffectSchema', () => {expectParity({ type: 'string', format: 'ip' }, 'not-an-ip', false);});+ it('honors the boolean exclusive bound under an explicit Draft 4', () => {+ const schema = { type: 'number', minimum: 1, exclusiveMinimum: true } satisfies JsonSchema;+ const accepts = (input: unknown, draft?: '4'): boolean =>+ Option.isSome(Schema.decodeUnknownOption(jsonSchemaToEffectSchema(schema, { draft }))(input));++ expect(accepts(1, '4')).toBe(false);+ expect(accepts(2, '4')).toBe(true);+ expect(accepts(1)).toBe(false);+ expect(accepts(2)).toBe(true);+ });+it('supports JSON Schema composition without generated code', () => {const schema = {type: 'object',diff --git a/ts/packages/json-schema-to-zod/package.json b/ts/packages/json-schema-to-zod/package.jsonindex 92244cafa..4ab16fb6d 100644--- a/ts/packages/json-schema-to-zod/package.json+++ b/ts/packages/json-schema-to-zod/package.json@@ -48,6 +48,8 @@"devDependencies": {"@types/json-schema": "^7.0.15","@types/node": "^26.3.0",+ "ajv": "^8.20.0",+ "fast-check": "^4.9.0","tsdown": "catalog:","typescript": "catalog:","vitest": "catalog:",@@ -55,5 +57,9 @@},"peerDependencies": {"zod": ">=3.25.76 <5"+ },+ "dependencies": {+ "@cfworker/json-schema": "^4.1.1",+ "dequal": "^2.0.3"}}diff --git a/ts/packages/json-schema-to-zod/src/json-schema-to-zod.ts b/ts/packages/json-schema-to-zod/src/json-schema-to-zod.tsindex dd3f60b48..e4067fc26 100644--- a/ts/packages/json-schema-to-zod/src/json-schema-to-zod.ts+++ b/ts/packages/json-schema-to-zod/src/json-schema-to-zod.ts@@ -1,18 +1,27 @@-import type { z, ZodTypeAny } from 'zod/v3';+import { z, type ZodTypeAny } from 'zod/v3';import { parseSchema } from './parsers/parse-schema';import { parseObjectShape } from './parsers/parse-object-shape';import type { JsonSchemaToZodOptions, JsonSchema, JsonSchemaObject } from './types';+import {+ requiresWholeSchemaValidation,+ withWholeSchemaValidation,+} from './whole-schema-validation';export const jsonSchemaToZod = (schema: JsonSchema,options: JsonSchemaToZodOptions = {}): z.ZodType => {- return parseSchema(schema, {+ const parsedSchema = parseSchema(schema, {path: [],seen: new Map(),+ root: schema,...options,});++ return requiresWholeSchemaValidation(schema)+ ? withWholeSchemaValidation(schema, parsedSchema)+ : parsedSchema;};/**@@ -46,6 +55,7 @@ export const jsonSchemaToZodShape = (return parseObjectShape(objectSchema, {path: [],seen: new Map(),+ root: objectSchema,...options,});};diff --git a/ts/packages/json-schema-to-zod/src/parsers/parse-all-of.ts b/ts/packages/json-schema-to-zod/src/parsers/parse-all-of.tsindex 7610cde15..5e710724a 100644--- a/ts/packages/json-schema-to-zod/src/parsers/parse-all-of.ts+++ b/ts/packages/json-schema-to-zod/src/parsers/parse-all-of.ts@@ -3,6 +3,7 @@ import { z } from 'zod/v3';import { parseSchema } from './parse-schema';import type { JsonSchemaObject, JsonSchema, Refs } from '../types';import { half } from '../utils/half';+import { its } from '../utils/its';const originalIndex = Symbol('Original index');@@ -23,6 +24,31 @@ const ensureOriginalIndex = (arr: JsonSchema[]) => {return newArr;};+const isClosedObjectBranch = (+ branch: JsonSchema+): branch is JsonSchemaObject & { properties: Record<string, JsonSchema> } =>+ typeof branch === 'object' &&+ its.an.object(branch) &&+ branch.properties !== undefined &&+ Object.keys(branch.properties).length > 0 &&+ branch.additionalProperties === undefined &&+ branch.patternProperties === undefined &&+ !('$ref' in branch);++const intersect = (branches: JsonSchema[], refs: Refs): z.ZodTypeAny => {+ if (branches.length === 1) {+ const item = branches[0];++ return parseSchema(item, {+ ...refs,+ path: [...refs.path, 'allOf', (item as never)[originalIndex]],+ });+ }++ const [left, right] = half(branches);+ return z.intersection(intersect(left, refs), intersect(right, refs));+};+export function parseAllOf(jsonSchema: JsonSchemaObject & { allOf: JsonSchema[] },refs: Refs@@ -32,15 +58,34 @@ export function parseAllOf(}if (jsonSchema.allOf.length === 1) {- const item = jsonSchema.allOf[0];+ return intersect(ensureOriginalIndex(jsonSchema.allOf), refs);+ }- return parseSchema(item, {- ...refs,- path: [...refs.path, 'allOf', (item as never)[originalIndex]],- });+ // Sibling object branches must not reject each other's keys: each branch is+ // materialized open, and the strictness a lone named-property object would+ // have had is re-applied once over the union of every branch's properties.+ const opened = jsonSchema.allOf.map(branch =>+ isClosedObjectBranch(branch) ? { ...branch, additionalProperties: true } : branch+ );+ const parsed = intersect(ensureOriginalIndex(opened), refs);++ if (!jsonSchema.allOf.every(isClosedObjectBranch)) {+ return parsed;}- const [left, right] = half(ensureOriginalIndex(jsonSchema.allOf));+ const declaredKeys = new Set(+ jsonSchema.allOf.flatMap(branch => Object.keys((branch as JsonSchemaObject).properties ?? {}))+ );- return z.intersection(parseAllOf({ allOf: left }, refs), parseAllOf({ allOf: right }, refs));+ return parsed.superRefine((value, ctx) => {+ if (typeof value !== 'object' || value === null || Array.isArray(value)) return;+ const unrecognizedKeys = Object.keys(value).filter(key => !declaredKeys.has(key));+ if (unrecognizedKeys.length > 0) {+ ctx.addIssue({+ code: z.ZodIssueCode.unrecognized_keys,+ keys: unrecognizedKeys,+ message: `Unrecognized key(s) in object: ${unrecognizedKeys.map(key => `'${key}'`).join(', ')}`,+ });+ }+ });}diff --git a/ts/packages/json-schema-to-zod/src/parsers/parse-array.ts b/ts/packages/json-schema-to-zod/src/parsers/parse-array.tsindex 8a9983991..7ffb10ae9 100644--- a/ts/packages/json-schema-to-zod/src/parsers/parse-array.ts+++ b/ts/packages/json-schema-to-zod/src/parsers/parse-array.ts@@ -58,11 +58,46 @@ export const parseArray = (jsonSchema: JsonSchemaObject & { type: 'array' }, ref// Handle regular array schemaif (Array.isArray(jsonSchema.items)) {- return z.tuple(- jsonSchema.items.map((v, i) =>- parseSchema(v, { ...refs, path: [...refs.path, 'items', i] })- ) as [z.ZodTypeAny]+ const parsedItems = jsonSchema.items.map((item, index) =>+ parseSchema(item, { ...refs, path: [...refs.path, 'items', index] }));+ const prefixSchemas = parsedItems.map((_, length) =>+ z.tuple(parsedItems.slice(0, length) as unknown as [z.ZodTypeAny])+ );+ const fullTuple = z.tuple(parsedItems as unknown as [z.ZodTypeAny]);++ let fullLengthSchema: z.ZodTypeAny;+ if (jsonSchema.additionalItems === false) {+ fullLengthSchema = fullTuple;+ } else if (jsonSchema.additionalItems && jsonSchema.additionalItems !== true) {+ fullLengthSchema = fullTuple.rest(+ parseSchema(jsonSchema.additionalItems, {+ ...refs,+ path: [...refs.path, 'additionalItems'],+ })+ );+ } else {+ fullLengthSchema = fullTuple.rest(z.any());+ }++ const variants = [...prefixSchemas, fullLengthSchema];+ let tupleSchema: z.ZodTypeAny =+ variants.length === 1+ ? variants[0]+ : z.union(variants as unknown as [z.ZodTypeAny, z.ZodTypeAny, ...z.ZodTypeAny[]]);++ if (typeof jsonSchema.minItems === 'number') {+ tupleSchema = tupleSchema.refine(value => value.length >= jsonSchema.minItems!, {+ message: `Array must contain at least ${jsonSchema.minItems} element(s)`,+ });+ }+ if (typeof jsonSchema.maxItems === 'number') {+ tupleSchema = tupleSchema.refine(value => value.length <= jsonSchema.maxItems!, {+ message: `Array must contain at most ${jsonSchema.maxItems} element(s)`,+ });+ }++ return tupleSchema;}let zodSchema = !jsonSchema.itemsdiff --git a/ts/packages/json-schema-to-zod/src/parsers/parse-const.ts b/ts/packages/json-schema-to-zod/src/parsers/parse-const.tsindex 374e3f451..0ae1317ff 100644--- a/ts/packages/json-schema-to-zod/src/parsers/parse-const.ts+++ b/ts/packages/json-schema-to-zod/src/parsers/parse-const.ts@@ -1,7 +1,10 @@-import { z } from 'zod/v3';+import { parseLiteralValues } from './parse-literal-values';+import { parseSchema } from './parse-schema';+import type { JsonSchemaObject, Refs, Serializable } from '../types';-import type { JsonSchemaObject, Serializable } from '../types';--export const parseConst = (jsonSchema: JsonSchemaObject & { const: Serializable }) => {- return z.literal(jsonSchema.const as z.Primitive);+export const parseConst = (jsonSchema: JsonSchemaObject & { const: Serializable }, refs: Refs) => {+ const { const: value, ...baseSchema } = jsonSchema;+ return parseSchema(baseSchema, { ...refs, seen: new Map(refs.seen) }, true).and(+ parseLiteralValues([value])+ );};diff --git a/ts/packages/json-schema-to-zod/src/parsers/parse-enum.ts b/ts/packages/json-schema-to-zod/src/parsers/parse-enum.tsindex 26975bc86..bdb1e6f1f 100644--- a/ts/packages/json-schema-to-zod/src/parsers/parse-enum.ts+++ b/ts/packages/json-schema-to-zod/src/parsers/parse-enum.ts@@ -1,22 +1,10 @@-import { z } from 'zod/v3';--import type { JsonSchemaObject, Serializable } from '../types';--export const parseEnum = (jsonSchema: JsonSchemaObject & { enum: Serializable[] }) => {- if (jsonSchema.enum.length === 0) {- return z.never();- }-- if (jsonSchema.enum.length === 1) {- // union does not work when there is only one element- return z.literal(jsonSchema.enum[0] as z.Primitive);- }-- if (jsonSchema.enum.every(x => typeof x === 'string')) {- return z.enum(jsonSchema.enum as [string]);- }-- return z.union(- jsonSchema.enum.map(x => z.literal(x as z.Primitive)) as unknown as [z.ZodTypeAny, z.ZodTypeAny]+import { parseLiteralValues } from './parse-literal-values';+import { parseSchema } from './parse-schema';+import type { JsonSchemaObject, Refs, Serializable } from '../types';++export const parseEnum = (jsonSchema: JsonSchemaObject & { enum: Serializable[] }, refs: Refs) => {+ const { enum: values, ...baseSchema } = jsonSchema;+ return parseSchema(baseSchema, { ...refs, seen: new Map(refs.seen) }, true).and(+ parseLiteralValues(values));};diff --git a/ts/packages/json-schema-to-zod/src/parsers/parse-literal-values.ts b/ts/packages/json-schema-to-zod/src/parsers/parse-literal-values.tsnew file mode 100644index 000000000..613206c93--- /dev/null+++ b/ts/packages/json-schema-to-zod/src/parsers/parse-literal-values.ts@@ -0,0 +1,21 @@+import { dequal } from 'dequal/lite';+import { z } from 'zod/v3';++import type { Serializable } from '../types';++export const parseLiteralValues = (values: ReadonlyArray<Serializable>): z.ZodTypeAny => {+ if (values.length === 0) return z.never();++ if (values.every(value => value === null || typeof value !== 'object')) {+ if (values.length === 1) return z.literal(values[0] as z.Primitive);+ if (values.every(value => typeof value === 'string')) return z.enum(values as [string]);+ return z.union(+ values.map(value => z.literal(value as z.Primitive)) as unknown as [+ z.ZodTypeAny,+ z.ZodTypeAny,+ ]+ );+ }++ return z.custom<Serializable>(value => values.some(candidate => dequal(value, candidate)));+};diff --git a/ts/packages/json-schema-to-zod/src/parsers/parse-number.ts b/ts/packages/json-schema-to-zod/src/parsers/parse-number.tsindex ab9ede834..ce5dd5f5d 100644--- a/ts/packages/json-schema-to-zod/src/parsers/parse-number.ts+++ b/ts/packages/json-schema-to-zod/src/parsers/parse-number.ts@@ -3,6 +3,41 @@ import { z } from 'zod/v3';import type { JsonSchemaObject } from '../types';import { extendSchemaWithMessage } from '../utils/extend-schema';+type DecimalInteger = {+ readonly integer: bigint;+ readonly scale: number;+};++const toDecimalInteger = (value: number): DecimalInteger | undefined => {+ if (!Number.isFinite(value)) return undefined;++ const negative = value < 0;+ const [coefficient, exponentText] = Math.abs(value).toString().toLowerCase().split('e');+ const exponent = exponentText === undefined ? 0 : Number(exponentText);+ const [whole, fraction = ''] = coefficient.split('.');+ let digits = `${whole}${fraction}`.replace(/^0+(?=\d)/, '');+ let scale = fraction.length - exponent;++ if (scale < 0) {+ digits += '0'.repeat(-scale);+ scale = 0;+ }++ const integer = BigInt(`${negative ? '-' : ''}${digits}`);+ return { integer, scale };+};++const isJsonMultipleOf = (value: number, multiple: number): boolean => {+ const dividend = toDecimalInteger(value);+ const divisor = toDecimalInteger(multiple);+ if (!dividend || !divisor || divisor.integer === 0n) return false;++ const scale = Math.max(dividend.scale, divisor.scale);+ const scaledDividend = dividend.integer * 10n ** BigInt(scale - dividend.scale);+ const scaledDivisor = divisor.integer * 10n ** BigInt(scale - divisor.scale);+ return scaledDividend % scaledDivisor === 0n;+};+export const parseNumber = (jsonSchema: JsonSchemaObject & { type: 'number' | 'integer' }) => {let zodSchema = z.number();@@ -19,21 +54,6 @@ export const parseNumber = (jsonSchema: JsonSchemaObject & { type: 'number' | 'i);}- zodSchema = extendSchemaWithMessage(- zodSchema,- jsonSchema,- 'multipleOf',- (zs, multipleOf, errorMsg) => {- if (multipleOf === 1) {- if (isInteger) return zs;-- return zs.int(errorMsg);- }-- return zs.multipleOf(multipleOf, errorMsg);- }- );-if (typeof jsonSchema.minimum === 'number') {if ((jsonSchema as unknown as { exclusiveMinimum?: boolean }).exclusiveMinimum === true) {zodSchema = extendSchemaWithMessage(@@ -50,7 +70,8 @@ export const parseNumber = (jsonSchema: JsonSchemaObject & { type: 'number' | 'i(zs, minimum, errorMsg) => zs.gte(minimum, errorMsg));}- } else if (typeof jsonSchema.exclusiveMinimum === 'number') {+ }+ if (typeof jsonSchema.exclusiveMinimum === 'number') {zodSchema = extendSchemaWithMessage(zodSchema,jsonSchema,@@ -75,7 +96,8 @@ export const parseNumber = (jsonSchema: JsonSchemaObject & { type: 'number' | 'i(zs, maximum, errorMsg) => zs.lte(maximum, errorMsg));}- } else if (typeof jsonSchema.exclusiveMaximum === 'number') {+ }+ if (typeof jsonSchema.exclusiveMaximum === 'number') {zodSchema = extendSchemaWithMessage(zodSchema,jsonSchema,@@ -104,5 +126,17 @@ export const parseNumber = (jsonSchema: JsonSchemaObject & { type: 'number' | 'i);}+ if (typeof jsonSchema.multipleOf === 'number') {+ const errorMessage = (+ jsonSchema as JsonSchemaObject & { errorMessage?: Record<string, string> }+ ).errorMessage?.multipleOf;+ if (jsonSchema.multipleOf === 1) {+ return isInteger ? zodSchema : zodSchema.int(errorMessage);+ }+ return zodSchema.refine(value => isJsonMultipleOf(value, jsonSchema.multipleOf!), {+ message: errorMessage ?? `Number must be a multiple of ${jsonSchema.multipleOf}`,+ });+ }+return zodSchema;};diff --git a/ts/packages/json-schema-to-zod/src/parsers/parse-object-shape.ts b/ts/packages/json-schema-to-zod/src/parsers/parse-object-shape.tsindex feb0d4ab3..13f02f0b5 100644--- a/ts/packages/json-schema-to-zod/src/parsers/parse-object-shape.ts+++ b/ts/packages/json-schema-to-zod/src/parsers/parse-object-shape.ts@@ -2,6 +2,11 @@ import * as z from 'zod/v3';import { parseSchema } from './parse-schema';import type { JsonSchemaObject, Refs, JsonSchema } from '../types';+import {+ guardSchemaAt,+ requiresWholeSchemaValidation,+ withWholeSchemaValidation,+} from '../whole-schema-validation';/*** Parses a JSON Schema object and returns the raw shape (property keys mapped to Zod types).@@ -25,11 +30,16 @@ export function parseObjectShape(objectSchema: JsonSchemaObject, refs: Refs): z.for (const key of propertyKeys) {const propJsonSchema = objectSchema.properties[key];-- const propZodSchema = parseSchema(propJsonSchema, {+ const propRefs = {...refs,+ root: refs.root ?? objectSchema,path: [...refs.path, 'properties', key],- });+ };++ const parsedProperty = parseSchema(propJsonSchema, propRefs);+ const propZodSchema = requiresWholeSchemaValidation(propJsonSchema)+ ? withWholeSchemaValidation(guardSchemaAt(propJsonSchema, propRefs), parsedProperty)+ : parsedProperty;const required = Array.isArray(objectSchema.required)? objectSchema.required.includes(key)diff --git a/ts/packages/json-schema-to-zod/src/parsers/parse-schema.ts b/ts/packages/json-schema-to-zod/src/parsers/parse-schema.tsindex e983d6981..9b5f1c563 100644--- a/ts/packages/json-schema-to-zod/src/parsers/parse-schema.ts+++ b/ts/packages/json-schema-to-zod/src/parsers/parse-schema.ts@@ -16,8 +16,17 @@ import { parseNumber } from './parse-number';import { parseObject } from './parse-object';import { parseOneOf } from './parse-one-of';import { parseString } from './parse-string';+import {+ hasTypelessScalarConstraints,+ parseTypelessConstraints,+} from './parse-typeless-constraints';import type { ParserSelector, Refs, JsonSchemaObject, JsonSchema } from '../types';import { its } from '../utils/its';+import {+ guardSchemaAt,+ requiresPermissiveMaterialization,+ withWholeSchemaValidation,+} from '../whole-schema-validation';const addDescribes = (jsonSchema: JsonSchemaObject, zodSchema: z.ZodTypeAny): z.ZodTypeAny => {let description = '';@@ -88,8 +97,18 @@ const addAnnotations = (jsonSchema: JsonSchemaObject, zodSchema: z.ZodTypeAny):};const selectParser: ParserSelector = (schema, refs) => {- if (its.a.nullable(schema)) {+ if (requiresPermissiveMaterialization(schema)) {+ // Widen only this node, and let it guard itself so combinators such as+ // `oneOf` still discriminate between branches that were widened.+ return withWholeSchemaValidation(guardSchemaAt(schema, refs), z.any());+ } else if (its.a.nullable(schema)) {return parseNullable(schema, refs);+ } else if (its.an.enum(schema)) {+ // `enum`/`const` intersect the declared type, so they must win over the+ // object and array parsers or a literal object/array value is never checked.+ return parseEnum(schema, refs);+ } else if (its.a.const(schema)) {+ return parseConst(schema, refs);} else if (its.an.object(schema)) {return parseObject(schema, refs);} else if (its.an.array(schema)) {@@ -102,10 +121,8 @@ const selectParser: ParserSelector = (schema, refs) => {return parseOneOf(schema, refs);} else if (its.a.not(schema)) {return parseNot(schema, refs);- } else if (its.an.enum(schema)) {- return parseEnum(schema); //<-- needs to come before primitives- } else if (its.a.const(schema)) {- return parseConst(schema);+ } else if (hasTypelessScalarConstraints(schema)) {+ return parseTypelessConstraints(schema);} else if (its.a.multipleType(schema)) {return parseMultipleType(schema, refs);} else if (its.a.primitive(schema, 'string')) {diff --git a/ts/packages/json-schema-to-zod/src/parsers/parse-string.ts b/ts/packages/json-schema-to-zod/src/parsers/parse-string.tsindex 60575fff0..f8f18bd45 100644--- a/ts/packages/json-schema-to-zod/src/parsers/parse-string.ts+++ b/ts/packages/json-schema-to-zod/src/parsers/parse-string.ts@@ -41,38 +41,37 @@ export const parseString = (jsonSchema: JsonSchemaObject & { type: 'string' }) =zodSchema = extendSchemaWithMessage(zodSchema, jsonSchema, 'pattern', (zs, pattern, errorMsg) =>zs.regex(new RegExp(pattern), errorMsg));- zodSchema = extendSchemaWithMessage(- zodSchema,- jsonSchema,- 'minLength',- (zs, minLength, errorMsg) => zs.min(minLength, errorMsg)- );- zodSchema = extendSchemaWithMessage(- zodSchema,- jsonSchema,- 'maxLength',- (zs, maxLength, errorMsg) => zs.max(maxLength, errorMsg)- );+ // JSON Schema length constraints count Unicode code points, while Zod's+ // built-in `.min()`/`.max()` count UTF-16 code units and overcount astral+ // glyphs, so both bounds are applied as code-point refinements.+ const errorMessages = (jsonSchema as { errorMessage?: Record<string, string> }).errorMessage;+ // 'min'/'max' are generic aliases for 'minLength'/'maxLength'+ const minLength =+ typeof jsonSchema.minLength === 'number'+ ? jsonSchema.minLength+ : typeof jsonSchema.min === 'number'+ ? jsonSchema.min+ : undefined;+ const maxLength =+ typeof jsonSchema.maxLength === 'number'+ ? jsonSchema.maxLength+ : typeof jsonSchema.max === 'number'+ ? jsonSchema.max+ : undefined;- // Handle generic 'min' property as alias for 'minLength'- if (typeof jsonSchema.min === 'number' && typeof jsonSchema.minLength !== 'number') {- zodSchema = extendSchemaWithMessage(- zodSchema,- { ...jsonSchema, minLength: jsonSchema.min },- 'minLength',- (zs, minLength, errorMsg) => zs.min(minLength, errorMsg)- );+ let result: z.ZodTypeAny = zodSchema;+ if (minLength !== undefined) {+ result = result.refine(value => codePointLength(value) >= minLength, {+ message: errorMessages?.minLength ?? `String must contain at least ${minLength} character(s)`,+ });}-- // Handle generic 'max' property as alias for 'maxLength'- if (typeof jsonSchema.max === 'number' && typeof jsonSchema.maxLength !== 'number') {- zodSchema = extendSchemaWithMessage(- zodSchema,- { ...jsonSchema, maxLength: jsonSchema.max },- 'maxLength',- (zs, maxLength, errorMsg) => zs.max(maxLength, errorMsg)- );+ if (maxLength !== undefined) {+ result = result.refine(value => codePointLength(value) <= maxLength, {+ message: errorMessages?.maxLength ?? `String must contain at most ${maxLength} character(s)`,+ });}- return zodSchema;+ return result;};++const codePointLength = (value: string): number => [...value].length;diff --git a/ts/packages/json-schema-to-zod/src/parsers/parse-typeless-constraints.ts b/ts/packages/json-schema-to-zod/src/parsers/parse-typeless-constraints.tsnew file mode 100644index 000000000..1504fb303--- /dev/null+++ b/ts/packages/json-schema-to-zod/src/parsers/parse-typeless-constraints.ts@@ -0,0 +1,46 @@+import { z } from 'zod/v3';++import { parseNumber } from './parse-number';+import { parseString } from './parse-string';+import type { JsonSchemaObject } from '../types';++const SCALAR_CONSTRAINT_KEYS = [+ 'minLength',+ 'maxLength',+ 'pattern',+ 'minimum',+ 'maximum',+ 'exclusiveMinimum',+ 'exclusiveMaximum',+ 'multipleOf',+] as const;++export const hasTypelessScalarConstraints = (schema: JsonSchemaObject): boolean =>+ schema.type === undefined && SCALAR_CONSTRAINT_KEYS.some(key => schema[key] !== undefined);++/**+ * Draft 7 applies scalar constraints to matching instance types even when the+ * schema declares no `type`: `{ "minLength": 2 }` restricts strings while+ * leaving every non-string value untouched.+ */+export const parseTypelessConstraints = (schema: JsonSchemaObject): z.ZodTypeAny => {+ const stringSchema = parseString({ ...schema, type: 'string' });+ const numberSchema = parseNumber({ ...schema, type: 'number' });++ return z.any().superRefine((value, ctx) => {+ const applicable =+ typeof value === 'string'+ ? stringSchema+ : typeof value === 'number'+ ? numberSchema+ : undefined;+ if (applicable === undefined) return;++ const result = applicable.safeParse(value);+ if (!result.success) {+ for (const issue of result.error.issues) {+ ctx.addIssue(issue);+ }+ }+ });+};diff --git a/ts/packages/json-schema-to-zod/src/types.ts b/ts/packages/json-schema-to-zod/src/types.tsindex 86de6f259..400b8b899 100644--- a/ts/packages/json-schema-to-zod/src/types.ts+++ b/ts/packages/json-schema-to-zod/src/types.ts@@ -63,4 +63,6 @@ export type JsonSchemaToZodOptions = {export type Refs = JsonSchemaToZodOptions & {path: Array<string | number>;seen: Map<object | boolean, { n: number; r: ZodTypeAny | undefined }>;+ /** The document that local `$ref` pointers resolve against. */+ root?: JsonSchema;};diff --git a/ts/packages/json-schema-to-zod/src/whole-schema-validation.ts b/ts/packages/json-schema-to-zod/src/whole-schema-validation.tsnew file mode 100644index 000000000..3c01237c8--- /dev/null+++ b/ts/packages/json-schema-to-zod/src/whole-schema-validation.ts@@ -0,0 +1,238 @@+import { encodePointer, Validator } from '@cfworker/json-schema';+import type { Schema as InterpreterSchema } from '@cfworker/json-schema';+import { z } from 'zod/v3';++import type { JsonSchema, JsonSchemaObject } from './types';++const REQUIRES_WHOLE_SCHEMA_VALIDATION = new Set([+ '$ref',+ 'additionalItems',+ 'allOf',+ 'anyOf',+ 'contains',+ 'dependencies',+ 'else',+ 'if',+ 'maxProperties',+ 'minProperties',+ 'not',+ 'oneOf',+ 'propertyNames',+ 'then',+ 'uniqueItems',+]);++const TYPELESS_TYPE_SCOPED_KEYWORDS = new Set([+ 'properties',+ 'patternProperties',+ 'additionalProperties',+ 'propertyNames',+ 'required',+ 'dependencies',+ 'minProperties',+ 'maxProperties',+ 'items',+ 'additionalItems',+ 'contains',+ 'minItems',+ 'maxItems',+ 'uniqueItems',+]);++const SCHEMA_MAP_KEYWORDS = new Set([+ '$defs',+ 'definitions',+ 'dependencies',+ 'patternProperties',+ 'properties',+]);++const SCHEMA_ARRAY_KEYWORDS = new Set(['allOf', 'anyOf', 'oneOf']);++const SCHEMA_VALUE_KEYWORDS = new Set([+ 'additionalItems',+ 'additionalProperties',+ 'contains',+ 'else',+ 'if',+ 'items',+ 'not',+ 'propertyNames',+ 'then',+]);++const isObject = (value: unknown): value is Record<string, unknown> =>+ typeof value === 'object' && value !== null && !Array.isArray(value);++const hasRequiredDefault = (schema: JsonSchemaObject): boolean => {+ if (!Array.isArray(schema.required) || !isObject(schema.properties)) {+ return false;+ }++ return schema.required.some(name => {+ const property = schema.properties?.[name];+ return isObject(property) && property.default !== undefined;+ });+};++const hasUnparsedRequiredProperty = (schema: JsonSchemaObject): boolean => {+ if (!Array.isArray(schema.required)) {+ return false;+ }+ const declared = new Set(Object.keys(schema.properties ?? {}));+ return schema.required.some(name => !declared.has(name));+};++/**+ * The native parsers preserve useful Zod structure and materialize defaults,+ * but some JSON Schema assertions cannot be represented by their first-match+ * dispatch. Only those schemas receive an authoritative Draft 7 guard.+ */+export const requiresWholeSchemaValidation = (+ schema: JsonSchema,+ seen: WeakSet<object> = new WeakSet()+): boolean => {+ if (!isObject(schema) || seen.has(schema)) {+ return false;+ }+ seen.add(schema);++ if (+ Object.keys(schema).some(key => REQUIRES_WHOLE_SCHEMA_VALIDATION.has(key)) ||+ (schema.type === undefined &&+ Object.keys(schema).some(key => TYPELESS_TYPE_SCOPED_KEYWORDS.has(key))) ||+ hasUnparsedRequiredProperty(schema) ||+ hasRequiredDefault(schema)+ ) {+ return true;+ }++ for (const [key, child] of Object.entries(schema)) {+ if (SCHEMA_MAP_KEYWORDS.has(key) && isObject(child)) {+ if (+ Object.values(child).some(value => requiresWholeSchemaValidation(value as JsonSchema, seen))+ ) {+ return true;+ }+ } else if (SCHEMA_ARRAY_KEYWORDS.has(key) && Array.isArray(child)) {+ if (child.some(value => requiresWholeSchemaValidation(value as JsonSchema, seen))) {+ return true;+ }+ } else if (SCHEMA_VALUE_KEYWORDS.has(key)) {+ const values = Array.isArray(child) ? child : [child];+ if (values.some(value => requiresWholeSchemaValidation(value as JsonSchema, seen))) {+ return true;+ }+ }+ }++ return false;+};++/**+ * Some schemas are valid for JSON instance types that the native parser does+ * not materialize. Such a node is parsed as `z.any()` so the Draft 7 guard+ * that every one of these keywords also activates (see+ * `requiresWholeSchemaValidation`) stays the acceptance authority without+ * piping into a narrower Zod schema. The check is deliberately local: a+ * permissive descendant must not widen its enclosing parser, or sibling+ * defaults would stop materializing.+ */+export const requiresPermissiveMaterialization = (schema: JsonSchema): boolean =>+ isObject(schema) &&+ ('$ref' in schema ||+ (schema.type === undefined &&+ (Object.keys(schema).some(key => TYPELESS_TYPE_SCOPED_KEYWORDS.has(key)) ||+ ['if', 'then', 'else', 'not'].some(key => key in schema))));++/**+ * The guard schema for a node nested at `path` inside `root`: the enclosing+ * document pointed at that node, so local `$ref`s resolve exactly as they do+ * for the document root. Draft 7 ignores the keywords next to `$ref`, which+ * is what lets the root's own assertions be reused as the pointer carrier.+ */+export const guardSchemaAt = (+ node: JsonSchema,+ refs: { root?: JsonSchema; path: ReadonlyArray<string | number> }+): JsonSchema =>+ isObject(refs.root) && refs.path.length > 0+ ? // `encodePointer` is the interpreter's own key encoding, so the pointer+ // lands on exactly the lookup entry `dereference` registered.+ { ...refs.root, $ref: `#/${refs.path.map(part => encodePointer(String(part))).join('/')}` }+ : node;++/**+ * OpenAPI 3.0 / Draft 4 spell exclusive bounds as a boolean flag next to+ * `minimum`/`maximum`. The Draft 7 interpreter ignores the flag, so the guard+ * receives the numeric spelling the native number parser already honors.+ */+const normalizeExclusiveBounds = (value: unknown, seen: WeakSet<object>): void => {+ if (!isObject(value) || seen.has(value)) {+ return;+ }+ seen.add(value);++ if (value.exclusiveMinimum === true && typeof value.minimum === 'number') {+ value.exclusiveMinimum = value.minimum;+ delete value.minimum;+ } else if (typeof value.exclusiveMinimum === 'boolean') {+ delete value.exclusiveMinimum;+ }+ if (value.exclusiveMaximum === true && typeof value.maximum === 'number') {+ value.exclusiveMaximum = value.maximum;+ delete value.maximum;+ } else if (typeof value.exclusiveMaximum === 'boolean') {+ delete value.exclusiveMaximum;+ }++ for (const [key, child] of Object.entries(value)) {+ if (SCHEMA_MAP_KEYWORDS.has(key) && isObject(child)) {+ Object.values(child).forEach(nested => normalizeExclusiveBounds(nested, seen));+ } else if (SCHEMA_ARRAY_KEYWORDS.has(key) && Array.isArray(child)) {+ child.forEach(nested => normalizeExclusiveBounds(nested, seen));+ } else if (SCHEMA_VALUE_KEYWORDS.has(key)) {+ (Array.isArray(child) ? child : [child]).forEach(nested =>+ normalizeExclusiveBounds(nested, seen)+ );+ }+ }+};++export const withWholeSchemaValidation = (+ jsonSchema: JsonSchema,+ parsedSchema: z.ZodTypeAny+): z.ZodTypeAny => {+ const interpreterSchema = structuredClone(jsonSchema);+ normalizeExclusiveBounds(interpreterSchema, new WeakSet());+ const validator = new Validator(interpreterSchema as InterpreterSchema, '7', false);++ // Validate the source value before defaults and other Zod transforms run.+ // Otherwise a missing required field can be synthesized and incorrectly+ // appear valid to the JSON Schema interpreter.+ const guardedSchema = z+ .any()+ .superRefine((value, ctx) => {+ let result: ReturnType<Validator['validate']>;+ try {+ result = validator.validate(value);+ } catch (cause) {+ ctx.addIssue({+ code: z.ZodIssueCode.custom,+ message: `JSON Schema validation failed: ${String(cause)}`,+ });+ return;+ }++ if (!result.valid) {+ ctx.addIssue({+ code: z.ZodIssueCode.custom,+ message: result.errors[0]?.error ?? 'Input does not satisfy the complete JSON Schema.',+ });+ }+ })+ .pipe(parsedSchema);++ return parsedSchema.description+ ? guardedSchema.describe(parsedSchema.description)+ : guardedSchema;+};diff --git a/ts/packages/json-schema-to-zod/test/json-to-zod.test.ts b/ts/packages/json-schema-to-zod/test/json-to-zod.test.tsindex 8b3f34d8d..524d6e87e 100644--- a/ts/packages/json-schema-to-zod/test/json-to-zod.test.ts+++ b/ts/packages/json-schema-to-zod/test/json-to-zod.test.ts@@ -593,8 +593,9 @@ describe('jsonSchemaToZod', () => {// Should accept number arraysexpect(zodSchema.parse([1, 2, 3])).toEqual([1, 2, 3]);- // Should accept mixed arrays (union of item types)- expect(zodSchema.parse(['hello', 123])).toEqual(['hello', 123]);+ // Each anyOf branch constrains the entire array, so a mixed array+ // satisfies neither the all-string nor the all-number branch.+ expect(() => zodSchema.parse(['hello', 123])).toThrow();});it('should handle arrays with anyOf at top level without explicit types', () => {@@ -1132,8 +1133,8 @@ describe('jsonSchemaToZod', () => {});});- describe('Object Detection Without Explicit Type', () => {- it('should detect object schema with only properties defined', () => {+ describe('Object Assertions Without Explicit Type', () => {+ it('should apply properties only to object instances', () => {const schema: JsonSchema = {properties: {name: { type: 'string' },@@ -1143,11 +1144,10 @@ describe('jsonSchemaToZod', () => {};const zodSchema = jsonSchemaToZod(schema);- // Should parse as an objectexpect(zodSchema.parse({ name: 'John', age: 30 })).toEqual({ name: 'John', age: 30 });expect(zodSchema.parse({ name: 'Jane' })).toEqual({ name: 'Jane' });expect(() => zodSchema.parse({ age: 30 })).toThrow(); // Missing required field- expect(() => zodSchema.parse('not an object')).toThrow();+ expect(zodSchema.parse('not an object')).toBe('not an object');});it('should detect object schema with only additionalProperties defined', () => {@@ -1156,14 +1156,13 @@ describe('jsonSchemaToZod', () => {};const zodSchema = jsonSchemaToZod(schema);- // Should parse as an object with string additional propertiesexpect(zodSchema.parse({})).toEqual({});expect(zodSchema.parse({ key1: 'value1', key2: 'value2' })).toEqual({key1: 'value1',key2: 'value2',});expect(() => zodSchema.parse({ key1: 123 })).toThrow(); // Wrong type- expect(() => zodSchema.parse('not an object')).toThrow();+ expect(zodSchema.parse('not an object')).toBe('not an object');});it('should detect object schema with only patternProperties defined', () => {@@ -1175,14 +1174,13 @@ describe('jsonSchemaToZod', () => {};const zodSchema = jsonSchemaToZod(schema);- // Should parse as an objectexpect(zodSchema.parse({})).toEqual({});expect(zodSchema.parse({ prefix_one: 'value', num_one: 123 })).toEqual({prefix_one: 'value',num_one: 123,});expect(() => zodSchema.parse({ prefix_one: 123 })).toThrow(); // Wrong type for pattern- expect(() => zodSchema.parse('not an object')).toThrow();+ expect(zodSchema.parse('not an object')).toBe('not an object');});it('should detect object schema with properties and additionalProperties but no type', () => {@@ -1493,9 +1491,8 @@ describe('jsonSchemaToZod', () => {};const zodSchema = jsonSchemaToZod(schema);- // Should be treated as an objectexpect(zodSchema.parse({})).toEqual({});- expect(() => zodSchema.parse('not an object')).toThrow();+ expect(zodSchema.parse('not an object')).toBe('not an object');});it('should handle objects with only required field but no type', () => {diff --git a/ts/packages/json-schema-to-zod/test/property-semantics.test.ts b/ts/packages/json-schema-to-zod/test/property-semantics.test.tsnew file mode 100644index 000000000..ded6cf25b--- /dev/null+++ b/ts/packages/json-schema-to-zod/test/property-semantics.test.ts@@ -0,0 +1,150 @@+/**+ * Property-based acceptance parity for scalar JSON Schema conversion.+ *+ * The oracle is Ajv in Draft 7 mode: for every generated scalar schema and+ * instance, the converted Zod schema must accept exactly what the oracle+ * accepts.+ *+ * The generator deliberately stays inside the semantics the converter claims+ * to support today; shrinking an exclusion is the way to turn a fixed+ * behavior into a permanent regression guard. The remaining exclusions are+ * deliberate divergences or oracle limits, not open bugs:+ *+ * - `multipleOf` is always an integer: the converter checks decimal+ * multiples through decimal scaling (see the `primitive-float-multiple-of`+ * corpus case) while the oracle uses raw float modulo+ * - draft-4 boolean `exclusiveMinimum`/`exclusiveMaximum` are never+ * generated: they are not part of Draft 7, so the oracle cannot express+ * them (the `primitive-draft4-boolean-exclusive-bounds` corpus case covers+ * them)+ */+import Ajv from 'ajv';+import fc from 'fast-check';+import { describe, expect, it } from 'vitest';++import { jsonSchemaToZod } from '../src/index';+import type { JsonSchema, Serializable } from '../src/types';++const SCALAR_TYPES = ['string', 'integer', 'number', 'boolean', 'null'] as const;+type ScalarType = (typeof SCALAR_TYPES)[number];++const PATTERN_POOL = ['^[a-z]+$', '^[A-Z]{2}$', '[0-9]', '^a.*z$', '^(?=.*[a-y])a'] as const;+const scalarValue: fc.Arbitrary<Serializable> = fc.oneof(+ fc.constant(null),+ fc.boolean(),+ fc.integer({ min: -100, max: 100 }),+ fc.double({ min: -100, max: 100, noNaN: true, noDefaultInfinity: true }),+ fc.string({+ unit: fc.constantFrom(...'abcdefghijklmnopqrstuvwxyz', '\u{1D11E}'),+ maxLength: 6,+ })+);++type SchemaRecord = Record<string, unknown>;++const scalarSchema: fc.Arbitrary<SchemaRecord> = fc+ .record(+ {+ types: fc.option(+ fc.uniqueArray(fc.constantFrom<ScalarType>(...SCALAR_TYPES), {+ minLength: 1,+ maxLength: 3,+ }),+ { nil: undefined }+ ),+ collapseSingle: fc.boolean(),+ literalKind: fc.constantFrom('none', 'enum', 'const', 'both'),+ enumValues: fc.uniqueArray(scalarValue, {+ minLength: 1,+ maxLength: 4,+ comparator: 'SameValue',+ }),+ constValue: scalarValue,+ minLength: fc.option(fc.integer({ min: 0, max: 4 }), { nil: undefined }),+ maxLength: fc.option(fc.integer({ min: 0, max: 6 }), { nil: undefined }),+ pattern: fc.option(fc.constantFrom(...PATTERN_POOL), { nil: undefined }),+ minimum: fc.option(fc.integer({ min: -20, max: 20 }), { nil: undefined }),+ maximum: fc.option(fc.integer({ min: -20, max: 20 }), { nil: undefined }),+ exclusiveMinimum: fc.option(fc.integer({ min: -20, max: 20 }), { nil: undefined }),+ exclusiveMaximum: fc.option(fc.integer({ min: -20, max: 20 }), { nil: undefined }),+ multipleOf: fc.option(fc.integer({ min: 1, max: 5 }), { nil: undefined }),+ },+ { noNullPrototype: true }+ )+ .map(parts => {+ const schema: SchemaRecord = {};+ const declared: ScalarType[] = parts.types ?? [];++ if (parts.types) {+ schema.type = parts.types.length === 1 && parts.collapseSingle ? parts.types[0] : parts.types;+ }+ if (parts.literalKind === 'enum' || parts.literalKind === 'both')+ schema.enum = parts.enumValues;+ if (parts.literalKind === 'const' || parts.literalKind === 'both')+ schema.const = parts.constValue;++ // Constraints attach independently of the declared type (or its absence):+ // Draft 7 scopes every scalar keyword to matching instance types anyway.+ void declared;+ for (const key of [+ 'minLength',+ 'maxLength',+ 'pattern',+ 'minimum',+ 'maximum',+ 'exclusiveMinimum',+ 'exclusiveMaximum',+ 'multipleOf',+ ] as const) {+ if (parts[key] !== undefined) schema[key] = parts[key];+ }+ return schema;+ });++const schemaAndInstance: fc.Arbitrary<{ schema: SchemaRecord; value: Serializable }> =+ scalarSchema.chain(schema => {+ const interesting: Serializable[] = [];+ if (Array.isArray(schema.enum)) interesting.push(...(schema.enum as Serializable[]));+ if ('const' in schema) interesting.push(schema.const as Serializable);+ for (const key of ['minimum', 'maximum', 'exclusiveMinimum', 'exclusiveMaximum'] as const) {+ const bound = schema[key];+ if (typeof bound === 'number') interesting.push(bound, bound + 1, bound - 1);+ }+ const pools = [scalarValue];+ if (interesting.length > 0) pools.push(fc.constantFrom(...interesting));+ return fc.oneof(...pools).map(value => ({ schema, value }));+ });++const ajv = new Ajv({ strict: false });++describe('scalar conversion matches the Draft 7 oracle', () => {+ it('accepts exactly what Ajv accepts, standalone and object-wrapped', () => {+ fc.assert(+ fc.property(schemaAndInstance, ({ schema, value }) => {+ const objectSchema = {+ type: 'object',+ properties: { value: schema },+ required: ['value'],+ additionalProperties: false,+ };+ const instance = { value };++ const oracleScalar = ajv.compile(schema)(value);+ const zodScalar = jsonSchemaToZod(schema as JsonSchema).safeParse(value).success;+ expect(+ zodScalar,+ `standalone schema=${JSON.stringify(schema)} value=${JSON.stringify(value)}`+ ).toBe(oracleScalar);++ const oracleObject = ajv.compile(objectSchema)(instance);+ const zodObject = jsonSchemaToZod(objectSchema as JsonSchema).safeParse(instance).success;+ expect(+ zodObject,+ `wrapped schema=${JSON.stringify(schema)} value=${JSON.stringify(value)}`+ ).toBe(oracleObject);+ }),+ { numRuns: 300 }+ );+ // 300 Ajv-compiled runs sit close to vitest's 5s default on CI runners.+ }, 30_000);+});diff --git a/ts/packages/json-schema-to-zod/test/semantic-regressions.test.ts b/ts/packages/json-schema-to-zod/test/semantic-regressions.test.tsnew file mode 100644index 000000000..5a41d149d--- /dev/null+++ b/ts/packages/json-schema-to-zod/test/semantic-regressions.test.ts@@ -0,0 +1,330 @@+import Ajv from 'ajv';+import { describe, expect, it } from 'vitest';++import { z } from 'zod/v3';++import { jsonSchemaToZod, jsonSchemaToZodShape } from '../src/index';+import type { JsonSchema } from '../src/types';++type RejectionCase = {+ readonly name: string;+ readonly schema: JsonSchema;+ readonly value: unknown;+};++type AcceptanceCase = RejectionCase;++const ajv = new Ajv({ strict: false });++const rejectionCases: ReadonlyArray<RejectionCase> = [+ {+ name: 'typeless scalar dispatch must not discard object assertions',+ schema: { minLength: 2, required: ['x'] },+ value: {},+ },+ {+ name: 'anyOf must compose with adjacent assertions',+ schema: {+ type: 'string',+ minLength: 2,+ anyOf: [{ const: 'a' }, { const: 'abc' }],+ },+ value: 'a',+ },+ {+ name: 'allOf must compose with adjacent assertions',+ schema: {+ type: 'string',+ maxLength: 1,+ allOf: [{ pattern: '^ab' }],+ },+ value: 'ab',+ },+ {+ name: 'oneOf must compose with adjacent assertions',+ schema: {+ type: 'number',+ minimum: 10,+ oneOf: [{ maximum: 5 }, { minimum: 0 }],+ },+ value: 7,+ },+ {+ name: 'not must compose with adjacent assertions',+ schema: { type: 'string', minLength: 2, not: { const: 'x' } },+ value: 'a',+ },+ {+ name: 'if and then are a complete conditional without else',+ schema: { if: { type: 'string' }, then: { minLength: 2 } },+ value: 'a',+ },+ {+ name: 'conditionals must compose with adjacent primitive assertions',+ schema: {+ type: 'number',+ if: { minimum: 0 },+ then: { maximum: 10 },+ else: { minimum: -10 },+ },+ value: 20,+ },+ {+ name: 'contains must be enforced for typed arrays',+ schema: { type: 'array', contains: { const: 1 } },+ value: [2],+ },+ {+ name: 'uniqueItems must be enforced for typed arrays',+ schema: { type: 'array', uniqueItems: true },+ value: [1, 1],+ },+ {+ name: 'propertyNames must be enforced for typed objects',+ schema: { type: 'object', propertyNames: { pattern: '^x' } },+ value: { bad: 1 },+ },+ {+ name: 'required must be enforced for property-less typed objects',+ schema: { type: 'object', required: ['x'] },+ value: {},+ },+ {+ name: 'required properties must be checked before defaults materialize',+ schema: {+ type: 'object',+ properties: { x: { type: 'string', default: 'generated' } },+ required: ['x'],+ },+ value: {},+ },+ {+ name: 'const must be enforced for typed objects',+ schema: { type: 'object', const: { x: 1 } },+ value: { x: 2 },+ },+ {+ name: 'enum must be enforced for typed arrays',+ schema: { type: 'array', enum: [[1, 2]] },+ value: [2],+ },+ {+ name: 'local references must constrain direct converter callers',+ schema: {+ $defs: { positive: { type: 'number', minimum: 1 } },+ $ref: '#/$defs/positive',+ },+ value: 0,+ },+];++const acceptanceCases: ReadonlyArray<AcceptanceCase> = [+ {+ name: 'typeless properties must accept non-object instances',+ schema: { properties: { x: { type: 'string' } } },+ value: 42,+ },+ {+ name: 'typeless required must accept non-object instances',+ schema: { required: ['x'] },+ value: 42,+ },+ {+ name: 'typeless items must accept non-array instances',+ schema: { items: { type: 'string' } },+ value: 42,+ },+ {+ name: 'typeless array bounds must accept non-array instances',+ schema: { minItems: 2 },+ value: { not: 'an array' },+ },+ {+ name: 'typeless propertyNames must accept non-object instances',+ schema: { propertyNames: { pattern: '^x' } },+ value: 42,+ },+ {+ name: 'typeless dependencies must accept non-object instances',+ schema: { dependencies: { a: ['b'] } },+ value: 42,+ },+ {+ name: 'typeless not can accept a different instance type',+ schema: { not: { type: 'string' } },+ value: 42,+ },+ {+ name: 'typeless conditionals leave nonmatching instance types untouched',+ schema: { if: { type: 'string' }, then: { minLength: 2 } },+ value: 42,+ },+ {+ name: 'a direct local ref accepts values admitted by its target',+ schema: {+ $defs: { positive: { type: 'number', minimum: 1 } },+ $ref: '#/$defs/positive',+ },+ value: 2,+ },+ {+ name: 'const accepts the matching typed object',+ schema: { type: 'object', const: { x: 1 } },+ value: { x: 1 },+ },+ {+ name: 'sibling allOf object branches accept each other declared keys',+ schema: {+ allOf: [+ { type: 'object', properties: { a: { type: 'string' } }, required: ['a'] },+ { type: 'object', properties: { b: { type: 'string' } }, required: ['b'] },+ ],+ },+ value: { a: 'ready', b: 'set' },+ },+ {+ name: 'nested typeless object assertions accept non-object property values',+ schema: {+ type: 'object',+ properties: { value: { properties: { x: { type: 'string' } } } },+ required: ['value'],+ },+ value: { value: 42 },+ },+];++describe('whole-schema semantic regressions', () => {+ it.each(rejectionCases)('$name', ({ schema, value }) => {+ expect(ajv.compile(schema)(value), 'Draft 7 oracle must reject the fixture').toBe(false);+ expect(jsonSchemaToZod(schema).safeParse(value).success).toBe(false);+ });++ it.each(acceptanceCases)('$name', ({ schema, value }) => {+ expect(ajv.compile(schema)(value), 'Draft 7 oracle must accept the fixture').toBe(true);+ expect(jsonSchemaToZod(schema).safeParse(value).success).toBe(true);+ });++ it('resolves local references from a raw shape against the enclosing document', () => {+ const schema: JsonSchema = {+ type: 'object',+ properties: { name: { $ref: '#/$defs/name' } },+ required: ['name'],+ $defs: { name: { type: 'string' } },+ };+ const shape = z.object(jsonSchemaToZodShape(schema));++ expect(shape.safeParse({ name: 'Ada' }).success).toBe(true);+ expect(shape.safeParse({ name: 1 }).success).toBe(false);+ });++ it('keeps sibling defaults when a nested reference widens only its own property', () => {+ const schema: JsonSchema = {+ type: 'object',+ properties: {+ name: { $ref: '#/$defs/n' },+ enabled: { type: 'boolean', default: true },+ },+ $defs: { n: { type: 'string' } },+ };+ const parsed = jsonSchemaToZod(schema);++ expect(parsed.parse({ name: 'Ada' })).toEqual({ name: 'Ada', enabled: true });+ expect(parsed.safeParse({ name: 1 }).success).toBe(false);+ });++ it('keeps allOf branch defaults and stays strict over the union of declared keys', () => {+ const schema: JsonSchema = {+ allOf: [+ { type: 'object', properties: { a: { type: 'string' } }, required: ['a'] },+ { type: 'object', properties: { b: { type: 'string', default: 'set' } } },+ ],+ };+ const parsed = jsonSchemaToZod(schema);++ expect(parsed.parse({ a: 'ready' })).toEqual({ a: 'ready', b: 'set' });+ expect(parsed.safeParse({ a: 'ready', c: 1 }).success).toBe(false);+ });++ it('normalizes Draft 4 exclusive bounds before the whole-schema guard runs', () => {+ const schema = {+ type: 'object',+ propertyNames: { pattern: '^[a-z]+$' },+ properties: { v: { type: 'number', minimum: 0, exclusiveMinimum: true } },+ } as unknown as JsonSchema;+ const parsed = jsonSchemaToZod(schema);++ expect(parsed.safeParse({ v: 0.5 }).success).toBe(true);+ expect(parsed.safeParse({ v: 0 }).success).toBe(false);+ });++ it('keeps Draft 4 exclusive flags and adjacent Draft 7 keywords active together', () => {+ const schema = {+ type: 'array',+ minimum: 0,+ exclusiveMinimum: true,+ contains: { const: 1 },+ } as unknown as JsonSchema;++ // Ajv intentionally cannot serve as the oracle for the Draft 4 boolean+ // bound. This value isolates `contains`, which remains a Draft 7 assertion+ // even when an OpenAPI 3.0 exporter emits the older bound spelling nearby.+ expect(jsonSchemaToZod(schema).safeParse([2]).success).toBe(false);+ });++ it('accepts every valid prefix of a closed Draft 7 tuple', () => {+ const schema: JsonSchema = {+ type: 'array',+ items: [{ type: 'string' }, { type: 'integer' }],+ additionalItems: false,+ };+ const parsed = jsonSchemaToZod(schema);++ for (const value of [[], ['ready'], ['ready', 2]]) {+ expect(ajv.compile(schema)(value), 'Draft 7 oracle must accept the fixture').toBe(true);+ expect(parsed.safeParse(value).success).toBe(true);+ }+ for (const value of [+ [2, 'ready'],+ ['ready', 2, true],+ ]) {+ expect(ajv.compile(schema)(value), 'Draft 7 oracle must reject the fixture').toBe(false);+ expect(parsed.safeParse(value).success).toBe(false);+ }+ });++ it('allows unconstrained trailing values when additionalItems is omitted', () => {+ const schema: JsonSchema = {+ type: 'array',+ items: [{ type: 'string' }, { type: 'integer' }],+ };+ const value = ['ready', 2, { extra: true }];++ expect(ajv.compile(schema)(value), 'Draft 7 oracle must accept the fixture').toBe(true);+ expect(jsonSchemaToZod(schema).safeParse(value).success).toBe(true);+ });++ it('validates trailing tuple values against schema-valued additionalItems', () => {+ const schema: JsonSchema = {+ type: 'array',+ items: [{ type: 'string' }],+ additionalItems: { type: 'integer' },+ };+ const parsed = jsonSchemaToZod(schema);++ expect(parsed.safeParse(['ready', 1, 2]).success).toBe(true);+ expect(parsed.safeParse(['ready', 'wrong']).success).toBe(false);+ });++ it('does not round tiny nonzero numbers into integer multiples', () => {+ const schema: JsonSchema = { type: 'number', multipleOf: 3 };+ const value = 2 ** -1022;++ expect(ajv.compile(schema)(value), 'Draft 7 oracle must reject the fixture').toBe(false);+ expect(jsonSchemaToZod(schema).safeParse(value).success).toBe(false);+ });++ it('compares decimal multiples by their JSON number spelling', () => {+ const schema: JsonSchema = { type: 'number', multipleOf: 0.1 };+ expect(jsonSchemaToZod(schema).safeParse(0.3).success).toBe(true);+ });+});diff --git a/uv.lock b/uv.lockindex 48d135ede..6ed87c1cd 100644--- a/uv.lock+++ b/uv.lock@@ -733,6 +733,7 @@ dev = [{ name = "click" },{ name = "composio" },{ name = "fastapi" },+ { name = "hypothesis" },{ name = "langchain-openai" },{ name = "nox" },{ name = "pytest" },@@ -763,6 +764,7 @@ dev = [{ name = "click", specifier = ">=8.4.2" },{ name = "composio", editable = "python" },{ name = "fastapi", specifier = ">=0.140.0" },+ { name = "hypothesis", specifier = ">=6.140.3" },{ name = "langchain-openai", specifier = "==1.6.0" },{ name = "nox", specifier = ">=2026.7.11" },{ name = "pytest", specifier = ">=9.1.1" },@@ -1885,6 +1887,98 @@ wheels = [{ url = "https://files.pythonhosted.org/packages/b0/aa/0b7365d30fed43e7a3449aba1fe20a0a7174d9cf13e282af4e69ac825441/humanize-4.16.0-py3-none-any.whl", hash = "sha256:353eb2f34c09d098b2880eee8bef21832eae6d174f48c5762fff7e5fcb74d01d", size = 137209, upload-time = "2026-06-30T16:17:28.36Z" },]+[[package]]+name = "hypothesis"+version = "6.167.1"+source = { registry = "https://pypi.org/simple" }+dependencies = [+ { name = "exceptiongroup", marker = "python_full_version < '3.11'" },+ { name = "sortedcontainers" },+]+sdist = { url = "https://files.pythonhosted.org/packages/c2/c9/8cee74c1390b2932406faaab76980f18946f258fa5a8afca17189b3bc655/hypothesis-6.167.1.tar.gz", hash = "sha256:62eefcb4d2791423626e9901c3027a6e0c5ffda2ac0b44b3c7e797ab9d2d5a4c", size = 505849, upload-time = "2026-08-30T19:53:09.05Z" }+wheels = [+ { url = "https://files.pythonhosted.org/packages/53/4d/3592ca336deafbd3e9b0f47dc4c727aa32d30e765ef6370da8ecd590d388/hypothesis-6.167.1-cp310-abi3-macosx_10_12_x86_64.whl", hash = "sha256:d28118fd70e4e15ff9c308a98b312b544b6145ae45aaa3b566328c1fdee8058f", size = 785476, upload-time = "2026-08-30T19:51:02.154Z" },+ { url = "https://files.pythonhosted.org/packages/18/bf/e33c431148994cbcb3332c6df94b833ecfb4aa6a8e51ea4b83da55ddd581/hypothesis-6.167.1-cp310-abi3-macosx_11_0_arm64.whl", hash = "sha256:e517be7f82a0a917758cc489a88b826b5371f56381fd94b4a8a09ce82d8de406", size = 781033, upload-time = "2026-08-30T19:51:27.314Z" },+ { url = "https://files.pythonhosted.org/packages/94/a3/e0de9a82c7e790a1def0801076e0ef43110f98e95ed54a3554877d0cb66d/hypothesis-6.167.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:26f8cec74c4fad7aeb0852cb34c2134b16db05d878ad3946a53337dace7016f4", size = 1117814, upload-time = "2026-08-30T19:53:04.109Z" },+ { url = "https://files.pythonhosted.org/packages/71/a4/8dd6bdc909324d1c39da1c86d65f75512ae049c159952af4cfe8feb5f8d4/hypothesis-6.167.1-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:fd202d02d129197a5e771f8a11c7d30559927284c23ec3a8bd4f37a7955964d1", size = 1141639, upload-time = "2026-08-30T19:51:50.399Z" },+ { url = "https://files.pythonhosted.org/packages/fa/bd/c13ed6145c360d0770415efd7d5a7e63c29905aeef52ab88004fe7e7f924/hypothesis-6.167.1-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:8b1e393ab01b71f683ba2a783785871cc6b81a6e41017780c64a5bc0b99759ae", size = 1143334, upload-time = "2026-08-30T19:50:38.045Z" },+ { url = "https://files.pythonhosted.org/packages/c0/a8/060d79ed8504b54ced9ad16f33d674b1b98a9debe9733c02709d7dd5c71c/hypothesis-6.167.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8c385c7741893404306f9e5559ab3835432e85e7c153e25f854c502c410bbcbb", size = 1163345, upload-time = "2026-08-30T19:53:06.583Z" },+ { url = "https://files.pythonhosted.org/packages/cb/f7/6e68e2b705f729a6f7b4f41030022b1a5264c5434d3bcd917233d6801c6a/hypothesis-6.167.1-cp310-abi3-manylinux_2_31_riscv64.whl", hash = "sha256:94920ca1fae70c26b0bd3fabbeef9437ffc17a39fe85696fb9a86187d92f6dba", size = 1123029, upload-time = "2026-08-30T19:52:03.134Z" },+ { url = "https://files.pythonhosted.org/packages/a5/c0/d274fe37ed5ecd5ad8ed555edc1f5e2abc8e1c3be3d5404b7edd5cc353a8/hypothesis-6.167.1-cp310-abi3-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:b8d90ded2ffdc7e56b5e571993f384b52fade0a7b424e614f999cc2491789970", size = 1154003, upload-time = "2026-08-30T19:50:55.053Z" },+ { url = "https://files.pythonhosted.org/packages/b4/2f/2b5bb386f43fc965eb86fd69fcb2bd62c08cb6d7c6708a40dc39b3b97440/hypothesis-6.167.1-cp310-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:40cd5de7dd252942a08480639f5850594b1aca4a463e8a7f15e1fb6c2c3760c1", size = 1293729, upload-time = "2026-08-30T19:52:59.481Z" },+ { url = "https://files.pythonhosted.org/packages/ac/32/22436b072d79011fe81abb933edcd2476057c7b971588c5f3caf07519a88/hypothesis-6.167.1-cp310-abi3-musllinux_1_2_armv7l.whl", hash = "sha256:b9c33f921ddc7fea93660eca408b25fe755516e22ec7ab21cb9951031f1cd608", size = 1419248, upload-time = "2026-08-30T19:50:52.903Z" },+ { url = "https://files.pythonhosted.org/packages/9e/3e/abf39faaff0f78112112a82316a5c9fe472574480c1ecee526734775b812/hypothesis-6.167.1-cp310-abi3-musllinux_1_2_ppc64le.whl", hash = "sha256:495989cf0a5ee03f7f9598ee9efeaabf15fd861ec52b5a9d6435849453e17e5d", size = 1274903, upload-time = "2026-08-30T19:52:27.25Z" },+ { url = "https://files.pythonhosted.org/packages/29/83/69b89ed5692ba3aad117facfb9ce099633a22c35acc3d64829b72253ec8c/hypothesis-6.167.1-cp310-abi3-musllinux_1_2_riscv64.whl", hash = "sha256:bc73c46ce8ff93b0eb220f2b75adcbd9fcc9112078a74d3522d2532ad8069bad", size = 1294185, upload-time = "2026-08-30T19:50:35.038Z" },+ { url = "https://files.pythonhosted.org/packages/2b/1e/55dfcbe45c72df0a5c5b86a6b7c9365121acab69c2cc060bd55336a48c8f/hypothesis-6.167.1-cp310-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:36e83e1d7e97aaacbf6cd778e14a841344f848a674b20dfe4fe997546a6a2151", size = 1330013, upload-time = "2026-08-30T19:52:54.841Z" },+ { url = "https://files.pythonhosted.org/packages/3b/a6/0a36cead4ccff58bedb5d1aa2f894f7a580c317424b4fa788c6b22232b2d/hypothesis-6.167.1-cp310-abi3-win32.whl", hash = "sha256:fb4d87454d2459c2ccb541a4c61c92ce13058b91305ed3304695a409a1d886e4", size = 671942, upload-time = "2026-08-30T19:51:32.732Z" },+ { url = "https://files.pythonhosted.org/packages/ec/5b/360285ed42109f5ef48d98ca9ffcf71d1477130c0ff1f1a8d535c8507259/hypothesis-6.167.1-cp310-abi3-win_amd64.whl", hash = "sha256:5e35f98b427bf438a946203426b485dd5b62485f3d5a69a0e0862870a545e518", size = 678637, upload-time = "2026-08-30T19:50:33.573Z" },+ { url = "https://files.pythonhosted.org/packages/79/2d/cc084c1a8bfa296048ec0461f0fa11731abe0097f5c2310c8d39d94c8dc4/hypothesis-6.167.1-cp310-abi3-win_arm64.whl", hash = "sha256:dd6a0808a2eb8b5b1ac06bca4244eee18ed2c0e7b105599e1662203d164317b5", size = 676657, upload-time = "2026-08-30T19:51:34.494Z" },+ { url = "https://files.pythonhosted.org/packages/4a/8e/e0f470823bc301a97a8e6156806f6322f5ab99a2f40b6c604261966b3393/hypothesis-6.167.1-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:64cf8b7ac9a0cc80dad8884f81a2e50f0b79956694927d40e21e0cfa48830b8a", size = 786180, upload-time = "2026-08-30T19:52:09.714Z" },+ { url = "https://files.pythonhosted.org/packages/6c/4d/6e9e430ded5e226f245cd7e55923c7675311fa2115bc4262b5802edfcbb2/hypothesis-6.167.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:69b92f037080cefb949c5f9683873abac12283e0dc77201df089369c1ef67e4c", size = 781901, upload-time = "2026-08-30T19:50:42.641Z" },+ { url = "https://files.pythonhosted.org/packages/bd/aa/8df2711daf3ace849045482492b7f178fb55b79201f332477f6eef590b46/hypothesis-6.167.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:19b334180260de636a0b3017dd96d63709da0c4182c9cb28f52dd6cda78dc933", size = 1118135, upload-time = "2026-08-30T19:51:54.599Z" },+ { url = "https://files.pythonhosted.org/packages/8c/4f/6040b58ffc511013394ba027191dd7e2886c5ae39e0b7872ab15503803fe/hypothesis-6.167.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:769d0242531067e6daf16b6c9894fd9584139884de887023328e3c5658993597", size = 1163947, upload-time = "2026-08-30T19:50:45.908Z" },+ { url = "https://files.pythonhosted.org/packages/ca/66/24aedbae1b56e71308d0aef4415e37c6bb22068c77e95337cdf9d74cd8b1/hypothesis-6.167.1-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:22b6c3def5446016148523b74ef9da4948bec5ef05865d56c99ba187f4092663", size = 1294290, upload-time = "2026-08-30T19:52:45.383Z" },+ { url = "https://files.pythonhosted.org/packages/e5/e8/a063e3ab97851f4425918f0fcd407d0f426184c26b09f3bda7369e3d38d7/hypothesis-6.167.1-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:cbbb6bc17a5a04120a5bfd830335b8b301a22d21d2262804be330c235031b4c5", size = 1330694, upload-time = "2026-08-30T19:51:21.626Z" },+ { url = "https://files.pythonhosted.org/packages/bd/f6/6ebb84d532c0d5b36b3bab7b477a167685b2210a0246c7101557bfa4751c/hypothesis-6.167.1-cp310-cp310-win_amd64.whl", hash = "sha256:cdc7e20161f21f14c2d7a057054521db0a8c4bbb647d2e50c90c84f28e4621a0", size = 678586, upload-time = "2026-08-30T19:52:31.618Z" },+ { url = "https://files.pythonhosted.org/packages/ff/14/2445b7b1a0c8db61c6812b74606ed7a4f41e3ea0e0c103313e25995b82d5/hypothesis-6.167.1-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:613bf10e6e490daaa88eb4bf06fb3aacf6572b887e2f9fa5d0bac1be96a18c00", size = 785945, upload-time = "2026-08-30T19:51:19.221Z" },+ { url = "https://files.pythonhosted.org/packages/8b/f6/67926d308a9ab19bb7dfb5118832fa74b508f94871fadbb3370629decbfc/hypothesis-6.167.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:f715d912560dd4df3daab4c1fd98c01132eea7ab292f5b9e1d28fc419fe63348", size = 781726, upload-time = "2026-08-30T19:52:57.179Z" },+ { url = "https://files.pythonhosted.org/packages/33/de/22ac0e272530b36ad840170bf661ff89df8648052bb6a37dba520b312f1f/hypothesis-6.167.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8cdd2fc0232b47910e9621f8c1b5732381438055b03fcc69180e1ef3659b7e70", size = 1117929, upload-time = "2026-08-30T19:51:58.828Z" },+ { url = "https://files.pythonhosted.org/packages/4d/1f/b72b51bac9a7d330bcdda01dc0ab1abe76e1c29ff522effd2d1be4e23702/hypothesis-6.167.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:163e4cebd4b2380ff92f5d36bd04697e82b13973794440694da768521e1e2eab", size = 1163855, upload-time = "2026-08-30T19:52:33.689Z" },+ { url = "https://files.pythonhosted.org/packages/a7/b4/02424328951f0244f7dd3f620775ed22d39dc234e92759f9d2980150252b/hypothesis-6.167.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:2de4e67289f86e358732eb16b345f9d1f987c33e44b10d4ffa3ccd715dea9316", size = 1294177, upload-time = "2026-08-30T19:50:44.418Z" },+ { url = "https://files.pythonhosted.org/packages/d8/09/2262d6b362c81066ad451fda48633b2d3ea6cf2d0d673ee6554ad8f86c58/hypothesis-6.167.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:fcfd20792f62d65729f850ea50328c1f8b09874d5960b122715b9e6784a7a547", size = 1330267, upload-time = "2026-08-30T19:51:23.5Z" },+ { url = "https://files.pythonhosted.org/packages/70/5d/19e8c02eebfe89592dfd12372032e8868ad40e6d40b38e5ecc4935ce194f/hypothesis-6.167.1-cp311-cp311-win_amd64.whl", hash = "sha256:ebb841d21156039d7da0a41fa9de4ccf468510a4e4d8144f4fe2b3f31239ef3b", size = 678401, upload-time = "2026-08-30T19:51:44.77Z" },+ { url = "https://files.pythonhosted.org/packages/72/82/07987292cfb59c73ce6574e2912c015f678d5aa4d8c0712b78ae4415a535/hypothesis-6.167.1-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:1937ae4e23f7dde6d4202d3d08c2633bcd535a091bdf866b8799abaabcb1e6f0", size = 787050, upload-time = "2026-08-30T19:51:10.782Z" },+ { url = "https://files.pythonhosted.org/packages/c7/e9/0d37051bec44ec433d87da03c9a7fe389b1b58210790c1f166af249bf941/hypothesis-6.167.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:1434bbd25d05aaf75c4e6829b4cad8e9931b690f840d92b747b2e6e5af575922", size = 778617, upload-time = "2026-08-30T19:50:31.939Z" },+ { url = "https://files.pythonhosted.org/packages/13/2a/60c18a493215c22c9cfcb4574b381497bd1971eed9fb5f9831b26e73cffb/hypothesis-6.167.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:af3c09428e553b1dd2f9abbc4738377c58bf6d74cb0b8b528cc1dde3a9cdfbe8", size = 1116743, upload-time = "2026-08-30T19:50:49.293Z" },+ { url = "https://files.pythonhosted.org/packages/12/1f/b6796f11d6502e0b1764aec99f2792ca60382b6a45e26bbe163dc5757980/hypothesis-6.167.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:04f807b85d425a7005e8a24498ca832bf5590f0d306737471d94c842569cecef", size = 1162718, upload-time = "2026-08-30T19:52:47.544Z" },+ { url = "https://files.pythonhosted.org/packages/a8/6c/e3cf35474b799e299fa08980b6756f500d730781686916ab65f87cbc0613/hypothesis-6.167.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:803c6a98ff66cee4caf03245bfd00e442a907264031b994a3a650dc6e4786f51", size = 1292417, upload-time = "2026-08-30T19:50:56.822Z" },+ { url = "https://files.pythonhosted.org/packages/9a/4c/875803c80c373a1628f8eb62f215ad23ce7b50ed61f884d6be0838ebea4a/hypothesis-6.167.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:21a7122ddf072906083e3704fe3961ecbc49d7d30a9b51bcd525d977b3afe65e", size = 1329035, upload-time = "2026-08-30T19:51:46.659Z" },+ { url = "https://files.pythonhosted.org/packages/90/a8/a8daed3796623884471dc0ee8ed63917b1e2b979b4074bcea19a964fcd71/hypothesis-6.167.1-cp312-cp312-win_amd64.whl", hash = "sha256:a2837c60d782eb0b8a910c541264675b9d11486e186af8c82a5e2920b5fe4fe8", size = 675966, upload-time = "2026-08-30T19:51:56.58Z" },+ { url = "https://files.pythonhosted.org/packages/4b/44/dca7b211804f60c789aced2792b1e7803ccd8b70b79041cbb92788df5d19/hypothesis-6.167.1-cp313-cp313-macosx_10_12_x86_64.whl", hash = "sha256:6478d19a7887731cc2afaa1ec15f62811c9ceb6fd18e5b7563e0a18399a9528f", size = 786947, upload-time = "2026-08-30T19:51:29.165Z" },+ { url = "https://files.pythonhosted.org/packages/b9/6a/3cffa138492c9e3d5f98f4ff8b467273dc87af6ca3c18084272d106bde10/hypothesis-6.167.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:8f13167a4b81c93e7e051d1f02790814a6495fb79cacf3fb89560a796a2f7d00", size = 778584, upload-time = "2026-08-30T19:52:25.091Z" },+ { url = "https://files.pythonhosted.org/packages/7a/7d/e8039791aaca3b21557bc520a71cdb88751892f66fd1a0a459b59872e463/hypothesis-6.167.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5ef7dd225f7df7d74d1c5a905592cd8b4cd348e6be639b189a43def8b0b5dd79", size = 1116749, upload-time = "2026-08-30T19:52:38.178Z" },+ { url = "https://files.pythonhosted.org/packages/ee/b8/f9b8d93bd6178870f0daa868ca99915f6d9df1f99dc7291e9ce2743a6dc5/hypothesis-6.167.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7d7585429f2263d3ceeb3474bae3871024630a7a598e71eeb4b0dcf03e291623", size = 1162599, upload-time = "2026-08-30T19:52:11.72Z" },+ { url = "https://files.pythonhosted.org/packages/a1/0d/53d419094e6f8a7e7377c09de15ac23f842ab698ff07241f7b73e19bd559/hypothesis-6.167.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:fb9194f450417cf35f66b6c72737cc6b8f21f20567ba4d39822c64f0d1075784", size = 1292230, upload-time = "2026-08-30T19:52:49.732Z" },+ { url = "https://files.pythonhosted.org/packages/5c/df/cf4c482323ae4f06b5326b5bdd89cf17d8232fdb3186c9913e0b19a5fa58/hypothesis-6.167.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:c63a0d292a5dde3c0fe999892e76d8375a003ca40c0c00d763f3360f91be5b96", size = 1328899, upload-time = "2026-08-30T19:51:05.366Z" },+ { url = "https://files.pythonhosted.org/packages/49/05/780c4b0396491d294fda69a541cb1dedb37fb9eb2e3a696e85fe19064c40/hypothesis-6.167.1-cp313-cp313-win_amd64.whl", hash = "sha256:ff07f98a0b230632bb2836b5dad3e94d85c114ae155a316afd251c58760958ae", size = 675927, upload-time = "2026-08-30T19:50:58.472Z" },+ { url = "https://files.pythonhosted.org/packages/6a/f1/1e602f090dcb7e38655f1f7909482742891332275fc01f241e255cdfa514/hypothesis-6.167.1-cp314-cp314-macosx_10_12_x86_64.whl", hash = "sha256:fcfc2a78fc1025644f889a74684b3201f4652ce8e6694c2a01af0f100d0348cf", size = 787054, upload-time = "2026-08-30T19:50:40.88Z" },+ { url = "https://files.pythonhosted.org/packages/52/57/cfa930719c7af5a33627abba826a3fa2efa61a5f23e38d4111eace5dfe53/hypothesis-6.167.1-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:769bdd9aa0af08c063327730ab6dc18b7a23837a2912f2aeaab3912f11a7e3ad", size = 778721, upload-time = "2026-08-30T19:50:36.503Z" },+ { url = "https://files.pythonhosted.org/packages/01/37/4c4bc3d319eac85bfe17515c9786bf49e57181ca8757886110d2cfb13d10/hypothesis-6.167.1-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d75d44bdead6679b6ee9a7c90d10207db865ca0c77c5212103b5ff421379f99e", size = 1116972, upload-time = "2026-08-30T19:51:52.472Z" },+ { url = "https://files.pythonhosted.org/packages/33/45/0d61ceef2739e7b96ea1faa0f3d5aa5917c8156797993bf3acbadfcd7f0a/hypothesis-6.167.1-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:742be00d7bb53d10634e6435e5b98f51fcdbe7ed377d473ab7387d9499c87169", size = 1162776, upload-time = "2026-08-30T19:51:09.084Z" },+ { url = "https://files.pythonhosted.org/packages/4a/cf/756666ce2262e90fd61fec41a95548cceab94b0669381d8f0387cd89af93/hypothesis-6.167.1-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:b6fcdc8d03b37a902262be13112d113bb4ac87edf3b08afb47f3d1210deb038a", size = 1292748, upload-time = "2026-08-30T19:51:17.22Z" },+ { url = "https://files.pythonhosted.org/packages/e8/b4/87eb3c695d6c37fb44f4d49f9faa2033af496e24965658942a1706e22620/hypothesis-6.167.1-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:e56e7841514276c308c2bb4d033cf01860d0fc8c76e2b79ce748a9f123eaf83b", size = 1329101, upload-time = "2026-08-30T19:51:36.313Z" },+ { url = "https://files.pythonhosted.org/packages/a7/3b/87faa4a86533eaaa19037741fb9cdde8647f7ffdf8fd4279828ac9d81f8b/hypothesis-6.167.1-cp314-cp314-pyemscripten_2026_0_wasm32.whl", hash = "sha256:bbf4f0cad201d0b8e821e82ad828b2aec99ce6d9967779eecb2cad4d4a93debd", size = 618079, upload-time = "2026-08-30T19:52:43.226Z" },+ { url = "https://files.pythonhosted.org/packages/e0/46/96b7ac9605887447d267b4b3a9ecf61c6caaabf39eef667173b0cc9222b3/hypothesis-6.167.1-cp314-cp314-win_amd64.whl", hash = "sha256:3e04f6001299708b6fd4512267b189c0b029ef1e34500deb4e4c9639023598d7", size = 675812, upload-time = "2026-08-30T19:52:52.298Z" },+ { url = "https://files.pythonhosted.org/packages/6e/f6/0337a91c50ce4be323c3d6aa852fcf08199ffbb1072da09fbe6d602f4dfe/hypothesis-6.167.1-cp314-cp314t-macosx_10_12_x86_64.whl", hash = "sha256:47c99256df28555ecc2aed0e22ca17cd61c63c8c44207a07b4e402cc49661fae", size = 785525, upload-time = "2026-08-30T19:51:03.637Z" },+ { url = "https://files.pythonhosted.org/packages/5a/08/9bb52de855169d31888c7033ee2f94b94138fde021c1af9dbc7ba5e83cd5/hypothesis-6.167.1-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:5d6614e88fd267bbd870e3ec02f8a5387897d2d573626a02f5ac06d81533afa6", size = 777142, upload-time = "2026-08-30T19:52:18.472Z" },+ { url = "https://files.pythonhosted.org/packages/85/79/f1a7e088e13a641357abb9b43d75c116c2a0902711b1a25a203864b96c9b/hypothesis-6.167.1-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:27829aa89fe2e47c5c8d13b3ce31e0f53a01a98f76a4f99cfa3369ab35362f33", size = 1115311, upload-time = "2026-08-30T19:52:40.975Z" },+ { url = "https://files.pythonhosted.org/packages/e0/38/e28b1fc20bd3d67d43cf1aab7a15daa2a24ec01d17a153e82fcf38c882f3/hypothesis-6.167.1-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e936777d92ae27393b4a941839bbb43c1f339b5a0e394c7f3730454cdf091b3a", size = 1161238, upload-time = "2026-08-30T19:52:20.501Z" },+ { url = "https://files.pythonhosted.org/packages/5a/de/9b4fc7992166299e0fc5c13c8766919ae57d0fb9eed5319b7a3bad4f2f17/hypothesis-6.167.1-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:971ce0d8a367a37c4690b83a2e7f6ef832fa3543357eb6da0da27ba078e5088a", size = 1290974, upload-time = "2026-08-30T19:51:15.673Z" },+ { url = "https://files.pythonhosted.org/packages/cc/79/ca086eea02588212ab796ee4bd7fe6ed514e10d1a99967e478691608e8d9/hypothesis-6.167.1-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:af84ce2416be2a65bc0ea18e64d2dbb9796b7692593b5b2064d60ea1d52ec1e2", size = 1327969, upload-time = "2026-08-30T19:52:35.846Z" },+ { url = "https://files.pythonhosted.org/packages/26/79/1875380fa30e8411553e76b3e9695aca0845f9f265523f20f879bdea2b82/hypothesis-6.167.1-cp314-cp314t-win_amd64.whl", hash = "sha256:3b596efec5bd714588e3bb269544d993c5258c979f3a26f51fadf62c215d0e68", size = 675735, upload-time = "2026-08-30T19:52:22.821Z" },+ { url = "https://files.pythonhosted.org/packages/b0/45/59abecd75e52b9dfb5b3eb991276f54954c44917a1c83d148cfb3580bd39/hypothesis-6.167.1-cp315-abi3.abi3t-macosx_10_12_x86_64.whl", hash = "sha256:c25c556d51d55d94988dc0a2c716d471ff19cf9632cd33f5e6db2914d802428a", size = 785097, upload-time = "2026-08-30T19:51:12.528Z" },+ { url = "https://files.pythonhosted.org/packages/01/7c/e6d978dc9564ba70352da60c00f55f6ad7d66d99ecbf336a228978206cb4/hypothesis-6.167.1-cp315-abi3.abi3t-macosx_11_0_arm64.whl", hash = "sha256:b57e950f9d5c93ca335bc612e8fa8fb49abb187c3fc9d5e7d9966d52eb27d747", size = 776798, upload-time = "2026-08-30T19:50:47.247Z" },+ { url = "https://files.pythonhosted.org/packages/d1/a4/f8ecedcf96790aab69d750afe3fcbf503229d0bb4e0c32be655385a4fc8c/hypothesis-6.167.1-cp315-abi3.abi3t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0807ae8d399162827fc1c396ab4c697a41921c2a2baacfada439771e9dc2b867", size = 1115116, upload-time = "2026-08-30T19:52:16.029Z" },+ { url = "https://files.pythonhosted.org/packages/7e/97/8bca7c262ac4fcb1ee684c04e4ba75f26541d3a30417e3743d19912d257e/hypothesis-6.167.1-cp315-abi3.abi3t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:546fef39c7aadba74bf3e592585694a71340d1775e9b3274bb3f94106dbde4b7", size = 1137812, upload-time = "2026-08-30T19:51:25.507Z" },+ { url = "https://files.pythonhosted.org/packages/d6/07/9cb4a7fc2aa2b2ad063b446c378f0d7acfa5303e84afd1b1374ba23fd6f3/hypothesis-6.167.1-cp315-abi3.abi3t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:a17a5618b6a5b84f17c8acb3bce37122647cf7a3e48b660a39d68a773bd627dd", size = 1140384, upload-time = "2026-08-30T19:52:05.264Z" },+ { url = "https://files.pythonhosted.org/packages/1c/18/813bf7efa18f11ce938a0da22a7518a54db46d4a181ebf4cb0a8061c263f/hypothesis-6.167.1-cp315-abi3.abi3t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0ff5ad833480c1e34ae902cb52fc00802b08ac6c87bd22d7e5f04fd925869608", size = 1160569, upload-time = "2026-08-30T19:51:40.099Z" },+ { url = "https://files.pythonhosted.org/packages/52/1d/6658d9294ed33bb17da4acf06fe63b010b205ea1861f6921c38060793255/hypothesis-6.167.1-cp315-abi3.abi3t-manylinux_2_31_riscv64.whl", hash = "sha256:630eb37df80b5bc4ec6f391b13caaecc06942ff5da3aadebacf85f53bbc55757", size = 1120605, upload-time = "2026-08-30T19:53:01.848Z" },+ { url = "https://files.pythonhosted.org/packages/a6/81/a75821c0e879223a2635b8eded84ae874cb6c711b23e9930668008d0b13f/hypothesis-6.167.1-cp315-abi3.abi3t-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:bc4e65f7c43b187f7a40964706b5ded1073e0c1839e9fb5e041d7ed973bb65fe", size = 1149479, upload-time = "2026-08-30T19:51:30.972Z" },+ { url = "https://files.pythonhosted.org/packages/4e/f2/c8c3faf4ec796d6dbf36b84662806696434aef38616e5a65b46188c04262/hypothesis-6.167.1-cp315-abi3.abi3t-musllinux_1_2_aarch64.whl", hash = "sha256:e849f518cbc4e76ab15f2f1473c60dd3103da8d32399187325ceb84309105976", size = 1290423, upload-time = "2026-08-30T19:50:51.114Z" },+ { url = "https://files.pythonhosted.org/packages/a4/e3/e0903abe7e8634cedb5414931452e82daacdd3b8b46d6348bbefcaa45f2a/hypothesis-6.167.1-cp315-abi3.abi3t-musllinux_1_2_armv7l.whl", hash = "sha256:5c5a26d4d3dca0c84e01bde41df4cabaa5a373c7393f9eef372d19fe93b07ccd", size = 1415749, upload-time = "2026-08-30T19:51:48.456Z" },+ { url = "https://files.pythonhosted.org/packages/a6/9b/03f09c1ecac1dfb0f4cd7fcc6dc50d9c6ea8067b295a728e242650bafe32/hypothesis-6.167.1-cp315-abi3.abi3t-musllinux_1_2_ppc64le.whl", hash = "sha256:4819adbc5911648f6bfaeb574f276add184b4b49f54731dbde46fd71256bb157", size = 1272086, upload-time = "2026-08-30T19:52:29.368Z" },+ { url = "https://files.pythonhosted.org/packages/7c/7c/7a63bfc0bfbaf000f71352c4faac72ff611376330a2ce2e9a1bf4668848a/hypothesis-6.167.1-cp315-abi3.abi3t-musllinux_1_2_riscv64.whl", hash = "sha256:3ad7206de9c398c8da5745b69b5ba2ef45100082eeb174656490bc4f262b112c", size = 1291553, upload-time = "2026-08-30T19:52:07.545Z" },+ { url = "https://files.pythonhosted.org/packages/e8/5c/8065bdab53bc81743ca68fc76ca53fc7531a5b3f01c0de4ba40467955d6a/hypothesis-6.167.1-cp315-abi3.abi3t-musllinux_1_2_x86_64.whl", hash = "sha256:96d5e8017a9508f06c8a61a6130cb0d0b4810847ed5c76923cb5cfb9952b31af", size = 1327734, upload-time = "2026-08-30T19:51:42.306Z" },+ { url = "https://files.pythonhosted.org/packages/0d/a0/5c15d480aea3a8e6e5c17c7cb1170171707ac643ffd319473bc194743ad8/hypothesis-6.167.1-cp315-abi3.abi3t-win32.whl", hash = "sha256:a4e4de36a397cba49d949d89cbc26135977c15f9d797caa95317962ceb5b5674", size = 669115, upload-time = "2026-08-30T19:51:14.192Z" },+ { url = "https://files.pythonhosted.org/packages/1b/36/4cf494bc96384189fedb7d3f272580315f2284a9f8a7f6a59796612eb76d/hypothesis-6.167.1-cp315-abi3.abi3t-win_amd64.whl", hash = "sha256:f6fe9c40ab14def363d9e7ab22863fa31652bd5e08f8495b34ff7bd0062b3f8d", size = 675438, upload-time = "2026-08-30T19:51:06.881Z" },+ { url = "https://files.pythonhosted.org/packages/b0/7f/db1a37e5f45be32c0e64f9ed1268eba56aeedcb2ef20d195fa60c6610347/hypothesis-6.167.1-cp315-abi3.abi3t-win_arm64.whl", hash = "sha256:627ce3bd166799a6c0ddcf1351049be5b9a772d5bce436216d42b41a935f42c0", size = 673123, upload-time = "2026-08-30T19:52:13.991Z" },+ { url = "https://files.pythonhosted.org/packages/53/bc/a77ee57eb8fb13f2b5bdfb4a1ea3f32713c50420f0208e84fbe590fad1ad/hypothesis-6.167.1-pp311-pypy311_pp73-macosx_10_12_x86_64.whl", hash = "sha256:436027c9a00eb11a2ca3d608147ca2d0d623b4f02878c56a50fc3f3f58c2b41b", size = 786862, upload-time = "2026-08-30T19:51:38.287Z" },+ { url = "https://files.pythonhosted.org/packages/f8/3f/cc9c9120fad719e683914b9204b38f1a30721bc06344f465fc36427cc45e/hypothesis-6.167.1-pp311-pypy311_pp73-macosx_11_0_arm64.whl", hash = "sha256:35e90c121b1518d7428a45e6b0d5c6d06e0ed9eaa567f1106e1f09dae006d6da", size = 782711, upload-time = "2026-08-30T19:50:28.733Z" },+ { url = "https://files.pythonhosted.org/packages/98/a6/a48824ba4ad1257904bde4654099851febf0b4c3f018c8174b33d4ba0308/hypothesis-6.167.1-pp311-pypy311_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9c903b4f1c8531736fc7e8e537f47ef509756b731a32a5e5e7014e5291343acb", size = 1118685, upload-time = "2026-08-30T19:52:01.045Z" },+ { url = "https://files.pythonhosted.org/packages/b4/f3/c6bcfb38c4b4cd22494902f5368b5815425f03eeb5159741c7d910a69af5/hypothesis-6.167.1-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:27ca252991fdbe2ff5c611a1cc4d972d4e009eb45292c7802faa2190f995dc50", size = 1165389, upload-time = "2026-08-30T19:50:39.44Z" },+ { url = "https://files.pythonhosted.org/packages/3b/f6/d1d19d115a4c0aa35c87b9e5d570b0a7c9f42f816087849cf29c58664426/hypothesis-6.167.1-pp311-pypy311_pp73-win_amd64.whl", hash = "sha256:6c91f6f2f15b8bc6e474b824f931247c39711231e7b1b2f68277726e0ae1c728", size = 679392, upload-time = "2026-08-30T19:51:00.264Z" },+]+[[package]]name = "id"version = "1.6.1"@@ -5162,6 +5256,15 @@ wheels = [{ url = "https://files.pythonhosted.org/packages/e9/44/75a9c9421471a6c4805dbf2356f7c181a29c1879239abab1ea2cc8f38b40/sniffio-1.3.1-py3-none-any.whl", hash = "sha256:2f6da418d1f1e0fddd844478f41680e794e6051915791a034ff65e5f100525a2", size = 10235, upload-time = "2024-02-25T23:20:01.196Z" },]+[[package]]+name = "sortedcontainers"+version = "2.4.0"+source = { registry = "https://pypi.org/simple" }+sdist = { url = "https://files.pythonhosted.org/packages/e8/c4/ba2f8066cceb6f23394729afe52f3bf7adec04bf9ed2c820b39e19299111/sortedcontainers-2.4.0.tar.gz", hash = "sha256:25caa5a06cc30b6b83d11423433f65d1f9d76c4c6a0c90e3379eaa43b9bfdb88", size = 30594, upload-time = "2021-05-16T22:03:42.897Z" }+wheels = [+ { url = "https://files.pythonhosted.org/packages/32/46/9cb0e58b2deb7f82b84065f37f3bffeb12413f947f9388e4cac22c4621ce/sortedcontainers-2.4.0-py2.py3-none-any.whl", hash = "sha256:a163dcaede0f1c021485e957a39245190e74249897e2ae4b2aa38595db237ee0", size = 29575, upload-time = "2021-05-16T22:03:41.177Z" },+]+[[package]]name = "sse-starlette"version = "3.4.6"