schema-components - v3.7.0
    Preparing search index...

    Function detectSchemaKind

    • 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.

      Parameters

      • input: unknown

      Returns SchemaKind