JSONDoc

easily generate docs and playground for your RESTful API

Contacts

Email StackOverflow


How to: with the jsondoc-maven-plugin

You can use the jsondoc-maven-plugin to generate the documentation and save it to a static text file. In this case the plugin will generate a file containing the documentation in json format, ready to be used in the jsondoc-ui or in your custom documentation viewer. Here is how to declare and use the plugin in your project:

<plugin>
	<groupId>org.jsondoc</groupId>
	<artifactId>jsondoc-maven-plugin</artifactId>
	<version>1.2.23</version>
	<configuration>
		<version>1.1</version>
		<basePath>http://localhost:8080/api</basePath>
		<packages>
			<package>org.jsondoc.sample.controller</package>
			<package>org.jsondoc.sample.pojo</package>
			<package>com.sample</package>
		</packages>
		<outputFile>/tmp/jsondoc.json</outputFile>
		<scanner>org.jsondoc.core.scanner.DefaultJSONDocScanner</scanner>
		<playgroundEnabled>true</playgroundEnabled> <!-- optional -->
		<displayMethodAs>URI</displayMethodAs> <!-- optional -->
	</configuration>
</plugin>

And in a terminal:

mvn jsondoc:generate

The scanner configuration property is useful if you want to use a different implementation of the JSONDocScanner interface. Currently there is offical support for three implementations:

  • org.jsondoc.core.scanner.DefaultJSONDocScanner
  • org.jsondoc.springmvc.scanner.Spring3JSONDocScanner
  • org.jsondoc.springmvc.scanner.Spring4JSONDocScanner

See Configuration for more information about how to configure the plugin.


Version 1.2.23 | Licensed under MIT License

GitHub Project | Issues