{"record":{"id":"feda1447c554dd47","repo":"colinhacks/zod","slug":"unevaluatedproperties-is-not-supported","errorCode":null,"errorMessage":"unevaluatedProperties is not supported","messagePattern":"unevaluatedProperties is not supported","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/zod/src/v4/classic/from-json-schema.ts","lineNumber":160,"sourceCode":"  }\n\n  throw new Error(`Reference not found: ${ref}`);\n}\n\nfunction convertBaseSchema(schema: JSONSchema.JSONSchema, ctx: ConversionContext): ZodType {\n  // Handle unsupported features\n  if (schema.not !== undefined) {\n    // Special case: { not: {} } represents never\n    if (typeof schema.not === \"object\" && Object.keys(schema.not).length === 0) {\n      return z.never();\n    }\n    throw new Error(\"not is not supported in Zod (except { not: {} } for never)\");\n  }\n  if (schema.unevaluatedItems !== undefined) {\n    throw new Error(\"unevaluatedItems is not supported\");\n  }\n  if (schema.unevaluatedProperties !== undefined) {\n    throw new Error(\"unevaluatedProperties is not supported\");\n  }\n  if (schema.if !== undefined || schema.then !== undefined || schema.else !== undefined) {\n    throw new Error(\"Conditional schemas (if/then/else) are not supported\");\n  }\n  if (schema.dependentSchemas !== undefined || schema.dependentRequired !== undefined) {\n    throw new Error(\"dependentSchemas and dependentRequired are not supported\");\n  }\n\n  // Handle $ref\n  if (schema.$ref) {\n    const refPath = schema.$ref;\n    if (ctx.refs.has(refPath)) {\n      return ctx.refs.get(refPath)!;\n    }\n\n    if (ctx.processing.has(refPath)) {\n      // Circular reference - use lazy\n      return z.lazy(() => {","sourceCodeStart":142,"sourceCodeEnd":178,"githubUrl":"https://github.com/colinhacks/zod/blob/2d90846af918af9602e088812d63a035d47cdbe4/packages/zod/src/v4/classic/from-json-schema.ts#L142-L178","documentation":"Thrown by convertBaseSchema (packages/zod/src/v4/classic/from-json-schema.ts:160) when the source JSON Schema contains the `unevaluatedProperties` keyword (a draft-2019+ feature constraining object properties not matched by properties/patternProperties/additionalProperties). Because Zod objects resolve extra-key handling statically (strip/passthrough/strict/catchall), there is no way to express the dynamic 'unevaluated' behaviour, so the converter rejects the document.","triggerScenarios":"Calling fromJSONSchema on a schema like `{ type: 'object', properties: {...}, unevaluatedProperties: false }` or `unevaluatedProperties: { type: 'string' }`. The presence of the key alone — value irrelevant — triggers the throw.","commonSituations":"Strict draft-2019/2020-12 schemas that forbid unknown properties via unevaluatedProperties; OpenAPI 3.1 documents using the newer vocabulary; schemas exported from strict validation tooling.","solutions":["Remove the `unevaluatedProperties` key before conversion.","If the intent was strict no-extras, use additionalProperties: false in the source — the converter maps that to z.object().strict().","If extras should match a schema, use additionalProperties as a schema object — the converter maps that to .catchall().","Pre-process to strip draft-2019+ keys the converter does not support."],"exampleFix":"// before\nconst schema = {\n  type: 'object',\n  properties: { id: { type: 'string' } },\n  unevaluatedProperties: false,\n};\nfromJSONSchema(schema); // throws\n\n// after — use additionalProperties: false (maps to .strict())\nconst schema = {\n  type: 'object',\n  properties: { id: { type: 'string' } },\n  additionalProperties: false,\n};\nfromJSONSchema(schema);","handlingStrategy":"validation","validationCode":"function assertNoUnevaluatedProperties(root: unknown) {\n  const visit = (node: unknown): void => {\n    if (Array.isArray(node)) return node.forEach(visit);\n    if (!node || typeof node !== 'object') return;\n    const o = node as Record<string, unknown>;\n    if ('unevaluatedProperties' in o) throw new Error('Schema uses unevaluatedProperties, which Zod cannot express');\n    for (const v of Object.values(o)) visit(v);\n  };\n  visit(root);\n}","typeGuard":"null","tryCatchPattern":"null","preventionTips":["Use additionalProperties: false (maps to .strict()) or additionalProperties as a schema (maps to .catchall()) instead of unevaluatedProperties.","Strip unevaluatedProperties from draft-2019+ documents before conversion.","Audit strict enterprise schemas for unevaluated* usage before importing.","Document the mapping (additionalProperties -> Zod) for schema authors."],"tags":["json-schema","from-json-schema","conversion","unsupported","object"],"backgroundTag":null,"analyzedSha":"2d90846af918af9602e088812d63a035d47cdbe4","analyzedAt":"2026-08-11T01:21:44.015Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-22T11:17:16.035Z"}