swagger-api / swagger-api/swagger-codegen

[JavaScript][ES6]Special characters in model break integration test

Open
#5,978 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Client: JavaScript/Node.js Issue: Bug
Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

The Petstore integration tests for JS ES6 failed

SyntaxError: swagger-codegen/samples/client/petstore/javascript-promise-es6/src/model/EnumClass.js: Unexpected token (36:8)                                                                                                                          
  34 |          * @const                                                                                                                 
  35 |          */                                                                                                                       
  36 |         -efg = "-efg";                                                                                                            
     |         ^                                                                                                                         
  37 |                                                                                                                                   
  38 |                                                                                                                                   
  39 |         /**                    
SyntaxError: swagger-codegen/samples/client/petstore/javascript-promise-es6/src/model/EnumClass.js: Unexpected token (43:8)                                                                                                                          
  41 |          * @const                                                                                                                 
  42 |          */                                                                                                                       
> 43 |         (xyz) = "(xyz)";                                                                                                          
     |         ^                                                                                                                         
  44 |                                                                                                                                   
  45 |       
SyntaxError: swagger-codegen/samples/client/petstore/javascript-promise-es6/src/model/List.js: Unexpected token (69:7)                                                                                                                               
  67 |     * @member {String} 123-list                                                                                                   
  68 |     */                                                                                                                            
> 69 |     123-list = undefined;                                                                                                         
     |        ^                                                                                                                          
  70 |                                                                                                                                   
  71 |                                                                                                                                   
  72 |                                                                                                                                   
SyntaxError: swagger-codegen/samples/client/petstore/javascript-promise-es6/src/model/Name.js: Identifier directly after number (92:7)                                                                                                               
  90 |     * @member {Number} 123Number                                                                                                  
  91 |     */                                                                                                                            
> 92 |     123Number = undefined;                                                                                                        
     |        ^                                                                                                                          
  93 |                                                                                                                                   
  94 |                                                                                                                                   
  95 |                                                                                                                                   
SyntaxError: swagger-codegen/samples/client/petstore/javascript-promise-es6/src/model/SpecialModelName.js: Unexpected token (69:12)                                                                                                                  
  67 |     * @member {Number} $special[property.name]                                                                                    
  68 |     */                                                                                                                            
> 69 |     $special[property.name] = undefined;                                                                                          
     |             ^                                                                                                                     
  70 |                                                                                                                                   

Swagger-codegen version

Latest master.

Steps to reproduce

To repeat the issue for javascript-promise-es6

cd samples/client/petstore/javascript-promise-es6
npm install
npm test

To repeat the issue for javascript-es6

cd samples/client/petstore/javascript-es6
npm install
npm test

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

Run npm install and npm test in samples/client/petstore/javascript-promise-es6 and samples/client/petstore/javascript-es6, then inspect the generated model files EnumClass.js, List.js, Name.js, and SpecialModelName.js. Trace these outputs to the JavaScript ES6 generator template and consider the issue complete when both integration test suites parse and pass for the reported names.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
testing, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.