Skip to content

Support standard JSON schema object representation for Zod Mini #5570

@logaretm

Description

@logaretm

Hey there, while trying out the recent standard schema implementation across multiple providers for formwerkjs/formwerk#238 I came across this issue.

When trying to get the input JSON schema for a given Zod mini schema with objects, it throws with the following error:

Error: Uncaught Error: [toJSONSchema]: Non-representable type encountered: object

Here is a small snippet to reproduce:

const zodJson = z.toJSONSchema(z
  .object({
    firstName: z.string(),
    lastName: z.string(),
  }))["~standard"]["jsonSchema"].input({ target: "draft-07" })

is there a plan to support object representations and probably other APIs?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions