fix: correctly handle form and file parameters as requestBody instead of query parameters#61
Merged
parvez3019 merged 2 commits intoparvez3019:mainfrom Jun 3, 2025
Conversation
Owner
|
Hi, thanks for your valuable contribution. Can you add unit tests and integration tests for the same? so that we can merge this? |
Author
|
Hi, I have added the unit tests and integration tests as requested. Please review them and let me know if any further changes are needed. Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue:
When generating OpenAPI specs, parameters with in value form or file were incorrectly treated as query parameters, causing unexpected parameter objects to appear in the output.
Cause:
The original code used an if condition which didn't clearly separate handling of parameters by their location, leading to form and file parameters being processed as query parameters.
Solution:
Refactor the code to use a switch statement on the parameter’s in value to explicitly handle:
form and file parameters by calling appendRequestBody (adding them to requestBody content as form data),
body parameters by calling parseRequestBody,
Other parameters (query, path, etc.) by calling appendQueryParam.