{"record":{"id":"64af6819fdaafaf9","repo":"mckaywrigley/chatbot-ui","slug":"some-methods-with-a-requestbody-are-missing-reques","errorCode":null,"errorMessage":"Some methods with a requestBody are missing requestBody.content","messagePattern":"Some methods with a requestBody are missing requestBody\\.content","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"lib/openapi-conversion.ts","lineNumber":64,"sourceCode":"    }\n  })\n\n  if (\n    Object.values(openapiSpec.paths).some((methods: any) =>\n      Object.values(methods).some((spec: any) => !spec.operationId)\n    )\n  ) {\n    throw new Error(\"Some methods are missing operationId\")\n  }\n\n  if (\n    Object.values(openapiSpec.paths).some((methods: any) =>\n      Object.values(methods).some(\n        (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            )","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/mckaywrigley/chatbot-ui/blob/81328b61d2a4ab597a7a057be70e785cf756d9f8/lib/openapi-conversion.ts#L46-L82","documentation":"This error is thrown by validateOpenAPI when a path item operation declares a requestBody object but that requestBody has no content property. In OpenAPI, requestBody.content is required to describe the media types and schemas of the request body, so a requestBody without content is invalid and cannot be converted into a function parameter schema by openapiToFunctions.","triggerScenarios":"Calling openapiToFunctions with a spec where an operation (e.g. post/put/patch under openapiSpec.paths) contains requestBody: {} or requestBody: {required: true} with no content key, or with content misspelled/undefined. The check is Object.values(methods).some(spec => spec.requestBody && !spec.requestBody.content).","commonSituations":"Hand-written OpenAPI specs or LLM-generated specs that include an empty requestBody; YAML indentation mistakes putting content under the wrong nesting; specs converted from other formats dropping the content block; using $ref inside requestBody incorrectly so content resolves to undefined.","solutions":["Add a content object with at least one media type and schema: requestBody: { content: { 'application/json': { schema: { type: 'object', properties: {...} } } } }","If the operation takes no body, remove the requestBody entirely","Lint the spec with a tool like @redocly/cli or spectral before passing it to openapiToFunctions"],"exampleFix":"// before\npost:\n  requestBody:\n    required: true\n// after\npost:\n  requestBody:\n    required: true\n    content:\n      application/json:\n        schema:\n          type: object\n          properties:\n            name:\n              type: string","handlingStrategy":"validation","validationCode":"const ops = Object.values(spec.paths ?? {}).flatMap(m => Object.values(m));\nconst bad = ops.filter(o => o?.requestBody && !o.requestBody.content).length;\nif (bad > 0) throw new Error(`${bad} operations have requestBody without content`);","typeGuard":"const hasValidRequestBody = (op: any): boolean =>\n  !op?.requestBody || (typeof op.requestBody.content === 'object' && Object.keys(op.requestBody.content).length > 0);","tryCatchPattern":"try { return await openapiToFunctions(spec) } catch (e) { if (e instanceof Error && e.message.includes('requestBody.content')) { /* fix spec and re-validate */ } throw e }","preventionTips":["Run a spectral/@redocly lint pass on every spec before conversion","Generate specs from code (zod-to-openapi, tsoa) rather than hand-writing them"],"tags":["openapi","schema-validation","request-body"],"backgroundTag":"openapi-schema-validation-failed","analyzedSha":"81328b61d2a4ab597a7a057be70e785cf756d9f8","analyzedAt":"2026-08-27T19:24:42.689Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}