author: Willem Siers
title: Synthesizing transformations between APIs
company: ING
keywords: Program Transformation, APIs, JSON
topics: Software Technology
committee: Robbert van Dalen (ING) ,
Arend Rensink ,
Sebastiaan Joosten
started: June 2018
end: August 2019


This thesis presents our research on generating type specifications for JSON-based APIs in an automated manner. Such specifications describe the type of a JSON document in such a way that they are usable for formal applications such as static type checking. Additionally, we aimed to let the specifications convey the semantics of the API to a programmer. We noticed that despite the availability of API specification languages, many APIs do not have specifications. This may be because it is costly to create them. With our automated method to create such specifications we hope to alleviate the hurdle to create them, and thereby increasing adoption. The basis of our solution is type inference on JSON data that resides in responses to an API request. We present a minimisation algorithm to decrease the size of inferred types, and transform a purely formal specification into one that can be interpreted better by a programmer as well. It identifies recurring parts of a type and makes this explicit in the specification. It also has a heuristic-based method for identifying semantically equivalent types, which can be fused together, which is then also made explicit. Furthermore, an automated clustering algorithm is presented, which attempts to group JSON data by API operation. We conclude that our automated method can be of use for formal purposes, because generated specifications reliably detect typing errors in a program (which we call the completeness property), even though it should be taken as a serious consideration that absence of errors can not be proved (which we call the lack of the soundness property). The extent to which the generated specifications convey semantics of APIs varies, but the techniques we present in this thesis increase usefulness of specifications for programmers.


  1. Thesis (Digital version available here)