Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request, Angular / Typescript] Type instead of multiple properties for QueryParams #613

Closed
angelaki opened this issue Feb 2, 2022 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@angelaki
Copy link

angelaki commented Feb 2, 2022

In my opinion it would be nice the pass an object instread of multiple values to the generated api service. If the arguments' orders change this can simply cause problems without noticing it.

E.g. instead of

public GetValues(a?: string, b?: string, c?: string, d?: string, e?: string, f?: boolean, g?: boolean, h?: boolean, i?: number, j?: number, k?: number, l?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json', context?: HttpContext})

I'd rather use

public GetValues(query: { a?: string, b?: string, c?: string, d?: string, e?: string, f?: boolean, g?: boolean, h?: boolean, i?: number, j?: number, k?: number, l?: number }, observe: any = 'body', reportProgress: boolean = false, options?: { httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json', context?: HttpContext})

@angelaki angelaki added the bug Something isn't working label Feb 2, 2022
@dbrils
Copy link

dbrils commented Feb 23, 2022

Check out the useSingleRequestParameter config option: https://openapi-generator.tech/docs/generators/typescript-angular/

@angelaki
Copy link
Author

Thank you so much! Exactly what I was looking for!

@angelaki angelaki reopened this Feb 25, 2022
@angelaki
Copy link
Author

Almost exactly what I was looking for ;) Would be nice if:

  • Single parameters wouldn't be wrapped in RequestParams
  • If all properties are optional, the RequestParams would be optional, too

Where to spread these ideas? ;)

@angelaki
Copy link
Author

Do you want me to open a new issue for this idea?

Single parameters wouldn't be wrapped in RequestParams is a bit confusing, guess it's discussable / unneccessary. But I think If all properties are optional, the RequestParams would be optional, too is quite handy!

@kay-schecker
Copy link
Contributor

No, please see #31

@angelaki
Copy link
Author

Oh, ok! Ty so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants