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

[Bash] Support post form data #10795

Merged
merged 7 commits into from
Nov 9, 2021
Merged

Conversation

kevchentw
Copy link
Contributor

Before the fix, the bash client cannot handle post form data.
After the fix, it can send post data.

Fix #4251

example generated curl command

./client.sh --host http://localhost:3000 --dry-run loginForm  key:=123                                
curl -d 'key=123'     -X POST "http://localhost:3000/loginForm"

example yaml
https://gist.github.com/kevchentw/9ab2df64c8ce8247a1edc607eed2843f

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • Run the following to build the project and update samples:
    ./mvnw clean package 
    ./bin/generate-samples.sh
    ./bin/utils/export_docs_generators.sh
    
    Commit all changed files.
    This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
    These must match the expectations made by your contribution.
    You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*.
    For Windows users, please run the script in Git BASH.
  • File the PR against the correct branch: master (5.3.0), 6.0.x
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

@frol (2017/07) @bkryza (2017/08) @kenjones-cisco (2017/09)

@@ -38,6 +38,9 @@ $ echo '<body_content>' | {{scriptName}} --host <hostname> --content-type json <
# }
$ echo '<body_content>' | {{scriptName}} --host <hostname> --content-type json <operationId> key1==value1 key2=value2 key3:=23 -

# Make POST request with form data
$ {{scriptName}} --host <hostname> <operationId> key1:=value1 key2:=value2 key3:=23

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI. We can accept this enhancement to start with but 2 things:

  • some APIs do not have POST methods
  • users may have no clue what operationId is (I saw other part of the PR is already using it but I hope you see my point)

I think a better way is to support auto-generate documentation in the Bash client. Please let me know if you've time for the contribution and I can share some good starting points with you.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. I can work on the following enhancement.

@wing328 wing328 added this to the 5.3.1 milestone Nov 9, 2021
@wing328 wing328 merged commit 7d092e7 into OpenAPITools:master Nov 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pass parameters to a post operation
2 participants