Open RakhithaRR opened 3 months ago
This is occurring due to a limitation in the ballerina agent side. The error getting logged at that level is as follows:
"The OpenAPI specification includes non-JSON input types, which are not currently supported." error={"causes":[],"message":"Only json, xml or text content is supported.","detail":{"availableContentTypes":["application/x-www-form-urlencoded"]},"stackTrace":[{"callableName":"visitContent","moduleName":"wso2.ai.agent.0.OpenApiSpecVisitor","fileName":"openapi_utils.bal","lineNumber":213},{"callableName":"visitRequestBody","moduleName":"wso2.ai.agent.0.OpenApiSpecVisitor","fileName":"openapi_utils.bal","lineNumber":220},{"callableName":"visitOperation","moduleName":"wso2.ai.agent.0.OpenApiSpecVisitor","fileName":"openapi_utils.bal","lineNumber":190},{"callableName":"visitPathItem","moduleName":"wso2.ai.agent.0.OpenApiSpecVisitor","fileName":"openapi_utils.bal","lineNumber":166},{"callableName":"visitPaths","moduleName":"wso2.ai.agent.0.OpenApiSpecVisitor","fileName":"openapi_utils.bal","lineNumber":150},{"callableName":"visit","moduleName":"wso2.ai.agent.0.OpenApiSpecVisitor","fileName":"openapi_utils.bal","lineNumber":104},{"callableName":"extractToolsFromOpenApiJsonSpec","moduleName":"wso2.ai.agent.0","fileName":"openapi_utils.bal","lineNumber":66},{"callableName":"$post$prepare","moduleName":"choreo.testgpt.2.$anonType$_24","fileName":"service.bal","lineNumber":124}]} id="1"
Ballerina agent returns a 500 Internal Server Error with the following error response:
{
"level": "WARN",
"message": "The OpenAPI specification includes non-JSON input types, which are not currently supported.",
"code": "UNSUPPORTED_MEDIA_TYPE"
}
In summary, API Chat page gives this error as we are unable to parse the API specification at the ballerina agent level. Error is occurring due to the following content under the API specification.
"requestBody": {
"content": {
"application/x-www-form-urlencoded": {
"schema": {
"type": "object",
"properties": {
"criteria": {
"description": "Uses Lucene Query Syntax in the format of propertyName:value, propertyName:[num1 TO num2] and date range format: propertyName:[yyyyMMdd TO yyyyMMdd]. In the response please see the 'docs' element which has the list of record objects. Each record structure would consist of all the fields and their corresponding values.",
"type": "string",
"default": "*:*"
},
"start": {
"description": "Starting record number. Default value is 0.",
"type": "integer",
"default": 0
},
"rows": {
"description": "Specify number of rows to be returned. If you run the search with default values, in the response you will see 'numFound' attribute which will tell the number of records available in the dataset.",
"type": "integer",
"default": 100
}
},
"required": [
"criteria"
]
}
}
}
}
Description
The following error is observed after creating an API using a valid OpenAPI 3.0.1 definition
Steps to Reproduce
Affected Component
APIM
Version
4.3.0
Environment Details (with versions)
No response
Relevant Log Output
No response
Related Issues
No response
Suggested Labels
No response