Statically Checking Web API Requests in Atom
Originally published at:http://www.apiful.io/intro/2016/11/30/ide-specification-checking.html
We have spent a lot of effort on statically analyzing web API requests in JavaScript, allowing us to analyze API usage in GitHub, and learning about realities of API usage. At the same time, we obtained API specifications from sources like APIs.guru and through our own mining activities. It is time that we start to combine these efforts to support developers in consuming APIs.
Check your API request code within Atom
One way to support developers in consuming web APIs is to statically check the code they write and ensure that it matches API specifications. Doing so allows the detection of errors early on, that would otherwise emerge at runtime.
To demonstrate this capability, we wrote a plugin for the popular Atom editor that, if desired by the developer, sends request code written in JavaScript to API Harmony for checking. API Harmony determines the specification matching the request code and checks whether the request fulfills all the requirements defined in the specification: is the right protocol used? Is the route valid? Is the correct HTTP method used? Are all required query parameters present? Is data sent as payload complete and correct? Feedback is immediately presented to developers within Atom. The below video shows our prototype:
The video https://www.youtube.com/embed/8IJKs7rMjJI no longer exists.
Of course, we have many ideas on how to extend the plugin: It could be used to identify which APIs to use, or provide code snippets within the editor.
What do you think about in-editor support like this? What ideas do you have to extend this capability?
PS: The video also shows a new version of the API Harmony user interface, which we will deploy soon.