adopted by OpenStack for network control, has these
changes between its versions v1.0 and v2.0. Both
versions allow a client to navigate to a port resource
by the path: initial→networks→ports
→port. In addition, version v2.0 adds an
equivalent but shorter path: initial→ports
→port. In both cases, a v1.0 client looking for a
port resource can still find it, although it may take a
different path in version v2.0. However, version v2.0
also introduces changes that break the clients, such
as renaming the attachment resource in v1.0 to
device resource. A v1.0 client looking for an
attachment resource will not find it in v2.0, unless it
is told that attachment is equivalent to device.
To find incompatibilities within REST APIs is
difficult for two reasons. First, many REST APIs are
not described by a machine-readable language which
is needed to lend themselves to an automated
analysis. Second, the available service description
languages do not come with automated methods for
compatibility analysis.
To address the compatibility problems in such
rapid development cycles as in the large scale open
source development, this paper adopts REST Chart
as the service description language and modelling
framework for REST API – it transforms the
problem of compatibility between REST APIs to
compatibility between two REST Charts. Since
REST Chart is based on Petri-Net, the compatibility
of two REST Charts can be formally defined and
resolved based on a Petri-Net behaviour model,
making it feasible for a systematic and automated
compatibility checking of REST APIs.
The rest of this paper is organized as follows.
Section 2 surveys the related work. Section 3
introduces the framework of REST Chart modelling
for REST APIs. Section 4 presents the proposed
REST client operational model which provides a
theoretical basis for the REST Chart based
compatibility testing and verification. Section 5
derives the compatibility conditions and the REST
Chart comparison algorithm based on the proposed
operational model. Section 6 discusses the
implementation and experimental results, and we
conclude the findings of this paper in Section 7.
2 RELATED WORK
Several REST service description languages have
been developed since 2009. WADL (Hadley 2009)
is an early effort to describe REST services,
followed by RAML (RAML Version 0.8), Swagger
(Swagger 2.0), RSDL (Robie 2013), API-Blueprint
(API Blueprint Format 1A revision 7), SA-REST
(Gomadam 2010), ReLL (Alarcon 2010), REST
Chart (Li 2011), RADL (Robie 2010), and RDF-
REST (Champin 2013). All these description
languages are encoded in some machine-readable
languages, such as XML, and most of them are
standalone documents, but a few of them, such as
SA-REST, are intended to be embedded within a
host language, such as HTML. We are not aware of
any methods to compare different versions of a
REST API based on these description languages.
There are several open source Java packages and
Web tools (SOA Membrane WSDL tool 2014,
WSDL Auditor 2014, WSDL Comparator 2014) that
compare two WSDL files for WS-* based web
services – they include XML Schema (Thompson
2004) files to identify changes (addition, deletion,
modification, and reorder) to the WSDL elements,
such as port types and operations, and the XML
elements and attributes. Some tools distinguish
changes that will break interface compatibility from
those that will not. For example, adding an optional
XML element to a XML Schema of an input element
of an operation will not invalidate the interface, but
adding a required XML element, or changing the
type, name, or position of an existing required XML
element will.
However, these methods of WSDL comparison
for WS-* based web services cannot be applied to
compare REST Charts for REST APIs, because a
REST Chart is not structured as WSDL. Despite that
REST Chart is represented as a XML dialect, we
cannot use generic XML diff tools to compare REST
Charts, because REST Chart has special semantics
not understood by those tools.
There are a few open source tools (SOA
Membrane XSD tool 2014) that compare two XML
Schema definitions and identify their differences as
changes (addition, deletion, modification, and
reorder). These tools can assist the comparison of
REST Chart, as well as other service description
languages that use XML Schema to define the input
and output messages of a service. However, they fall
short to provide a generic framework for comparing
the compatibility of REST service APIs, which is
critically needed but serious lacking for large scale
distributed software systems.
3 REST CHART MODEL
REST Chart (RC) is proposed in 2011 (Li 2011) to
design and describe REST APIs without violating
the REST principles (Fielding 2000), especially the
CompatibilityModelingandTestingofRESTAPIbasedonRESTChart
195