{"record":{"id":"a3b40d961ef6f309","repo":"can1357/oh-my-pi","slug":"unsupported-json-schema-type-kind","errorCode":null,"errorMessage":"unsupported JSON Schema type: ${kind}","messagePattern":"unsupported JSON Schema type: (.+?)","errorType":"exception","errorClass":"OmpTypeError","httpStatus":null,"severity":"error","filePath":"packages/omptype/src/from-json-schema.ts","lineNumber":145,"sourceCode":"\t\t\t\tif (typeof node.minimum === \"number\") ir.min = node.minimum;\n\t\t\t\tif (typeof node.maximum === \"number\") ir.max = node.maximum;\n\t\t\t\tif (typeof node.exclusiveMinimum === \"number\") {\n\t\t\t\t\tir.min = node.exclusiveMinimum;\n\t\t\t\t\tir.xmin = true;\n\t\t\t\t}\n\t\t\t\tif (typeof node.exclusiveMaximum === \"number\") {\n\t\t\t\t\tir.max = node.exclusiveMaximum;\n\t\t\t\t\tir.xmax = true;\n\t\t\t\t}\n\t\t\t\tif (typeof node.multipleOf === \"number\") ir.divisor = node.multipleOf;\n\t\t\t\treturn ir;\n\t\t\t}\n\t\t\tcase \"object\":\n\t\t\t\treturn this.#lowerObject(node);\n\t\t\tcase \"array\":\n\t\t\t\treturn this.#lowerArray(node);\n\t\t\tdefault:\n\t\t\t\tthrow new OmpTypeError(`unsupported JSON Schema type: ${kind}`);\n\t\t}\n\t}\n\n\t#lowerString(node: JsonSchema): IR {\n\t\tconst base: IR = { k: \"string\" };\n\t\tif (typeof node.minLength === \"number\") base.min = node.minLength;\n\t\tif (typeof node.maxLength === \"number\") base.max = node.maxLength;\n\t\tif (node.format === \"uri\" || node.format === \"url\") base.url = true;\n\n\t\tconst members: IR[] = [];\n\t\tif (typeof node.format === \"string\") {\n\t\t\tconst keyword = FORMAT_KEYWORDS[node.format];\n\t\t\tif (keyword !== undefined) {\n\t\t\t\tconst formatIR = keywordIR(keyword);\n\t\t\t\tif (formatIR !== undefined) members.push(formatIR);\n\t\t\t}\n\t\t}\n\t\tif (typeof node.pattern === \"string\") members.push(patternIR(new RegExp(node.pattern)));","sourceCodeStart":127,"sourceCodeEnd":163,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/omptype/src/from-json-schema.ts#L127-L163","documentation":"`fromJsonSchema` supports the core JSON Schema types (`string`, `number`, `integer`, `boolean`, `object`, `array`) but the schema declared a `type` value outside that set (e.g. `\"null\"` alone, or a misspelled type). The lowering pass throws `OmpTypeError` naming the unsupported kind.","triggerScenarios":"`{\"type\": \"null\"}` (sole type), `{\"type\": \"integer \"}` with stray whitespace, `{\"type\": \"float\"}`, or custom pseudo-types from dialects the converter doesn't know.","commonSituations":"OpenAPI 3.x schemas using `nullable: true` with `type: \"null\"`; vendor dialects (`integer64`); typo'd type names in hand-written schemas.","solutions":["Use union syntax `{ \"type\": [\"string\", \"null\"] }` instead of `\"null\"` as a sole/extra type if unions are supported; otherwise drop `\"null\"`.","Fix typos and stray whitespace in the `type` field; use only string|number|integer|boolean|object|array.","Replace dialect-specific types (`float` → `number`, `integer64` → `integer`) before conversion."],"exampleFix":"// before\n{ \"type\": \"float\" }\n// after\n{ \"type\": \"number\" }","handlingStrategy":"validation","validationCode":"const SUPPORTED = new Set([\"string\", \"number\", \"integer\", \"boolean\", \"object\", \"array\"]);\nfunction hasSupportedTypes(node: Record<string, unknown>): boolean {\n  const t = node.type;\n  const types = Array.isArray(t) ? t : t !== undefined ? [t] : [];\n  return types.every(x => SUPPORTED.has(String(x).trim()));\n}","typeGuard":null,"tryCatchPattern":"try {\n  const t = fromJsonSchema(schema);\n} catch (err) {\n  if (err instanceof Error && err.message.startsWith(\"unsupported JSON Schema type\")) {\n    throw new Error(`Normalize the type field: ${err.message}`);\n  }\n  throw err;\n}","preventionTips":["Normalize dialect-specific types (float→number, drop \"null\" from type arrays if unsupported) before conversion.","Lint schemas for typos in `type` values.","Convert OpenAPI `nullable: true` to union types explicitly."],"tags":["json-schema","unsupported-type","type-error"],"backgroundTag":"unsupported-json-schema-type","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}