swagger-api/swagger-codegen

[Javascript] useES6 is the default even though it shouldn't be

Closed this issue · 10 comments

Description

the ES5 templates should be used by default when generating a javascript client but it seems that the ES6 templates are actually being used by default.

Swagger-codegen version

3.0.19 ... not sure if this has worked in previous versions.

Swagger declaration file content or url

Used the petstore example to verify this issue

Command line used for generation

swagger-codegen generate -i https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore.yaml -o testJavascript/ -l javascript

Steps to reproduce

swagger-codegen generate -i https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore.yaml -o testJavascript/ -l javascript

Related issues/PRs

Is there a way to generate a ES5 client? I run below which doesn't seem to work though

# swagger-codegen: stable 3.0.20, installed via homebrew(`brew install swagger-codegen`)
# macOS: 10.15.5
# JDK: adoptopenjdk8, installed via homebrew(`brew cask install homebrew/cask-versions/adoptopenjdk8`)
swagger-codegen generate -i http://MY_SERVER/v2/swagger/governator-jaxrs.json -l javascript --additional-properties useES6=false

I'm facing this issue also..
I created configuration file and added useES6 option like below

{
    "useES6": false
}

But this options seems like not work;

anyone ever resolved this?

I'm getting this same issue, I can't work out how to force it to use ES5

I see... well, let's get this fixed :)

I reviewed this issue and it was already fixed, so glong to close it. If you don't want to use ES6 templates. You just need to add the option:

--additional-properties useES6=false

in your CLI for code generation

That's weird, when I try swagger-codegen generate -i $api_url -l javascript -o out --additional-properties useES6=false it still generates code with class keyword classes

I'm using 3.0.52, I installed via brew

@waterwheels
I noted the problem is actually the templates, no the option. Anyway this could be addressed in a different ticket.