如何在Enunciate生成的文档中包含JSON Response Body的格式?

Vla*_*kov 9 enunciate maven

目前Enunciate生成REST API文档,但Response Body不包含有关响应的JSON结构的信息.根据我的理解,如果我将类包含在由Jersey to JSON序列化/反序列化的数据实体中,则enunciate将能够生成该文档的那一部分.

数据实体位于不同的模块中,按照发布文档 - 多模块项目中的建议与其源一起打包

...
<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>
...
Run Code Online (Sandbox Code Playgroud)

这就是我的enunciate.xml的样子:

<?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>
Run Code Online (Sandbox Code Playgroud)

这就是文档的样子:

文档截图

如您所见,响应主体只包含element: (custom).

如何使其包含响应的JSON结构?

Vla*_*kov 9

为了生成"数据模型"部分的文档,应使用注释实体@XmlRootElement.