Ryan-Sin / swagger-nestjs-codegen

MIT License
20 stars 4 forks source link

failed to generate project #1

Open ianzone opened 2 years ago

ianzone commented 2 years ago

This is a very interesting project, but it failed to generate the nestjs project from this openapi example https://editor.swagger.io/

❯ codegen -s ./openapi.yaml -p openapi
? Do you want to create a database module? not
? Do you want to create a kafka module? not
? Do you want to create a project? Yes
/home/ian/.local/share/pnpm/global/5/.pnpm/@newko+swagger-nestjs-codegen@1.3.3/node_modules/@newko/swagger-nestjs-codegen/lib/components.js:45
        throw Error(
              ^

Error: Pet => Schemas object properties type in undefined
    at /home/ian/.local/share/pnpm/global/5/.pnpm/@newko+swagger-nestjs-codegen@1.3.3/node_modules/@newko/swagger-nestjs-codegen/lib/components.js:45:15
    at /home/ian/.local/share/pnpm/global/5/.pnpm/lodash@4.17.21/node_modules/lodash/lodash.js:4967:15
    at baseForOwn (/home/ian/.local/share/pnpm/global/5/.pnpm/lodash@4.17.21/node_modules/lodash/lodash.js:3032:24)
    at /home/ian/.local/share/pnpm/global/5/.pnpm/lodash@4.17.21/node_modules/lodash/lodash.js:4936:18
    at Function.forEach (/home/ian/.local/share/pnpm/global/5/.pnpm/lodash@4.17.21/node_modules/lodash/lodash.js:9410:14)
    at /home/ian/.local/share/pnpm/global/5/.pnpm/@newko+swagger-nestjs-codegen@1.3.3/node_modules/@newko/swagger-nestjs-codegen/lib/components.js:42:7
    at /home/ian/.local/share/pnpm/global/5/.pnpm/lodash@4.17.21/node_modules/lodash/lodash.js:4967:15
    at baseForOwn (/home/ian/.local/share/pnpm/global/5/.pnpm/lodash@4.17.21/node_modules/lodash/lodash.js:3032:24)
    at /home/ian/.local/share/pnpm/global/5/.pnpm/lodash@4.17.21/node_modules/lodash/lodash.js:4936:18
    at Function.forEach (/home/ian/.local/share/pnpm/global/5/.pnpm/lodash@4.17.21/node_modules/lodash/lodash.js:9410:14)

Node.js v18.7.0
Ryan-Sin commented 2 years ago

Hi Yiheng, If you create a project based on the openapi example, you cannot create it.

You can know the basic structure by creating a project through the codegen-example command.

Please check README.md for the criteria for creating yaml files. It's not hard.

Because we need to create a project based on the Nest.js framework, we don't support features supported by openapi, so please check the README.md file.

Thank you. If you contact me if you need anything, I will update the function.

Message ID: @.***>

sebastienfi commented 1 year ago

Schema's properties' type could be infered from $ref type property when present.