openapi-zod-client
openapi-zod-client copied to clipboard
fix: Fixed an error when requestBody was of type "object"
trafficstars
Fixed an error when requestBody was of type "object" When the requestBody type is Object, an error is reported
{
"openapi": "3.0.3",
"info": {
"title": "Pets",
"version": "1.0.0"
},
"paths": {
"/pets": {
"post": {
"summary": "Post pets.",
"operationId": "PostPets",
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"data": {
"$ref": "#/components/schemas/PostPetsRequest"
}
}
}
}
}
},
"responses": {}
}
}
},
"components": {
"schemas": {
"PostPetsRequest": {
"type": "object",
"properties": {
"id": {
"type": "string"
}
}
}
}
}
}
depsGraphs.deepDependencyGraph[result.resolver.resolveSchemaName(schemaName).ref]?.forEach(
^
TypeError: Cannot read properties of undefined (reading 'ref')
at /Users/liufengmao/Desktop/vjshi/zod-test/packages/openapi-zod-client-vjs/dist/cli.js:1228:87
at Array.forEach (<anonymous>)
at /Users/liufengmao/Desktop/vjshi/zod-test/packages/openapi-zod-client-vjs/dist/cli.js:1223:27
at Array.forEach (<anonymous>)
at getZodClientTemplateContext (/Users/liufengmao/Desktop/vjshi/zod-test/packages/openapi-zod-client-vjs/dist/cli.js:1188:20)
at generateZodClientFromOpenAPI (/Users/liufengmao/Desktop/vjshi/zod-test/packages/openapi-zod-client-vjs/dist/cli.js:1298:16)
at CAC.<anonymous> (/Users/liufengmao/Desktop/vjshi/zod-test/packages/openapi-zod-client-vjs/dist/cli.js:1422:9)
Node.js v20.3.1
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| openapi-zod-client | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Jul 7, 2023 3:52am |
any opinion on this ? @WickyNilliams @feychenie
seems like the behavior is not correct now, since it never uses the named schema for requestBody, it always inlines a copy of it (hence all the failing tests)