Modest Beginnings

Vaibhav Chellani
openapi-hydra-parser-gsoc2018
2 min readMay 8, 2018

Assigned with the task of making a parser that would convert Open Api Specification to Hydra specification i did what anyone else would , i started reading the available documentation .

After going through most of it i realised that i would need more time to make myself familiar , i cannot leave any object unmapped or wrongly mapped . Since the hydra spec was less extensive making a parser which converts HYDRA api documentation to Open Api doc seems like a good way to get started .

To get a hang of what the parser should do i made a simple todo list api first in HYDRA spec and then in Open API spec (OAS) , you can find it here . It helped me in understanding how to represent the Api structure in both the specifications , how to efficiently convert from one spec to another .

Both the specs differ greatly in how they define the Api structure was the conclusion i came to , i will have to parse the whole HYDRA spec several times (with multiple nested loops ), would need to slice strings , would need to assume values of variables to get to a point where both the specs refer to the same Api structure (hope so). So for start , just to see how it turns out i am going to make a parser that just does the job . After that i plan to optimise the whole thing by replacing multiple if`s with dict (used as switch case) , reduce number of loops and several other enhancements .

After writing a basic Hydra to Open Api parser i got a good idea about the objects of both the specs and decided it was time to leave the first part and address the monster in the room , we decided to take on the task of making a basic Open Api to Hydra Parser .

Due to the vast variation and description of objects in Open Api for the basic implementation we decided to skip some parts and just focus on creating a good enough Hydra Api Doc to start a server that resembles the original Open Api Spec .

Move over to the next post in the series to know how i designed the Open Api to Hydra Parser .

--

--