{"record":{"id":"636da4f2e6e0b98b","repo":"mckaywrigley/chatbot-ui","slug":"some-object-schemas-are-missing-properties","errorCode":null,"errorMessage":"Some object schemas are missing properties","messagePattern":"Some object schemas are missing properties","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"lib/openapi-conversion.ts","lineNumber":88,"sourceCode":"    Object.values(openapiSpec.paths).some((methods: any) =>\n      Object.values(methods).some((spec: any) => {\n        if (spec.requestBody?.content?.[\"application/json\"]?.schema) {\n          if (\n            !spec.requestBody.content[\"application/json\"].schema.properties ||\n            Object.keys(spec.requestBody.content[\"application/json\"].schema)\n              .length === 0\n          ) {\n            throw new Error(\n              `In context=('paths', '${Object.keys(methods)[0]}', '${\n                Object.keys(spec)[0]\n              }', 'requestBody', 'content', 'application/json', 'schema'), object schema missing properties`\n            )\n          }\n        }\n      })\n    )\n  ) {\n    throw new Error(\"Some object schemas are missing properties\")\n  }\n}\n\nexport const openapiToFunctions = async (\n  openapiSpec: any\n): Promise<OpenAPIData> => {\n  const functions: any[] = [] // Define a proper type for function objects\n  const routes: {\n    path: string\n    method: string\n    operationId: string\n    requestInBody?: boolean // Add a flag to indicate if the request should be in the body\n  }[] = []\n\n  for (const [path, methods] of Object.entries(openapiSpec.paths)) {\n    if (typeof methods !== \"object\" || methods === null) {\n      continue\n    }","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/mckaywrigley/chatbot-ui/blob/81328b61d2a4ab597a7a057be70e785cf756d9f8/lib/openapi-conversion.ts#L70-L106","documentation":"This is the aggregated version of the schema-properties check: it fires when any object schema anywhere in the spec (components, nested schemas, response schemas) is missing or has empty properties. It complements the per-path contextual message by telling you the problem exists somewhere in the document even when it is not in a path's requestBody.","triggerScenarios":"Passing a spec to openapiToFunctions where at least one object schema in the document lacks a properties key or has properties: {} — typically in components/schemas, response definitions, or nested items — after the earlier per-operation checks have passed or as the final catch-all validation.","commonSituations":"Large specs where one buried schema is a stub; adding a new model without fields; $ref chains that end in an empty object schema; automated spec generation tools emitting {type: object} placeholders.","solutions":["Audit every object schema in the spec (components/schemas and inline) and add properties where missing","Run a JSON Schema linter or a script that walks the spec and reports schemas with empty properties, then fix each reported location","Remove or fully define stub schemas before conversion"],"exampleFix":"// before\ncomponents:\n  schemas:\n    Empty:\n      type: object\n// after\ncomponents:\n  schemas:\n    Empty:\n      type: object\n      properties:\n        message:\n          type: string","handlingStrategy":"validation","validationCode":"const emptySchemas = [];\nconst walk = (node) => {\n  if (node?.type === 'object' && (!node.properties || Object.keys(node.properties).length === 0)) emptySchemas.push(node);\n  Object.values(node ?? {}).forEach(v => typeof v === 'object' && v !== null && walk(v));\n};\nwalk(spec); // emptySchemas.length === 0 before calling openapiToFunctions","typeGuard":"const isCompleteObjectSchema = (s: any): boolean => s.type !== 'object' || (s.properties != null && Object.keys(s.properties).length > 0);","tryCatchPattern":null,"preventionTips":["Add a pre-conversion assertSpecHasProperties(spec) helper in tests","Keep specs under review with schema linters that flag empty objects"],"tags":["openapi","schema-validation","json-schema"],"backgroundTag":"openapi-schema-validation-failed","analyzedSha":"81328b61d2a4ab597a7a057be70e785cf756d9f8","analyzedAt":"2026-08-27T19:24:42.689Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}