Skip to content

Split the generated ts into different files? #214

Open
@jayalakshmis

Description

@jayalakshmis

Hello,
I have the following code to generate ts files for my vue app. The following code generates a single file at the specified location, however I was wondering if there is an option/configuration that would let me split the generated ts files instead of a single file?

The sample2.json that i have is from here http://petstore.swagger.io/v2/swagger.json.

    var fs = require('fs');
    var CodeGen = require('swagger-js-codegen').CodeGen;
    
    var file = 'build/sample2.json';
    var swagger = JSON.parse(fs.readFileSync(file, 'UTF-8'));
    var tsSourceCode = CodeGen.getTypescriptCode({ className: 'Test', swagger: swagger, imports: ['../../typings/tsd.d.ts'] });
    fs.writeFileSync('src/api/api.ts', tsSourceCode)
})()

Packages Used
"swagger-js-codegen": "^1.12.0",

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions