Closed NathanTe closed 1 year ago
I've run into the same issue today, in a new Angular project (ng-openapi-gen v0.24.0) . Older angular projects don't have this issue (ng-openapi-gen v0.23.0)
I'll try for more information / steps to reproduce if/when I find some time.
Same error here. I'm on Angular 15.1, ng-openapi-gen v0.24.0. I will try with v0.23.0 and report back.
UPDATE: Downgraded to version v0.23.0 and everything works again
I couldn't reproduce this error...
Maybe it is a combination of specific descriptors, or NodeJS version...
Please, post the result of npx ng version
and, if possible, a minimal descriptor to reproduce it.
Thanks!
Node.js version v19.4.0 detected.
Odd numbered Node.js versions will not enter LTS status and should not be used for production. For more information, please see https://nodejs.org/en/about/releases/.
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 15.1.3
Node: 19.4.0 (Unsupported)
Package Manager: npm 9.2.0
OS: darwin arm64
Angular: 15.1.2
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1501.3
@angular-devkit/build-angular 15.1.3
@angular-devkit/core 15.1.3
@angular-devkit/schematics 15.1.3
@angular/cli 15.1.3
@schematics/angular 15.1.3
rxjs 7.8.0
typescript 4.9.4
Warning: The current version of Node (19.4.0) is not supported by Angular.
Might be a bad combination of Angular and Node. I just installed the latest of ng-openapi-gen and ran it with this json. Command line gave me the same results though.
{
"$schema": "node_modules/ng-openapi-gen/ng-openapi-gen-schema.json",
"input": "http://localhost:5000/swagger/v1/swagger.json",
"output": "src/app/api",
"ignoreUnusedModels": false
}
It is surely a combination of versions... If you try Node 18 LTS, will it work?
I've just generated a new project with Angular (below is the output)
❯ npx ng version
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 15.1.6
Node: 18.12.1
Package Manager: npm 8.19.2
OS: linux x64
Angular: 15.1.5
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1501.6
@angular-devkit/build-angular 15.1.6
@angular-devkit/core 15.1.6
@angular-devkit/schematics 15.1.6
@angular/cli 15.1.6
@schematics/angular 15.1.6
rxjs 7.8.0
typescript 4.9.5
And generated with the Cyclos API, which is quite large, and things just work...
npm i -D ng-openapi-gen
npx ng-openapi-gen --input https://raw.githubusercontent.com/cyclosproject/cyclos4-ui/master/src/openapi/cyclos-openapi.yaml
I tried this with
Node: 16.15.0
and ng-openapi-gen 0.24
and got the same error.
After upgrading to Node: 18.14.2
it works!
Thanks Manuel Varverde (which replied and I think, removed the post), which made me able to at least reproduce the issue. He was setting the json to a Swagger V2, not OpenAPI V3, and the error was in an early context where the logged wastn't initialized yet. I've fixed it, so, maybe you (@NathanTe, @georcon, @mode777 ) can also try to reproduce with version 0.24.1?
Thank you @luisfpg (I removed the post because I saw that I was using Swagger V2 version too)
I use this module to covert my Swagger V2 json api file to OpenAPI V3 yml file. And that works.
When I try to regenerate my api i get this error Error on API generation: TypeError: Cannot read properties of undefined (reading 'logger')
everything worked fine on ng-open-gen V23. Is this issue related to me being on Angular 14.2.10 instead of Angular 15?
~Also is it possible to skip the self-signed certficate check. Didn't find anything in the
--help
~