Spring MVC - RAML Spec Synchroniser Plugin. A Maven plugin designed to Generate Server & Client code in Spring from a RAML API descriptor and conversely, a RAML API document from the SpringMVC Server implementation.
Given the following RAML where Bar extends Foo and an endpoint that returns a Bar array:
#%RAML 1.0
---
title: e-BookMobile API
baseUri: http://example.com/{version}
version: v1
types:
Foo:
type: object
Bar:
type: Foo
/bar:
get:
responses:
200:
body:
application/json:
type: array
items: Bar
Expected result
class Bar extends Foo in the generated Java code:
public class Bar
extends Foo
implements Serializable
{
Actual result
Bar does not extend Foo, as seen here:
public class Bar implements Serializable
{
(the extends Foo is missing). The cause is probably because the return type is array (so Bar is not referenced directly) and the generic type in items is Bar:
However note that both Foo and Bar are still generated:
tobias@hattutsch gen/wow » ls -R
.:
BarController.java model
./model:
Bar.java Foo.java
Given the following RAML where
Bar
extendsFoo
and an endpoint that returns aBar
array:Expected result
class Bar extends Foo
in the generated Java code:Actual result
Bar
does not extendFoo
, as seen here:(the
extends Foo
is missing). The cause is probably because the return type isarray
(so Bar is not referenced directly) and the generic type initems
isBar
: However note that bothFoo
andBar
are still generated:When changing the endpoint to use square brackets
the
Bar
model is generated correctly