-
Notifications
You must be signed in to change notification settings - Fork 6
Original Proposal
Idea 5: API Conversion API Postman - GSoC 2021
Hey! I am Sarthak Saxena, a 3rd year undergrad studying CSE at SRM Institute of Science and Technology, KTR, Chennai.
I’ve interned at a couple of startups as a React and then as a Backend Developer and have grown as a problem solver in new environments. I’m able to get an intuition for a codebase pretty fast. I possess an understanding of the phases via which code goes into production i.e. Design, Development, Testing and Deployment. I have worked end-to-end on all of these while interning at RedCarpetUp.com while working on extending the APIs and the transaction to emi feature for the ledger API. I have also worked as a Researcher during my 1st and 2nd year at Next Tech Lab which is an Undergraduate Research Lab at SRM IST KTR.
I’ve used Postman throughout my journey of development and would love to contribute back.
I came across Postman while looking for organizations and I’ve found Idea 5 to be fitting and feasible for me to work on.
The proposed project involves integrating a number of API format and schema converters into a single converter that will be used to convert to and from a number of supported formats. Endpoints for the converter would be developed using Node.js. Following the integration, I will be working on the frontend using React.js and exposing the endpoints to end-users.
There is currently no open source API format and schema converter that provides conversion to and from multiple formats. This project would provide a one-stop solution to this and would prove to be a good platform for open source enthusiasts to contribute.
I’ve tried implementing the base architecture of the converter using Node.js and React.js. Please have a look.
Live Prototype (Only supports OAS3 / OAS2 in YAML / JSON --> Postman for now) Please wait 10 - 20 seconds for the site to load.
- OpenAPI 2.0 to OpenAPI 3.0
- OpenAPI 3.0 to Postman 2.0
- OpenAPI 2.0 to Postman 2.0
- RAML 1.0 to Postman 2.0
- Postman 2.0 / 2.1 to OpenAPI 3.0
- OpenAPI 3.0 / 2.0 to GraphQL
- OpenAPI 3.0 to RAML 1.0
- Google Discovery to OpenAPI 3.0
- OpenAPI 3.0 to HAR
- WSDL to OpenAPI 3.0
- HAR to OpenAPI 3.0
- OData to OpenAPI 3.0
- JSON Schema to OpenAPI Schema
- OpenAPI Schema to JSON Schema
Using this an adjacency list can be made, and while trying to find the smallest path for conversion to the required format, we can use the modified BFS algorithm for the shortest path. There might be intermediate conversions required, for example Postman to RAML would follow the path Postman -> OAS3 -> RAML as direct conversion is not possible.
I’ve implemented the algorithm and got the following result : Output, observations are listed below:
There are only 3 paths with a path length of 3.
Most of the conversions with path length 2 take place by first converting to OAS3 and then to the required format.
Looking at the converters, Node.js would be the platform I will be using for the backend. React.js would be a good pick for the frontend due to it’s lego-like structure and the availability of a wide variety of components along with community support. Adding to that, I have experience of building using both of them.
The aim would be to have a dynamic flow of conversions. Converters would be clubbed together wherever possible i.e. in case of minimal inconsistency among the input parameters and the endpoint design. For example, in the prototype, I have created a single endpoint that calls the appropriate converter based on the user’s input. This was possible as the converters’ (OpenAPI 3.0 to Postman 2.0, OpenAPI 2.0 to Postman 2.0) endpoints are structurally similar.
The project would involve identifying such similarities and inconsistencies between converters and optimizing the code based on that.
Significantly structurally different converters will have separate endpoints for conversion.
API-First + Incremental Test-Driven Development approach will be followed while working on this project. I will be creating requests and mocking them with a number of examples. Then I will go ahead with the development and will be regularly writing tests to ensure good quality of code.
-
Requirement Analysis : Discussion with my mentors to properly understand the project requirements and the expected end results.
-
Research : I will start by gathering information about several existing converters and how they function. I will also be documenting every part of this step.
-
OpenAPI Document : After having a good idea about the existing converters I will start designing the OpenAPI document for the API that would integrate all these converters together.
-
From what I’ve understood, there will be a parent API that we will design, which will be hitting the converters’ endpoints as per the user’s input.
-
Development : The development of the API will have to be done once we have the OpenAPI document. Link to a simple prototype for the API.
-
Testing : I will be writing unit tests for all the possible conversions. The tests will make sure that the conversion is successful via the parent API for all the possible conversion mappings. Deployment : We will decide whether to deploy the API or to complete working on the website first.
-
UI Component Library Selection : I will have to choose a UI library for React after having a discussion with my mentors.
-
Landing Page : I will start by working on the landing page i.e. the page where the user will be uploading and converting files.
-
Development of Components : Reusable, scalable and extensible components will be developed and integrated with the API to enable the conversion functionality.
-
Development of Custom React Hooks : Functionalities would require custom react hooks to be developed to improve the reusability score of the project.
-
End-to-End Check for Functionality : After the integration has been done, the functionality of the website will be tested and critical bugs will be fixed.
After the above listed converters have been integrated, I will be working on additional features and will try to cover them up within the GSoC period, in case of inability to complete these features I’ll be working after the GSoC period as well.
-
Login Functionality (Using Firebase and Redux State Management)
-
History of conversions (Using Firestore / MongoDB)
-
Cloud storage for previously converted documents (Using Firestore / MongoDB)
-
Ability of conversion to and from formats based on all the mappings possible.
-
Login functionality in order to keep a record of conversions for each user.
-
A section that provides a visual representation of all the conversions possible.
Understanding a number of converters and handling the inconsistency of endpoints’ designs might be a difficult task. I would be positively able to integrate multiple converters after getting a proper understanding of each one of them.
Most of the converters are written in JS / TS / Node.js (The list above contains all JS, TS and Node based converters), all of these can be integrated using Node.js. But 2 converters are written in Python and Go. A possible way to integrate them is to host an API using a Go / Python backend framework on a port that is different from our converter port, that would enable us to create endpoints for conversion, and then to use them in our converter.
-
May 17 - June 6 : Community Bonding I will get to know more about the organization and it’s projects. I will get familiar with all the contributors and the codebase.
-
June 7 - June 16 : Analyzing Existing Converters I will be having a look at the converters and how they function. Understanding their functionality and endpoint design to facilitate easy integration.
-
June 17 - June 21 : Preparing OpenAPI Document for the New API. After understanding the requirements, I will be working on a specification document for the new API.
-
June 22 - July 7 : Development of the API and writing tests. The converters will be integrated into a single API. I will be writing tests for all the possible conversion mappings.
-
July 8 - July 16 : Designing the Frontend I will have to decide which library to use along with React, and then design the website. I have used antd in the prototype.
-
July 17 - July 26 : Development of the Frontend Development of the website and integration with the API.
-
July 27 - August 16 : Development of Additional Features Integration with Firebase and Firestore for login and conversion history functionalities.