Compability with ES6
LaercioNazareno opened this issue ยท 13 comments
Hi!
I'm using your library with the node version 16.14 that uses ES6, when I execute command npm run swagger-autogen the file swagger_output.json don't generate. Do your library has compatibility for ES6?
Hey!
I had to implement a whole workaround using a .cjs
file and so on, in order to use this lib.
But I really don't like doing this.
I guess it needs a contribution for this feature.
If I have some free time I'm gonna check this out.
Hi @marcelino-borges! I'll add this extension in the next version. Thnks!
Hi @LaercioNazareno! Sorry for the delay. What OS are you using?
Hi @marcelino-borges! I'll add this extension in the next version. Thnks!
Hey, great news!! Do you have any prevision on this next version?
Thanks!!
Hi @marcelino-borges! I have just submitted the new version (2.21.9). If the problem persists, let me know.
Wow! You are The Flash, aren't you? haha
I noticed there's still the issue with the missing @types, but a simple workaround with a declare module "swagger-autogen"
sorts that.
Besides that, right now I'm getting this error:
Error! File not found: '/src/routes/index.ts'
Swagger-autogen: Failed
But as you can see all my routes are into this path. Do you see anything wrong that I'm not seeing here? lol
Ps.: I'm running another config file from the command line, which calls this function of the screenshot.
I've also tried a relative path, but didn't succeed.
Hi @marcelino-borges. There was a bug in the latest versions about this. The version 2.21.10 has fixed it. Try with this version and let me know if the problem persists, please.
Hi @marcelino-borges. There was a bug in the latest versions about this. The version 2.21.10 has fixed it. Try with this version and let me know if the problem persists, please.
Now I'm getting this error again, even having my file declaring the module:
About this I'll need to analise here. Could you send me a sample project that reproduces this error? That way is easier to understand and handle it.
There it goes: https://github.com/marcelino-borges/swagger-autogen-test
I put only the necessary files in this demo.
Thanks!
@marcelino-borges, I've implemented two files in the node_modules/swagger-autogen, and here it works with your project. But as I use MacOS, could you try in your OS, please? The two files are:
in the root of node_modules/swagger-autogen
swagger-autogen.d.ts:
declare function swaggerAutogen (args?: any, endpointsFiles?: any, data?: any): (outputFile: any, endpointsFiles: any, data?: any) => Promise<false | {
success: boolean;
data: any;
}>;
export = swaggerAutogen;
tsconfig.json:
{
"include": [
"src/**/*"
],
"compilerOptions": {
"module": "es2015",
"allowJs": true,
"declaration": true,
"strict": true,
"emitDeclarationOnly": true,
"outDir": "dist",
"declarationMap": true
}
}
let me know if it works or not, please.
And if it works, I'll submit it in the next version.
The version 2.22.0 has implemented this. Any problem, let me know.