-
Notifications
You must be signed in to change notification settings - Fork 6k
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] Bash client script generator #4541
Conversation
@bkryza this PR is of very high quality 🍻 . Thanks for your contribution 👍 One suggestion I have is to check the Bash version at the start. Here is what I got when running with Bash 3.x:
It's showing the error message about incorrect Bash version at the end. What I would suggest is to perform a check at the start so as to avoid showing too many syntax error messages (as some users might simply skip all the error messages when the result is showing too many errors...) |
@bkryza thanks! It's not really an issue, just a minor enhancement to make it better 😄 |
* Initial commit * Remormatted petstore tests * Added Bash codegen to main README.md * Added bash to integration tests * Fixed stdin detection in generated script * Added back ruby module
PR checklist
./bin/
to update Petstore sample so that CIs can verify the change. (For instance, only need to run./bin/{LANG}-petstore.sh
and./bin/security/{LANG}-petstore.sh
if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates)2.3.0
branch for breaking (non-backward compatible) changes.Description of the PR
@wing328
This is a PR with a new template for generating standalone single-file Bash script clients whose only dependencies are Bash >4.3 and cURL.
The generated script contains a comprehensive help for listing all operations of the service as well as detailed help for each operation.
In addition, the codegen generates Bash and Zsh completion scripts which greatly simplifies usage of the script for larger API's.
Underneath, the script uses cURL to generate actual REST calls.
The main advantage of this generator is the possibility to create a command line tool which can be used to instantly test a web service without writing a single line of code, or to provide your web service users with a simple tool which they can download from a URL without the need to install any dependencies and development frameworks.
Main features
--dry-run
optionUsage
If you'd like to check the generator in practice you can to this in these few steps after cloning the PR:
More information is available in the README.md in codegen resources here.
Tests
I added basic unit tests for the Java part of the generator as well as integration tests for the petstore service.
For the integration tests I needed 2 dependencies to the main .travis.yml
Please let me know what you think about this codegen and how can I improve it to integrate it into master.