handle schemas with one type array

This commit is contained in:
Jack Thomson 2025-07-31 11:22:16 +01:00
parent 47292c89cf
commit bc4ee55ac2
No known key found for this signature in database
GPG Key ID: 58D01BD3612EFF1C
2 changed files with 6 additions and 2 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "openapi-mcp-generator",
"version": "3.1.2",
"version": "3.1.4",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "openapi-mcp-generator",
"version": "3.1.2",
"version": "3.1.4",
"license": "MIT",
"dependencies": {
"@apidevtools/swagger-parser": "^10.1.1",

View File

@ -203,6 +203,10 @@ export function mapOpenApiSchemaToJsonSchema(
} else if (!jsonSchema.type) {
jsonSchema.type = 'null';
}
} else {
if (Array.isArray(jsonSchema.type) && jsonSchema.type.length === 1) {
jsonSchema.type = jsonSchema.type[0];
}
}
// Recursively process object properties