swagger-api / swagger-api/swagger-codegen
[Typescript][AngularJS] Enum creates invalid method header
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
I've created a POST method with the following parameter and generated the typescript-angularjs client via editor.swagger.io
parameters:
- in: query
name: foo
enum:
- 'test'
- 'hallo'
description: image
required: true
type: string
The resulting method header in typescript is invalid:
public test (foo: models.'test' | 'hallo', extraHttpRequestParams?: any ) : ng.IHttpPromise<string> {
...
}
Swagger-codegen version
editor.swagger.io
Swagger declaration file content or url
parameters:
- in: query
name: foo
enum:
- 'test'
- 'hallo'
description: image
required: true
type: string
Command line used for generation
editor.swagger.io
Steps to reproduce
- create a method with an enum parameter
- generate typescript-angularjs client
Related issues/PRs
Suggest a fix/enhancement
The generated method header should look like this:
public test (foo: 'test' | 'hallo', extraHttpRequestParams?: any ) : ng.IHttpPromise<string> {
...
}
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 TypeScript AngularJS generator templates and the rendering path for enum query parameters. Reproduce the example from the issue, then trace how enum values become the generated method header and model type. Done means the generated header uses valid TypeScript string-literal unions as shown and the client remains valid.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- angularjs, typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100