then transformed, using Enterprise Architect’s
6
pro-
prietary Code Template Framework, into a Spring
Roo application skeleton. In (Schreibmann, 2014) the
authors propose a model-driven approach for the de-
velopment of RESTful APIs. Their proposal is based
on a meta-model that serves as the basis for a DSL
used to model the API. By using Xtext
7
the DSL
can be converted into Java/JAX-RS. The IBM product
Rational Software Architect includes a (non-formally
described) REST profile that is described in the doc-
umentation library
8
. Stereotyped class diagrams can
be transformed to JAX-RS-based Java code using pro-
prietary tools.
As stated in the introduction another aspect re-
lated to REST API is the surge of DSLs to doc-
ument/model them. A comparison between these
proposals is outside the scope of this paper, in our
work we focus on RAML. This is mostly due to the
fact that, as the ML (modeling language) letters in
the name implies, this proposal is more oriented to
the modeling of the API rather than simply to its
documentation/description in favor of potential con-
sumers, enabling what it s called an API design-first
approach. RAML is a non-proprietary, vendor-neutral
open specification. The workgroup developing the
specification includes representatives from MuleSoft,
VMware and Cisco. A RAML model is represented in
a text document adopting the YAML
9
format (a pop-
ular human friendly data serialization standard) and
contains a structural description of the API: its re-
sources, their methods, the URI and query parameters
used in invocations, the format for the body of the ex-
changed entities, and so on. The RAML developers
and a large user community also make available var-
ious tools (usually as open source software), among
them several converters to transform RAML specifi-
cations in documentation or skeleton code for many
language/platform pairs.
3 FROM UML TO REST APIs
The solution we designed is meant to satisfy the
desiderata exposed in the introduction section. What
follows is a brief discussion of how these requirement
affected our choices.
D1 implies that a new modeling notation should
not be developed and if a metamodel is defined it
6
http://www.sparxsystems.com/products/ea/
7
https://eclipse.org/Xtext/
8
http://www.ibm.com/developerworks/rational/library/
design-implement-restful-web-services/
9
http://www.yaml.org/
should then be possible to express it using UML pro-
files. This strongly drove us toward the adoption of a
UML profile.
D2 implies that a starting model should be eas-
ily transformed into different language/platform tar-
gets. As a result, no implementation-specific con-
cerns should percolate upward to the starting nota-
tion. But this also means that, in order to max-
imize the adoption of the solution, several trans-
formation targets should be supported (like PHP,
Javascript/Node.js, Java/JAX-RS, and so on). Being
this far from trivial we started considering the adop-
tion of an intermediate notation even more appeal-
ing if that has available code generators that can be
adopted in the tool chain.
D3 goes in this very same direction: if the analysis
of the other requirements drive toward the adoption of
an intermediate notation, this notation should be an
existing one, allowing the adoption of existing tools
and avoiding the need to learn yet another DSL by the
development team members.
Taking into account also D4 and D5 we decided
to adopt an intermediate RAML artifact. The deci-
sion to use RAML impacts the definition of the ini-
tial profile. As usual when adopting transformations
in model-driven approaches, the problem of seman-
tic equivalence arises: if the starting notation contains
more information than the target, this information is
inevitably lost in the transformation. On the other
side, if the target notation contains more information
then it is possible that the resulting artifact needs to be
furtherly modified to add information if that is used
in later stages. Since RAML can express implemen-
tation details (such as the schema of the payloads or
the authentication mechanisms) that can be fruitfully
exploited in later transformations and since, by de-
sign, we decided that these details should not be part
of the UML profile, it is pretty obvious that we are in
the second of the two aforementioned cases. What
this means is that the RAML file produced by the
UML-to-RAML transformation is a skeleton contain-
ing structural information and it has to be enriched
with additional details before refining it in successive
artifacts. The modification of an intermediate artifact
in model-driven approaches is always problematic:
what happens when the transformation producing the
original version of the artifact is re-executed? Should
the artifact be overwritten and all the additional ele-
ments discarded? For model-to-text transformations
most of the times we witness solutions based on the
creative use of comments to mark elements that have
to be preserved and/or elements that can be overwrit-
ten. RAML wisely includes a layering mechanism
(based on so called overlays) that allow manual re-
WEBIST 2016 - 12th International Conference on Web Information Systems and Technologies
196