Mastra createStep rejects Typia StandardSchemaV1 with missing jsonSchema — supported format?
I upgraded to @mastra/core 1.25.0 and passed a Typia-generated StandardSchemaV1 object to createStep()'s inputSchema/outputSchema. TypeScript fails with "Property 'jsonSchema' is missing in type 'Props'...". Does Mastra support the Standard Schema spec, and what form does the schema need to take?
Originally asked on GitHub: https://github.com/mastra-ai/mastra/issues/4890
6 answers
Fixed. Mastra now supports Standard Schema, but specifically the extended
StandardJSONSchemaV1spec (aStandardSchemaV1plus a~standard.jsonSchemaproperty), not the plain validation-onlyStandardSchemaV1that Typia'screateValidate<T>()produces. Mastra needs the JSON Schema to convert schemas for tools, and the plain Standard Schema spec deliberately treats schemas as black boxes without a JSON Schema affordance.For libraries: the supported list is at standardschema.dev/json-schema. A maintainer confirmed success with
effect-smol; the stable Effect library did not support the extended spec at the time.For Typia, the workaround from the thread is to merge the validator with a pre-computed JSON Schema:
tsconst validator = typia.createValidate<MyOutput>(); const jsonSchema = typia.json.schemas<[MyOutput]>().components.schemas!.MyOutput; const outputSchema = toMastraSchema(validator, jsonSchema);where
toMastraSchemacombines the Typia validator and JSON Schema into an object satisfyingStandardSchemaWithJSON. That fixed the TypeScript overload error. However, note two separate issues the reporter hit: validation tests in the dev server still did not pass, and the Mastra dev server does not run Typia's TypeScript transform plugin, so he switched to zod.Documentation for the schema requirement was added at https://mastra.ai/docs/workflows/overview#creating-a-workflow-step (opens external site). If you use a library from the supported list and still hit errors, open a new issue with a reproduction.
Did this work for you?What @LekoArts tried on GitHub (Worked)
A maintainer confirmed Mastra needs the Standard JSON Schema spec, linked the supported library list at standardschema.dev/json-schema, and reported success with effect-smol. The stable Effect library did not support the extended spec at the time.
Source: https://github.com/mastra-ai/mastra/issues/4890#issuecomment-4318543725 (opens external site)
Did this work for you?What @khera tried on GitHub (Partly worked)
Traced the failure to Mastra requiring
StandardJSONSchemaV1rather than plainStandardSchemaV1, then built a helper that merges Typia'screateValidate<T>()with a JSON Schema fromtypia.json.schemasintoStandardSchemaWithJSON. This fixed the TypeScript type error, but validation tests in the dev server still failed; separately, the dev server does not honor Typia's TS transform plugin, so the reporter moved to zod.Source: https://github.com/mastra-ai/mastra/issues/4890#issuecomment-4316666202 (opens external site)
Did this work for you?What @khera tried on GitHub (Didn't work)
Upgraded to @mastra/core 1.25.0 and passed Typia-generated StandardSchemaV1 objects to createStep()'s inputSchema/outputSchema. TypeScript failed with 'Property jsonSchema is missing in type Props' because Mastra's PublicSchema type requires StandardSchemaWithJSON.
Source: https://github.com/mastra-ai/mastra/issues/4890#issuecomment-4271073397 (opens external site)
Did this work for you?What @ebramanti tried on GitHub (Didn't work)
Asked whether official Standard Schema support existed and tried Effect Schema against Mastra's internal Standard Schema changes, but still ran into issues.
Source: https://github.com/mastra-ai/mastra/issues/4890#issuecomment-4269982249 (opens external site)
Did this work for you?What a GitHub user tried on GitHub (Outcome unclear)
Opened the feature request proposing that Mastra move from zod to the standard-schema spec so any library (zod, arktype, valibot) could supply tool output schemas without being locked in.
Source: https://github.com/mastra-ai/mastra/issues/4890 (opens external site)
Did this work for you?
Related questions
- Mastra dev fails on uncompiled workspace TypeScript dependencies
- Mastra AI SDK v5: MastraClient 'Failed to parse stream string' and Cloud ENOENT build errors — how to fix?
- How to register Mastra agents dynamically at runtime from a database?
- Mastra A2A sendStreamingMessage fails: Unexpected non-whitespace character after JSON
- Does Mastra support Zod v4 yet?