Currently Enunciate generates the REST API documentation, but the Response Body doesn't contain the information about the JSON structure of the response. In my understanding, if I include the classes with the data entities that are serialized/de-serialized by Jersey to JSON, enunciate would be able to generate that piece of the documentation.
The data entities are in a different module, which is packaged with its sources as suggested in the enunciate documentation - Multi-Module Projects
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.1.2</version>
<executions>
<execution>
<id>attach-sources</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
...
This is how my enunciate.xml looks like:
<?xml version="1.0"?>
<enunciate label="someapi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://enunciate.codehaus.org/schemas/enunciate-1.25.xsd">
<api-import pattern="com.something.business.vo.**"/>
<api-import pattern="com.something.business.domain.**"/>
<api-classes>
<include pattern="com.something.web.ssoApi.rest.*"/>
<include pattern="com.something.business.vo.**"/>
<include pattern="com.something.business.domain.**"/>
</api-classes>
</enunciate>
And this how the docs look like:
As you see the Response Body contains just element: (custom)
.
How to make that contain the JSON structure of the response?
In order to generate the documentation for the Data Model section, the entities should be annotated with @XmlRootElement
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With