Skip to content

Issue about codegen in nestjs #111

@stuartch3n

Description

@stuartch3n

Excuse me. This is my first time to raise the issue in the github. If this is not proper way to raise my issue here. Please let me know.

I tried to use fresha/openapi-codegen-server-nestjs in the my nestjs project and found some issues.

  1. When I have security Schemes showed below in my yaml file. There is an error happened during the code generation:
TypeError: Cannot use 'in' operator to search for 'additionalProperties' in bearer.
at OpenAPIReader.parseSchemaAttributes (/mnt/e/cp-engagement-system/ORM-test/project/node_modules/@fresha/openapi-model/build/3.0.3/model/OpenAPIReader.js:342:36)
    at OpenAPIReader.parseSchema (/mnt/e/cp-engagement-system/ORM-test/project/node_modules/@fresha/openapi-model/build/3.0.3/model/OpenAPIReader.js:377:14)
    at OpenAPIReader.parseHttpSecurityScheme (/mnt/e/cp-engagement-system/ORM-test/project/node_modules/@fresha/openapi-model/build/3.0.3/model/OpenAPIReader.js:811:30)
    at OpenAPIReader.parseSecurityScheme (/mnt/e/cp-engagement-system/ORM-test/project/node_modules/@fresha/openapi-model/build/3.0.3/model/OpenAPIReader.js:784:29)
    at OpenAPIReader.parseComponents (/mnt/e/cp-engagement-system/ORM-test/project/node_modules/@fresha/openapi-model/build/3.0.3/model/OpenAPIReader.js:260:45)
    at OpenAPIReader.parse (/mnt/e/cp-engagement-system/ORM-test/project/node_modules/@fresha/openapi-model/build/3.0.3/model/OpenAPIReader.js:108:14)
    at OpenAPIReader.parseFromFile (/mnt/e/cp-engagement-system/ORM-test/project/node_modules/@fresha/openapi-model/build/3.0.3/model/OpenAPIReader.js:85:21)
    at Object.handler (/mnt/e/cp-engagement-system/ORM-test/project/node_modules/@fresha/openapi-codegen-server-nestjs/build/index.js:35:35)
    at /mnt/e/cp-engagement-system/ORM-test/project/node_modules/yargs/build/index.cjs:1:8891
    at j (/mnt/e/cp-engagement-system/ORM-test/project/node_modules/yargs/build/index.cjs:1:4956)

Here is my security schemes:

securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: opaque

After tracing the error in the source code, I found it used 'schema' and 'scheme' at the same time when deal with parsing Http security scheme. is it possible something wrong happened there?

  1. After I deleted this security schemes from my yaml. I generated the relevant codes successfully. But, there is an import issue in all the controllers:
    import { JSONAPI } from "@fresha/json-api";
    I cannot find the module "@fresha/json-api". I tried to install "@fresha/api-tools-core" for my project. But it didn't help with anything. Moreover, I tried to install "@fresha/json-api" directly as well. But this package cannot be found. Is there any other supportive package I should install for this one?

It would be so appreicated, if anyone can have a look on my issues and provide some suggestions.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions