Classify a runtime schema input by structural markers — Zod 4, Zod 3,
OpenAPI document, plain JSON Schema, or an unsupported third-party
schema library.
zod4 — has a _zod marker (further validation that _zod.def is a
non-null object happens inside normaliseZod4).
zod3 — has _def and no _zod. The typeName field is no longer
required: any _def without _zod is treated as a probable Zod 3
schema. Third-party libraries that expose _def without _zod are
nearly always Zod 3 forks; surfacing the migration message is the
correct response.
openapi — has openapi or swagger at the root.
unsupported-schema-lib — has parse and safeParse callables but
no _zod and no _def marker. This catches Standard Schema
implementations (valibot, arktype, etc.) that would otherwise flow
through as "malformed JSON Schema".
jsonSchema — fallback for anything that does not match the above.
Classify a runtime schema input by structural markers — Zod 4, Zod 3, OpenAPI document, plain JSON Schema, or an unsupported third-party schema library.
zod4— has a_zodmarker (further validation that_zod.defis a non-null object happens insidenormaliseZod4).zod3— has_defand no_zod. ThetypeNamefield is no longer required: any_defwithout_zodis treated as a probable Zod 3 schema. Third-party libraries that expose_defwithout_zodare nearly always Zod 3 forks; surfacing the migration message is the correct response.openapi— hasopenapiorswaggerat the root.unsupported-schema-lib— hasparseandsafeParsecallables but no_zodand no_defmarker. This catches Standard Schema implementations (valibot, arktype, etc.) that would otherwise flow through as "malformed JSON Schema".jsonSchema— fallback for anything that does not match the above.