create-client
create-client copied to clipboard
OpenAPI v3 generator doesn't work with demo
API Platform version(s) affected: 0.5.1
Command
npx @api-platform/client-generator "https://demo.api-platform.com/docs.json?spec_version=3" output/ --format openapi3
Error
TypeError: Cannot convert undefined or null to object
at Function.keys (<anonymous>)
at /Users/blaa/.npm/_npx/67469/lib/node_modules/@api-platform/client-generator/node_modules/@api-platform/api-doc-parser/lib/openapi3/handleJson.js:19:34
at Array.map (<anonymous>)
at Object.default_1 [as default] (/Users/blaa/.npm/_npx/67469/lib/node_modules/@api-platform/client-generator/node_modules/@api-platform/api-doc-parser/lib/openapi3/handleJson.js:16:27)
at /Users/blaa/.npm/_npx/67469/lib/node_modules/@api-platform/client-generator/node_modules/@api-platform/api-doc-parser/lib/openapi3/parseOpenApi3Documentation.js:12:45
at processTicksAndRejections (internal/process/task_queues.js:97:5)
Maybe duplicated https://github.com/api-platform/client-generator/issues/198
This feature is experimental and I hadn't a chance to test it by myself yet... There are chances it is broken. I strongly recommended using the Hydra support for now.
Hi, @dunglas. Thank you for the very fast reply. The main problem for me that I want to use generators with some OpenAPI v3 enabled api. I haven't any chance in this point, because only api-platform exposed Hydra-enabled api.
Getting the same here trying to get client-generator to work with my FastAPI projects.
Is there any chance someone will have a look ?
Best regards.
Build command line and output:
C:\>project\>npx @api-platform/client-generator http://127.0.0.1:8000/openapi.json output/ --format openapi3
Error
at C:\Users\user\AppData\Local\npm-cache\_npx\5feb941c1afcc05f\node_modules\@api-platform\api-doc-parser\lib\openapi3\handleJson.js:24:19
at Array.map (<anonymous>)
at Object.default_1 [as default] (C:\Users\user\AppData\Local\npm-cache\_npx\5feb941c1afcc05f\node_modules\@api-platform\api-doc-parser\lib\openapi3\handleJson.js:18:27)
at C:\Users\user\AppData\Local\npm-cache\_npx\5feb941c1afcc05f\node_modules\@api-platform\api-doc-parser\lib\openapi3\parseOpenApi3Documentation.js:13:45
at processTicksAndRejections (node:internal/process/task_queues:94:5)
OpenAPI 3 support has been greatly improved in the client generator (and the underlying library) since https://github.com/api-platform/api-doc-parser/pull/108. There should no be major issue now.