Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue about codegen in nestjs #111

Open
stuartch3n opened this issue Feb 7, 2023 · 2 comments
Open

Issue about codegen in nestjs #111

stuartch3n opened this issue Feb 7, 2023 · 2 comments
Assignees

Comments

@stuartch3n
Copy link

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.

@mykulyak
Copy link
Contributor

Hello, thanks for raising this issue. Will look at it later this week.

P.S. Sorry for late response, last 2 weeks I was sick.

@mykulyak mykulyak self-assigned this Feb 24, 2023
@gms1
Copy link

gms1 commented Dec 30, 2023

maybe it would be worth testing whether at least the OpenAPI examples can be generated; e.g.:
https://github.com/OAI/OpenAPI-Specification/blob/main/examples/v3.0/petstore.yaml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants