Closed dcw312 closed 10 years ago
Looking at MavenDocumentSource, I think I should mention that I'm using jersey. JaxrsApiReader reader = new DefaultJaxrsApiReader();
Stepping through this code and mine, I see that MavenDocumentSource#getDocFromClass always returns a position = 0. I'm assuming that I didn't do anything wrong to cause that. The position is determined by the reader, so it is not under your control. I recommend that you handle it by inspecting the indexes of the MustacheDocument and incrementing them if they are all zero in the OutputTemplate#feedSource method. I will submit a pull request and implement if you like.
Updated here, but have not added test case for this.
@dcw312 Could you please send a pull request?
I submitted a pull request. See issue #45
Thanks for the patch!
Hi everyone,
I'm expecting the same issue as mentionned. The HTML generated is correct only for the first element.
I have tested plugin version without success. Help will be much appreciated.
here is my current configuration (but also tested with 1.3.2)
<dependency>
<groupId>com.wordnik</groupId>
<artifactId>swagger-jaxrs_2.10</artifactId>
<version>1.3.5</version>
</dependency>
And the plugin definition (I have tested with different version of plugin too)
<plugin>
<groupId>com.github.kongchen</groupId>
<artifactId>swagger-maven-plugin</artifactId>
<version>2.3-SNAPSHOT</version>
<configuration>
<apiSources>
<apiSource>
<locations>com.rizze.sky;</locations>
<apiVersion>v1</apiVersion>
<basePath>http://localhost:8080/api</basePath>
<outputTemplate>template_mustach</outputTemplate>
<outputPath>target/docs/strapdown.html</outputPath>
<swaggerDirectory>target/docs/apidocs</swaggerDirectory>
<!--useOutputFlatStructure>false</useOutputFlatStructure-->
<!--mustacheFileRoot>${basedir}/src/main/resources/</mustacheFileRoot-->
</apiSource>
</apiSources>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
Thank you in advance for support and sorry if I made a duplicate or something like that ...
Hi @aorfevre , I noticed you use <outputTemplate>template_mustach</outputTemplate>
, what's that template? Does it as same as https://raw.github.com/kongchen/api-doc-template/master/v2.0/html.mustache ?
hi kongchen,
After many tests, I have finally decided to change the template by customizing it a bit. My base was indeed html.mustache. It's now working with my specific adjustement the way I wanted too.
Thank you for support.
Sure, glad to hear that.
Hi @kongchen
I have the same problem as @aorfevre .
Here is my dependency
<dependency>
<groupId>com.wordnik</groupId>
<artifactId>swagger-jersey2-jaxrs_2.10</artifactId>
<scope>compile</scope>
<version>1.3.7</version>
</dependency>
and my configuration
<plugin>
<groupId>com.github.kongchen</groupId>
<artifactId>swagger-maven-plugin</artifactId>
<version>2.3</version>
<configuration>
<apiSources>
<apiSource>
<locations>org.gradiant.criptonube.rest.api</locations>
<apiVersion>1.0</apiVersion>
<basePath>http://193.146.211.61:8080/HSMaaS/webresources</basePath>
<swaggerDirectory>generated/swagger-ui</swaggerDirectory>
<outputTemplate>templates/strapdown.html.mustache</outputTemplate>
<mustacheFileRoot>${basedir}/templates/</mustacheFileRoot>
<outputPath>${basedir}/generated/document.html</outputPath>
</apiSource>
</apiSources>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
swagger-ui folder with json is there but no document.html is being genrated.
Do you sure you have prepared all of your template files? such as https://github.com/kongchen/swagger-maven-example/tree/master/templates
Yes I have. I copied that very same folder in my project. I am not sure if I need to download the swagger dist content as well. I mean, swagger maven plugin is all I am using so far.
Have you ever run https://github.com/kongchen/swagger-maven-example successfully in your env? If so, compare your pom.xml with the example's.
Yes I have. I cloned the repo. Did mvn clean install and launched the war with jetty. I access http://localhost:8080/swagger-maven-example-1.0-SNAPSHOT/ but not sure how to access the document.html. It does generate it in the generated folder though.
Hi @eskalera , this plugin is a compile phase plugin and the generated document is a static document. The swagger-maven-example is only an example to prove that, you only need to open the document.html using your native browser (ie, chrome, firefox).
The mustache html output is not formatting correctly. The class attribute is only included in the first resource. The div id's are are all set to "accordion0api" The "index" attribute does not seem to be set correctly.