Skip to content

Bug: encoding option in requestBody is not respected. #104

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

Closed
Thiry1 opened this issue Mar 28, 2023 · 4 comments · Fixed by #108
Closed

Bug: encoding option in requestBody is not respected. #104

Thiry1 opened this issue Mar 28, 2023 · 4 comments · Fixed by #108
Labels
Type: Good first issue Good for newcomers

Comments

@Thiry1
Copy link
Contributor

Thiry1 commented Mar 28, 2023

Steps To Reproduce

According to the OpenAPI 3.0 definition, requestBody has encoding option.
However, the encoding option is missing from the generated code.

The current behavior

encoding option is dissappear

The expected behavior

encoding option should be respected.
IMO, if Content-Type is application/x-www-form-urlencoded, encoding option is required for the type of requestBody.

@Thiry1 Thiry1 added the Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug label Mar 28, 2023
@Himenon
Copy link
Owner

Himenon commented Mar 28, 2023

Thanks for the info. It looks like I will need to change the ApiClient interface to implement this.

export interface ApiClient<RequestOption> {
    request: <T = SuccessResponses>(httpMethod: HttpMethod, url: string, headers: ObjectLike | any, requestBody: ObjectLike | any, queryParameters: QueryParameters | undefined, options?: RequestOption) => Promise<T>;
}

Should I make the argument an object if I expect to add more in the future?

I would like to hear your opinion.

@Himenon Himenon added Type: Good first issue Good for newcomers and removed Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug labels Mar 28, 2023
@Thiry1
Copy link
Contributor Author

Thiry1 commented Mar 29, 2023

Should I make the argument an object if I expect to add more in the future?

IMO, accepting object as an argument is a good choice.
However this causes breaking change.So I think we have to bump major version.(It would be better to have version 1.0.0 before making this change.)

@hrsh7th
Copy link
Contributor

hrsh7th commented Mar 31, 2023

I also agree this. I think it's a common best practice to keep public API arguments defines as dict.

@Himenon
Copy link
Owner

Himenon commented Apr 1, 2023

you can check in playground v0,25.0

https://openapi-typescript-code-generator.netlify.app/v0.25.0/index.html

Perhaps the Himenon/openapi-parameter-formatter would work well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants