create-client
create-client copied to clipboard
Can't generate code from demo resource (React + OpenAPI3)
API Platform version(s) affected: latest, retrieved using npx
Description
Example command in README fails to execute when pointing to demo server using openapi3 format.
How to reproduce
- Create a new empty project following the steps in the documentation
- After the app is created, run the code generation command:
npx @api-platform/client-generator https://demo.api-platform.com/docs.json src/ --resource Book --format openapi3
Expected result: React code would be generated
Actual result: An Exception has been raised:
TypeError: Cannot convert undefined or null to object
at Function.keys (<anonymous>)
at /Users/{myuser}/.npm/_npx/10629/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/{myuser}/.npm/_npx/10629/lib/node_modules/@api-platform/client-generator/node_modules/@api-platform/api-doc-parser/lib/openapi3/handleJson.js:16:27)
at /Users/{myuser}/.npm/_npx/10629/lib/node_modules/@api-platform/client-generator/node_modules/@api-platform/api-doc-parser/lib/openapi3/parseOpenApi3Documentation.js:12:45
Possible Solution
Additional Context
Same here.
+1
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.