{"record":{"id":"dc5615e35cc4747c","repo":"mckaywrigley/chatbot-ui","slug":"in-context-paths-object-keys-methods-0","errorCode":null,"errorMessage":"In context=('paths', '${Object.keys(methods)[0]}', '${Object.keys(spec)[0]}', 'requestBody', 'content', 'application/json', 'schema'), object schema missing properties","messagePattern":"In context=\\('paths', '(.+?)', '(.+?)', 'requestBody', 'content', 'application/json', 'schema'\\), object schema missing properties","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"lib/openapi-conversion.ts","lineNumber":78,"sourceCode":"        (spec: any) => spec.requestBody && !spec.requestBody.content\n      )\n    )\n  ) {\n    throw new Error(\n      \"Some methods with a requestBody are missing requestBody.content\"\n    )\n  }\n\n  if (\n    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: {","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/mckaywrigley/chatbot-ui/blob/81328b61d2a4ab597a7a057be70e785cf756d9f8/lib/openapi-conversion.ts#L60-L96","documentation":"During validation, any operation whose application/json request body schema exists but has no properties (or an empty properties object) triggers this contextual error. openapiToFunctions converts each JSON body schema into typed function parameters, so an object schema without properties would produce a function with an unusable parameter list, hence the guard.","triggerScenarios":"An operation with requestBody.content['application/json'].schema set to {type: 'object'} with no properties key, an empty properties: {}, or a schema whose top-level keys (e.g. only $ref/type) make properties falsy/empty. Triggered per-operation during openapiToFunctions validation.","commonSituations":"Placeholder schemas like schema: {type: 'object'} left in drafts; specs where all fields were moved to $ref'd definitions leaving the inline object empty; LLM-generated specs; refactoring that deleted properties but left the schema shell.","solutions":["Add the missing properties to the schema: schema: { type: 'object', properties: { ... }, required: [...] }","If properties live in a component, use allOf/$ref so the inline schema resolves to actual fields, or inline them","If the body genuinely has no fields, consider removing the requestBody from that operation"],"exampleFix":"// before\nschema:\n  type: object\n// after\nschema:\n  type: object\n  properties:\n    id:\n      type: string","handlingStrategy":"validation","validationCode":"const schema = op?.requestBody?.content?.['application/json']?.schema;\nconst ok = !schema || (schema.properties && Object.keys(schema.properties).length > 0);\nif (!ok) throw new Error(`empty object schema on ${opId}`);","typeGuard":"const schemaHasProperties = (s: any): boolean =>\n  !s || s.type !== 'object' || (s.properties && Object.keys(s.properties).length > 0);","tryCatchPattern":"catch (e) { if (e.message.includes('object schema missing properties')) { console.error('Fix spec at', e.message.match(/context=([^ ]+)/)?.[0]); } throw e; }","preventionTips":["Walk the whole spec in CI asserting every type:object schema has non-empty properties","Avoid placeholder {type:'object'} stubs in committed specs"],"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"}