OpenAPITools / OpenAPITools/openapi-generator
[REQ][Typescript-axios], ability to pass in parameters as an object
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Is your feature request related to a problem? Please describe.
It can be hard to read the code and can introduce bugs when using normal function parameters, for instance, if you have this:
api.getMembers(orgId, offset, limit, sortBy, sortOrder, options)
and the backend adds an argument websiteId, after orgId, depending on the types of the items it won't necessarily cause a type error.
Describe the solution you'd like
I would like the option to pass in the parameters as an object
Describe alternatives you've considered
For now, I am manually creating helper functions like this, but it's still a hassle to make sure to keep them up to date, it would be nicer to have the security of having objects here so that if anything at all is wrong, it will give a type error
getMembers: ({ orgId, offset, limit, sortBy, sortOrder, options }: GetOrgMembersReq) =>
api.getMembers(orgId, offset, limit, sortBy, sortOrder, options)
Additional context
No additional context, let me know if you have any questions
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 by reviewing the Typescript-axios generator and how it currently produces methods such as api.getMembers with positional parameters. Determine how object-based request parameters should be represented while preserving generated TypeScript types, then verify the generated client behavior against the requested getMembers example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100