devexperts / swagger-codegen-ts

Typesafe Swagger API generator for TypeScript
Mozilla Public License 2.0
80 stars 16 forks source link

Controllers are generated with unused variable #102

Open morozovamv opened 4 years ago

morozovamv commented 4 years ago

After starting generate I receive an error in generated controllers. The error is image

generate function is same as test1 in tests

Libs:

"fp-ts": "^2.4.4",
"io-ts": "^2.0.1",
"io-ts-reporters": "^1.0.0",
"io-ts-types": "^0.5.2",
"@devexperts/swagger-codegen-ts": "^2.0.0-alpha.17",
"@devexperts/utils": "^1.0.0-alpha.11",

System: win10

Also, I checked tests here and got the same result.

STR:

image

raveclassic commented 4 years ago

Could you provide the spec?

morozovamv commented 4 years ago

the spec that I used for tests

our project spec: swagger.zip

sutarmin commented 4 years ago

This is very annoying. @raveclassic do you happen to know how difficult to fix this?

raveclassic commented 4 years ago

Quickfix - just disable linting on the generated code.

timofeevda commented 4 years ago

We have the same issue. Vote for the fix! :)

raveclassic commented 4 years ago

Generally, generated code is not expected to be linted, neither adhere any codestyle. The only option available at the moment is a prettier config for formatting the code. Personally I do agree unused imports should be removed, but at the same time I don't get why this is a problem for the end project which should (and it really should) just disable linting of the generated code. We'd gladly review any PRs facing this issue, but at the moment we consider this as a low priority improvement.

timofeevda commented 4 years ago

Sounds reasonable :)