{"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":159,"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":141,"sourceCodeEnd":177,"githubUrl":"https://github.com/colinhacks/zod/blob/912f0f51b0ced654d0069741e7160834dca742ee/packages/zod/src/v4/classic/from-json-schema.ts#L141-L177","documentation":"Thrown by convertBaseSchema when the input contains `unevaluatedProperties`. Like unevaluatedItems, this keyword only has meaning relative to evaluated applicators and cannot be statically lowered into Zod's object/record/catchall model.","triggerScenarios":"Schemas using `unevaluatedProperties: false` (typically to forbid any property not explicitly validated, including those surfaced via allOf/$ref).","commonSituations":"Strict-mode JSON Schemas from API style guides; auto-generated schemas from TypeScript types with `additionalProperties: false` plus composition; draft-2020-12 strict profiles.","solutions":["Drop `unevaluatedProperties` and rely on `additionalProperties: false` (which the converter supports as `.strict()`).","Inline composed schemas so all properties are visible to the object converter, then use `additionalProperties: false`.","Strip the keyword in a pre-pass if your use case tolerates the looser behaviour."],"exampleFix":"// before\n{ \"allOf\": [{ ... }], \"unevaluatedProperties\": false }\n\n// after\n{ \"type\": \"object\", \"properties\": { ... }, \"additionalProperties\": false }","handlingStrategy":"validation","validationCode":"function stripUnsupported(schema: any) {\n  if (schema.unevaluatedProperties !== undefined) {\n    delete schema.unevaluatedProperties;\n  }\n}","typeGuard":"function hasUnevaluatedProperties(s: any): boolean { return s?.unevaluatedProperties !== undefined; }","tryCatchPattern":null,"preventionTips":["Prefer `additionalProperties: false` over `unevaluatedProperties: false`.","Inline `allOf` composition before conversion so all properties are visible.","Validate incoming schemas against an allow-list of supported keywords."],"tags":["json-schema","unevaluatedproperties","unsupported","v4","from-json-schema"],"analyzedSha":"912f0f51b0ced654d0069741e7160834dca742ee","analyzedAt":"2026-08-03T17:41:55.908Z","schemaVersion":2}