swagger-api / swagger-api/swagger-codegen

[typescript-angular] useSingleRequestParameter is ignored

Open
#10,547 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 found the info about the config parameter useSingleRequestParameter in this docs: https://openapi-generator.tech/docs/generators/typescript-angular/

I expect, that I can call the service functions in the generated api with something like:

myService.get_whatever({ mandatory_1: 1, optional_2: 2 })

instead of

myService.get_whatever(1, undefined, 2 })

But the parameter is ignored. No code change no matter if I add it or not.

I compile the api with this code

docker run --rm \
	--network="host" \
	-v ${PWD}:/local swaggerapi/swagger-codegen-cli generate \
	-i http://my-project.test:8000/api/swagger.json \
	-l typescript-angular \
	-o /local/services/myservice/src/api \
	--additional-properties=useSingleRequestParameter=true
Swagger-codegen version

swaggerapi/swagger-codegen-cli:2.4.17

Command line used for generation
docker run --rm \
	--network="host" \
	-v ${PWD}:/local swaggerapi/swagger-codegen-cli generate \
	-i http://my-project.test:8000/api/swagger.json \
	-l typescript-angular \
	-o /local/services/myservice/src/api \
	--additional-properties=useSingleRequestParameter=true

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

Reproduce the issue with the documented typescript-angular generator and the provided Docker command using swaggerapi/swagger-codegen-cli:2.4.17. Inspect the generator and its templates to determine why useSingleRequestParameter does not affect generated service signatures; done means the generated methods accept one parameter object when the option is enabled and retain the existing form otherwise.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.