Special thanks to @umeshp7 & @postmanlabs
My name is Somesh Koli and I'll be working with @postmanlabs to build an SDK generator for postman collections. I've been using postman app since a very long time and when I got to know that Postman will be participating in GSoC'20, I was excited to get started with it and aimed to build a good proposal which would result in benefiting postman community all around the world and also be a part of this.
- Google Summer of Code 2020 with Postman Inc: Final Report
Postman Code Generators is one of the most renowned and developer-friendly features when it comes to API development. Elevating this idea, A client SDK can be generated from a Postman Collection exported from Postman App, which would serve as a ready to use API SDK for the user. The generated SDK would inherit all of its properties from the Postman Collection to provide seamless interaction between the Postman App, client SDK, and API endpoint.
-
Folder Structure: Postman collections have a flexible folder structure using which we can arrange requests in a nested or linear fashion. The generated SDK would have request structure as present in the collection.
-
Variables: Postman App can use variables at different levels. The client SDK would have a similar feature in which the user will be able to define variables for the entire SDK or single request as required.
-
Documentation: Documenting individual requests/folders/collection comes handy with Postman App. These docs are exported along with the collection, this can be used to provide documentation in the generated SDK.
-
Authorization: We can authorize requests for an API using Postman App. Similarly, the generated SDK will have the ability to authorize a request as configured in the collection.
-
Additional Options: The SDK generator will have additional options for different languages and variants which can be used to customize the generated SDK as per user's preferences.
Implementation of the base structure of the SDK generator and developing SDK generator for nodejs-request (language: Nodejs & Library: request) along with tests and build.
These are some of the future development goals:
- Implementation of SDK generator for other languages and variants
- Implementation of other authorization methods
- Integration with Postman App
The entire GSoC period was divided into 4 major phases as described below :
The main idea behind this period was to get along with the community and get more knowledge about the codebase. Most of my PR's are for Postman Code Generators
Title | Module/Repository | Pull Request |
---|---|---|
Quote type option | PCG/CURL | #251 |
Fixes issue with URL globbing | PCG/CURL | #258 |
Remove unwanted utf-8 encoding | PCG/Python-Requests | #260 |
Force add Content-Length header | PCG/HTTP | #265 |
Adds Content-Type header | PCG/Python-Requests | #267 |
Error check for response | PCG/GoNative | #276 |
Fixes error with semicolon in form-data | PCG/CURL | #277 |
Addition of Nodejs-Axios | PCG/Nodejs-Axios | #232 |
*PCG
With this phase, I got started to build the skeleton for the SDK generator module and nodejs-request sdkgen. Since the project was new and there was no proper pipeline for the project, most of the work done was in a single PR. The Main task was completed and got merged. #1
- Main SDK generator module
- Nodejs-Request sdkgen
- Folder structure
- Request calling
- Variable (was improvised later)
So we're in phase two. As things were not so perfect in the first implementation, bugs were on the doorstep. In this phase, the aim was to get all the bugs fixed and implement different authorization methods.
Work | PR |
---|---|
Wrapper for collection traversal | #3 |
Improvements to generated snippet | #4 |
Base authorization module with basic, bearer token, API key authorization | #6 |
Hawk authorization (revision done in P3) | #7 |
oauth2 authorization | #12 |
Phase three was full of ups and downs, full of bug fixes pending PRs and testing. As we were moving towards the end we wanted things to be release ready and were expecting people to use this module (and flood the repository with issues). I added some major features and improvements that were required for a beta release.
- Nodejs-Request
- SDK formatter (beautify)
- Hawk authorization
- Option for Response return method
- Revised variable implementation
- SDK generator options
- Option filtering
- SDK output options
- Collection Authorizer
- Tests and build
- Commandline interface
Work | PR |
---|---|
Bug fixes | #11 |
Nodejs-Request formatter | #9 |
Nodejs-Request Return option | #14 |
Variable impl revision | #15 |
Build and test suite | #18 #16 |
CLI options | #20 |
For the GSoC period, we decided to stick to a limited scope. In the future, I expect bugs, issues, and feature requests to be made to the project and expect the project to grow progressively with time (although I don't want bugs :) I sure expect some). I will keep building this project to meet the requirements of the users.
I cannot conclude this report without mentioning some very important people. This project wouldn't have been possible without my mentor @umeshp7 and the @postmanlabs team who guided me from time to time to improve this product and make it production-ready. I look forward to work with the team and gain some valuable experience from them.
So here I am, at the last stage of GSoC'20. It was such a wonderful experience to work with a community like Postman Inc. Though GSoC has been ended, it surely marks the start of my journey with open source communities.
Proposal link