4 ms·
Show HN: Auto-Generate R SDK for REST APIs Using OpenAPI Generator
To generate R SDK or API client for REST API, one can easily do so with the help of OpenAPI Generator (https://github.com/OpenAPITools/openapi-generator https://github.com/OpenAPITools/openapi-generator). Here are 3 steps to generate the SDK/client:
1. Download the Java JAR (https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/4.0.0-SNAPSHOT/openapi-generator-cli-4.0.0-20190325.135215-449.jar https://oss.sonatype.org/content/repositories/snapshots/org/...)
2. Rename the JAR as "openapi-generator.jar"
3. Run the following command to generate R SDK for Petstore API (https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml https://raw.githubusercontent.com/OpenAPITools/openapi-gener...):
Mac/Linux:
- java -jar openapi-generator.jar generate -g r -i https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml https://raw.githubusercontent.com/OpenAPITools/openapi-gener... -o /tmp/petstore/
Windows:
- java -jar openapi-generator.jar generate -g r -i https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml https://raw.githubusercontent.com/OpenAPITools/openapi-gener... -o C:\tmp\petstore
The auto-generated documentation (README.md, how to install, etc) can be found in the "docs" folder.
Please give it a try and let me know if you've any feedback/question.
- deleted 8y ago[deleted]