0

I trying to import model classes into enunciate docs but I'm getting the following in the Maven log:

Class com.mycompany.model.MyClass was explicitly imported, but it was not found on the classpath. We'll try to import it anyway.

I'm trying to include the Request and Response classes in my enunciate generated docs. However all I'm getting is the following:

POST
Request             Body
element:            (custom)
media types:        application/json

(no documentation provided)

Response            Body
element:            (custom)
media types:        application/json

(no documentation provided)

enunciate.xml

<?xml version="1.0"?>
<enunciate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:noNamespaceSchemaLocation="http://enunciate.codehaus.org/schemas/enunciate-1.27.xsd">
    <api-import pattern="com.mycompany.model.*" />
    <api-import pattern="com.mycompany.model.MyClass" />
    <api-classes>
        <include pattern="com.mycompany.common.imrest.model.*"/>
        <include pattern="com.mycompany.model.MyClass"/>
    </api-classes>
</enunciate>

pom.xml

        <plugin>
            <groupId>org.codehaus.enunciate</groupId>
            <artifactId>maven-enunciate-plugin</artifactId>
            <version>1.27</version>
            <configuration>
                <configFile>enunciate.xml</configFile>
            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>assemble</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

Also, a second question. Is there a way to include sample JSON request and responses in the documentation?

DarVar
  • 16,882
  • 29
  • 97
  • 146

1 Answers1

0

Enunciate scans your classpath, importing any classes you've configured to be imported. But it didn't find that class during its scan. Have you confirmed that you have a dependency on the jar that contains the com.mycompany.model.MyClass class?

Re: JSON examples: If jackson-xc.jar is on your classpath, Enunciate will generate the example JSON by default. Otherwise, you can force the example json:

 <enunciate ...>
   ...
   <modules>
     <docs forceExampleJson="true"/>
   </modules>
 </enunciate>
Ryan Heaton
  • 1,173
  • 7
  • 11