swagger-api / swagger-api/swagger-codegen
Pascal case class name for request class
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
I'm creating a custom Typescript template for Angular 7 app. I used existing template as starter. In the api.service.mustache I added:
{{#operations}}
{{#operation}}
export class {{nickname}}Request {
{{#allParams}}{{^isConstEnumParam}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}; {{/isConstEnumParam}}
{{/allParams}}
}
{{/operation}}
{{/operations}}
which results to
export class someClassNameRequest {
/////
}
I can not come up with the solution to make it pascal case like SomeClassNameRequest. Now I use {{nickname}} as a prefix but opened to use any other variable with a descriptive name. I tried to figure out how to see the whole object that is sent to the mustache template without any success.
Any suggestions are welcome.
Swagger-codegen version
2.3.1
Swagger declaration file content or url
looks like not related
Command line used for generation
rm -rf ./src/app/core/web-api; mkdir ./src/app/core/web-api; npx swagger-codegen generate -i ./swagger/swagger.yaml -l typescript-angular -o ./src/app/core/web-api -t ./swagger-codegen-typescript-angular
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the custom api.service.mustache template and the typescript-angular template resources, then run the provided swagger-codegen command against the example declaration. Check how nickname and other operation fields are exposed to templates and verify that the generated request class uses the desired PascalCase name.
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
- Needs clarification
- Newbie friendliness
- 25/100