{"record":{"id":"594cf13397f04969","repo":"iflytek/astron-agent","slug":"openapi-schema-body-type-err","errorCode":"OPENAPI_SCHEMA_BODY_TYPE_ERR","errorMessage":"openapi schema 当前不支持{content_type}请求体","messagePattern":"openapi schema 当前不支持(.+?)请求体","errorType":"error_code","errorClass":"SparkLinkOpenapiSchemaException","httpStatus":null,"severity":"error","filePath":"core/plugin/link/utils/open_api_schema/schema_parser.py","lineNumber":273,"sourceCode":"        # Process parameters\n        if \"parameters\" in interface[\"operation\"]:\n            if result := self.schema_params_parser(\n                interface[\"operation\"][\"parameters\"], span=span_context\n            ):\n                path_schema, query_schema, header_schema = result\n            else:\n                path_schema = query_schema = header_schema = None\n\n        # Process request body\n        self._process_request_body_refs(interface, openapi)\n        request_body = interface.get(\"operation\", {}).get(\"requestBody\", {})\n        for content_type, content in request_body.get(\"content\", {}).items():\n            if content_type == \"application/json\":\n                request_body_schema = self.schema_body_json_parser(\n                    content, span=span_context\n                )\n            else:\n                raise SparkLinkOpenapiSchemaException(\n                    code=ErrCode.OPENAPI_SCHEMA_BODY_TYPE_ERR.code,\n                    err_pre=ErrCode.OPENAPI_SCHEMA_BODY_TYPE_ERR.msg,\n                    err=f\"openapi schema 当前不支持{content_type}请求体\",\n                )\n\n        return {\n            \"path_schema\": path_schema,\n            \"query_schema\": query_schema,\n            \"header_schema\": header_schema,\n            \"request_body_schema\": request_body_schema,\n            \"security_info\": security_info,\n            \"security_type\": security_type,\n        }\n\n    def _build_operation_bundle(\n        self, interface: Dict[str, Any], schemas: Dict[str, Any], server_url: str\n    ) -> Tuple[str, Dict[str, Any]]:\n        \"\"\"Build operation bundle for a single interface.\"\"\"","sourceCodeStart":255,"sourceCodeEnd":291,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/core/plugin/link/utils/open_api_schema/schema_parser.py#L255-L291","documentation":"When processing an interface's requestBody, the parser only supports content type 'application/json'. Any other content type (multipart/form-data, application/x-www-form-urlencoded, text/plain, etc.) raises SparkLinkOpenapiSchemaException with code OPENAPI_SCHEMA_BODY_TYPE_ERR.","triggerScenarios":"Importing a tool whose OpenAPI operation declares requestBody with content other than application/json, e.g. content: multipart/form-data or application/x-www-form-urlencoded for file uploads or form posts.","commonSituations":"Specs for file-upload endpoints; legacy form-based APIs; auto-generated specs from frameworks that emit form or binary content types.","solutions":["Rewrite the API spec so the request body uses application/json","If the target API genuinely needs multipart/form, implement a dedicated parser branch for that content type","Remove the requestBody from the operation if the endpoint takes no JSON body and encode parameters in query/path instead"],"exampleFix":"// before (yaml)\nrequestBody:\n  content:\n    application/x-www-form-urlencoded:\n      schema: {...}\n// after (yaml)\nrequestBody:\n  content:\n    application/json:\n      schema: {...}","handlingStrategy":"validation","validationCode":"def has_supported_body(op: dict) -> bool:\n    body = op.get(\"requestBody\") or {}\n    return \"application/json\" in (body.get(\"content\") or {})","typeGuard":null,"tryCatchPattern":"try:\n    parser.parse(spec)\nexcept SparkLinkOpenapiSchemaException as e:\n    if e.code == ErrCode.OPENAPI_SCHEMA_BODY_TYPE_ERR.code:\n        logger.warning(\"requestBody content-type not supported\")\n    raise","preventionTips":["Only register tools whose endpoints accept/return application/json","Pre-process specs to strip or convert non-JSON requestBody operations","Extend the parser to support multipart only if genuinely required"],"tags":["openapi","schema","content-type","unsupported"],"backgroundTag":"unsupported-operation","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-19T12:17:13.211Z"}