unstale

npm / @mastra/schema-compat

@mastra/schema-compat

What changed in @mastra/schema-compat 1, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-20.

2 breaking1 new APIs and options1 performance2 behavior and defaults36 fixes and other

See which of these apply to your code, ranked, in your agent:

npx @unstale/cli init

@unstale/cli 0.2.0 on npm

@mastra/schema-compat 142 changes

Breaking changes 2

  • Tool execute functions now receive the transformed output type for Standard Schemas instead of a union of input and output types.

    1.3.14release notes

  • Optional fields inside nullable or nullish objects or arrays returned as null are now dropped, matching behavior for non-nullable parents.

    1.3.12release notes

New APIs and options 1

  • Set this option to true to keep strict mode for structured output schemas with free-form keys.

    1.3.15release notes

Performance 1

  • Reduced TypeScript memory usage for applications that define many tools with Zod schemas.

    1.3.10release notes

Behavior and default changes 2

  • Tool requestContextSchema accepts Standard Schemas that transform their input, and tool request context is typed with the transformed output.

    1.3.14release notes

  • Meta and DeepSeek schemas now move numeric constraints into the field description instead of sending raw number bounds or minimum/maximum keywords to the model.

    1.3.4release notes

Fixes and other changes 36

  • Optional tool inputs are left empty instead of being filled with made-up values when the Azure deployment name contains an OpenAI model name.

    1.3.15release notes

  • OpenAI models can leave optional tool inputs empty when those inputs accept more than one type, rather than filling them with made-up values.

    1.3.15release notes

  • Structured output with free-form keys, such as z.record(z.string(), z.string()), now works on OpenAI; these schemas are sent without strict mode.

    1.3.15release notes

  • OpenAI strict-mode schema preparation no longer rejects allOf object schemas with properties named constructor, toString, or __proto__.

    1.3.13release notes

  • Tools with optional number parameters that have a format now return responses as expected instead of failing silently.

    1.3.12release notes

  • Nullable Zod v4 enums and literals now include null among exported allowed values, so tool parameters, OpenAPI schemas and dataset schemas match the Zod schema.

    1.3.12release notes

  • Claude on Vertex now uses the Anthropic compatibility layer, preserving nullable parameters as JSON Schema type: ['string', 'null']; Gemini on Vertex is unchanged.

    1.3.11release notes

  • JSON Schema adapter declarations use bundled Ajv types, so consumers no longer need a separate Ajv installation.

    1.3.11release notes

  • Fixed loading from CommonJS, which previously failed with “jsonSchemaToZod is not a function.”

    1.3.11release notes

  • Generated schemas use z.record(z.string(), value) so schemas with additionalProperties or patternProperties validate correctly on the noted Zod versions.

    1.3.11release notes

  • Recursively removes validation keywords rejected by OpenAI strict mode, including in referenced schemas, and folds their intent into descriptions.

    1.3.10release notes

  • Avoids duplicating nested optional object and array definitions, preventing compatible MCP tools from being rejected.

    1.3.9release notes

  • Optional nested properties with multiple types no longer produce exponentially large OpenAI tool payloads; payload growth remains linear as schemas become more deeply nested.

    1.3.7release notes

  • For Gemini via OpenRouter, properties without a Gemini-compatible type are rewritten into a permissive anyOf instead of being dropped, keeping expected tool fields in the contract.

    1.3.6release notes

  • The OpenAI compatibility layer removes the unsupported propertyNames keyword from structured output schemas, allowing requests using z.record() to be accepted.

    1.3.6release notes

  • Tool execute-time validation for Zod tools on Anthropic Claude 3.5 Haiku skips string min/max checks removed from the model-facing JSON Schema while preserving other validation semantics.

    1.3.6release notes

  • Schema conversion for Zod v3 is fixed for CommonJS consumers.

    1.3.6release notes

  • Fixed Claude requests failing when tool inputs use a top-level union of object schemas.

    1.3.5release notes

  • Fixes crashes when converting Zod v4 schemas containing z.record(...) with a provider compat layer attached, covering older Zod v4 versions and versions that expose ~standard.jsonSchema.

    1.3.4release notes

  • In Zod v4, nullable or optional schemas wrapping unsupported inner types, such as tuples, are passed through unchanged instead of being processed and rejected.

    1.3.3release notes

  • The Zod v4 string handler now preserves formats without textual descriptions as validation, so schemas using them keep rejecting invalid input.

    1.3.2release notes

  • Workflow and step type inference with Zod schemas is significantly faster and no longer causes TypeScript crashes or depth errors.

    1.3.2release notes

  • The Zod v4 schema handler now describes min and max date bounds according to Zod semantics, avoiding swapped or impossible constraints sent to the model.

    1.3.2release notes

  • Fixed a type error when passing jsonSchema() or a Schema object from @ai-sdk/provider-utils as inputSchema, so no cast is needed.

    1.3.1release notes

  • Fixed schema compatibility type declarations so JSON Schema types are bundled correctly.

    1.2.12release notes

  • Rewrites JSON Schema 2020-12 keywords into the OpenAPI 3.0 Schema Object subset Gemini expects, fixing REST tool calls for discriminated unions, lazy schemas, and tuples.

    1.2.11release notes

  • Generated schemas for Zod 4 transforms now describe the pre-transform input the model must produce, fixing structured output and tool calling.

    1.2.11release notes

  • Fixed schema conversion so Gemini accepts broad nullable tool parameters.

    1.2.10release notes

  • MCP tools using JSON Schema draft 2020-12 now validate correctly instead of throwing “no schema with key or ref” errors.

    1.2.9release notes

  • MCP tools with recursive JSON Schema refs stay serializable when loaded.

    1.2.9release notes

  • Improved compatibility for structured outputs and tool calls, fixing validation for optional, nullable, and defaulted fields and ISO date strings returned for date fields.

    1.2.8release notes

  • Fixed ESM imports for Zod JSON Schema helpers, avoiding createRequire-related issues while preserving support for zod/v3 and zod/v4.

    1.2.7release notes

  • Mastra agent and client structured-output APIs accept schemas from either zod/v3 or zod/v4, with TypeScript compatibility for both.

    1.2.7release notes

  • The Zod v4 adapter translates Mastra draft target names to Zod v4 names, preventing invalid-target warnings and restoring the generated $schema field.

    1.2.6release notes

  • The Zod v3 adapter supports draft-2020-12 and draft-04 targets and translates zod-to-json-schema target names to standard-schema target names, fixing unsupported-target errors when serializing tool schemas.

    1.2.6release notes

  • MCP tools using allOf in their JSON Schema no longer throw an unsupported ZodIntersection error; intersection types are flattened and merged into a single object schema across provider compatibility layers.

    1.2.5release notes