How to Include the format of the JSON Response Body in the docs generated by Enunciate?

StackOverflow https://stackoverflow.com/questions/11097126

  •  15-06-2021
  •  | 
  •  

문제

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:

Documentation Screenshot

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top