swagger-api / swagger-api/swagger-codegen

[typescript-angular] unable to change model file name.

Open
#11,001 0 comments 0 reactions 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

I am using gradle with typescript-angular with custom template to generate the code. My generated code creating file like user.service.ts. I would like to my file name to be created as UserApi.ts

Please suggest how I can modify.

Below is my gradle.build code

// Apply the java plugin to add support for Java
apply plugin: 'java'

// In this section you declare where to find the dependencies of your project
repositories {
jcenter()
}

configurations {
codegen
}

// In this section you declare the dependencies for your production and test code
dependencies {
codegen 'io.swagger.codegen.v3:swagger-codegen-cli:3.0.25'
}

task generateGapAnalysisApiTypescript(
type: JavaExec
) {
main = 'io.swagger.codegen.v3.cli.SwaggerCodegen'
classpath = configurations.codegen
args = [
"generate",
"--additional-properties", "apiClientName=GapAnalysisApiClient",
"-i", "./swagger-specs/gapanalysis-openapi-specs.json",
"-l", "typescript-angular",
"-t", "./swagger-codegen/template",
"-o", "../proxy/src/lib/gapanalysis-api/"
]
delete '../proxy/src/lib/gapanalysis-api/api.module.ts'
}

Swagger-codegen version

3.0.25

Swagger declaration file content or url
Command line used for generation
Steps to reproduce
Related issues/PRs
Suggest a fix/enhancement

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

Start by reviewing the custom template passed with the Gradle generateGapAnalysisApiTypescript task and compare how it produces user.service.ts. Check the TypeScript-Angular generation path in swagger-codegen 3.0.25 to determine where the filename is selected. Done means the generated model or service file can be named UserApi.ts as requested.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.