swagger-api / swagger-api/swagger-codegen

[JavaScript][ES6] Incorrect content in the generated README.md

Open
#7,926 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description
  1. When generating the SDK with configuration file js-config.json with useES6 set to true:

    {
        "useES6" : true
    }
    

    The README.md in the generated package contains code examples that is still in ES5. i.e.

    var coolAPI = require('cool_api');
    
    var api = new coolApi.ModuleFooApi()
    ...
    

    which should be:

    import coolAPI from 'cool_api';
    
    let apiInstance = new coolApi.ModuleFooApi();
    ...
    
  2. Also the Local development section that used to be in the ES5 SDK is also missing from the ES6 SDK. Perhaps the npm link instructions would still be useful?

Swagger-codegen version
Q A
Which Java version? Java(TM) SE Runtime Environment (build 1.8.0_162-b12)
Which swagger-codegen used? swagger-codegen-cli-2.3.1.jar
Command line used for generation
java -jar swagger-codegen-cli-2.3.1.jar generate -i api-spec.json -l javascript -o ./js-sdk -c js-config.json
Other Observations

This issue seems only have impacted the README.md that exist at the root folder of the generated package. All other *.md files under /docs folder were generated with the correct example in ES6 syntax.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the JavaScript SDK with the shown swagger-codegen command and js-config.json using useES6=true. Compare the generated root README.md with the correctly formatted markdown under /docs; done means the README uses ES6 examples and restores the Local development/npm link guidance.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.