{"record":{"id":"d0b245b2f92d6fb9","repo":"can1357/oh-my-pi","slug":"mapped-property-string-property-key-must-conta","errorCode":null,"errorMessage":"mapped property ${String(property.key)} must contain a schema value","messagePattern":"mapped property (.+?) must contain a schema value","errorType":"exception","errorClass":"OmpTypeError","httpStatus":null,"severity":"error","filePath":"packages/omptype/src/type.ts","lineNumber":1760,"sourceCode":"\treturn mergeObjects(requireObject(ir, \"merge\"), requireObject(parseDef(definition, resolve), \"merge\"));\n}\n\nfunction propertyFromIR(prop: PropIR): TypeProperty {\n\treturn {\n\t\tkind: prop.opt ? \"optional\" : \"required\",\n\t\tkey: prop.key,\n\t\tvalue: makeType(prop.val, [], {}) as unknown as FluentType<unknown>,\n\t\t...(prop.hasDefault ? { default: prop.def } : {}),\n\t\tmeta: {},\n\t};\n}\n\nfunction propertyToIR(property: TypeProperty): PropIR {\n\tif (property.kind !== \"required\" && property.kind !== \"optional\") {\n\t\tthrow new OmpTypeError(`mapped property ${String(property.key)} has invalid kind`);\n\t}\n\tif (!(IR_BRAND in property.value)) {\n\t\tthrow new OmpTypeError(`mapped property ${String(property.key)} must contain a schema value`);\n\t}\n\tconst hasDefault = Object.hasOwn(property, \"default\");\n\treturn {\n\t\tkey: property.key,\n\t\topt: property.kind === \"optional\",\n\t\tval: embed(property.value),\n\t\t...(hasDefault\n\t\t\t? { def: property.default, defFactory: typeof property.default === \"function\", hasDefault: true }\n\t\t\t: {}),\n\t};\n}\n\nfunction acceptsDateIR(ir: IR): boolean {\n\tif (ir.k === \"instance\") return ir.ctor === Date;\n\tif (ir.k === \"refine\") return acceptsDateIR(ir.base);\n\tif (ir.k === \"union\") return ir.members.every(acceptsDateIR);\n\treturn false;\n}","sourceCodeStart":1742,"sourceCodeEnd":1778,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/omptype/src/type.ts#L1742-L1778","documentation":"While converting a property to IR, omptype checks that property.value carries the internal IR brand (IR_BRAND), proving it is a real omptype schema. A plain value, a string like 'string', or a foreign validator was passed where a schema was expected. The library throws instead of treating the value as a literal.","triggerScenarios":"type({ age: 42 }) or type({ id: someZodSchema }) — passing raw values or third-party schema objects as property values instead of omptype types.","commonSituations":"Mixing validation libraries (zod/yup objects inside an omptype type()); forgetting to wrap literals (use literal(42)); typos like type({x: 'string'}).","solutions":["Wrap the value in an omptype type: string, number(string), literal(42), etc.","If integrating another validator, convert it to an omptype schema first","Check that you did not shadow the imported string/number helpers with local variables","Inspect the offending key from the error message and verify its value came from an omptype builder"],"exampleFix":"// before\ntype({ retries: 3 })\n// after\ntype({ retries: literal(3) })","handlingStrategy":"validation","validationCode":"function allValuesAreSchemas(props) {\n  return Object.values(props).every(v => v && typeof v === 'object' && '~ir' in v); // schema-brand check\n}","typeGuard":"function isOmpSchema(v): v is InternalType {\n  return typeof v === 'object' && v !== null && IR_BRAND in v;\n}","tryCatchPattern":"try {\n  const T = type(props);\n} catch (err) {\n  if (err instanceof OmpTypeError && err.message.includes('must contain a schema value')) {\n    throw new Error('property value is not an omptype schema — wrap it with string()/number()/literal()');\n  }\n  throw err;\n}","preventionTips":["Wrap raw values with literal()/enum() instead of passing them directly","Never place foreign-library validators inside type()","Keep an import-lint rule so string/number helpers are not shadowed"],"tags":["omptype","schema","not-a-schema","brand-check"],"backgroundTag":"value-is-not-a-schema","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}