swagger-api / swagger-api/swagger-codegen

[Typescript-Angular] canConsumeForm function can be simplified

Open
#12,439 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

typescript-angular's canConsumeForm can be simplified

Swagger-codegen version

3.X

Suggest a fix/enhancement

https://github.com/swagger-api/swagger-codegen/blob/2c5329a3af70c6ea5b42bab9b01d348b5674f605/modules/swagger-codegen/src/main/resources/typescript-angular/api.service.mustache#L77-L85

canConsumeForm is equivalent to just return consumes.includes('multipart/form-data');

/**
 * @param consumes string[] mime-types
 * @return true: consumes contains 'multipart/form-data', false: otherwise
 */
private canConsumeForm(consumes: string[]): boolean {
  return consumes.includes('multipart/form-data');
}

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 in modules/swagger-codegen/src/main/resources/typescript-angular/api.service.mustache at lines 77-85, as linked in the issue. Inspect the canConsumeForm helper and confirm the generated TypeScript-Angular service still checks for multipart/form-data after the simplification.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
tooling
Issue type
Refactor
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.