JApiDocs is an out-of-the-box document generation tool for SpringBoot interfaces that requires no additional annotations.
Writing and maintaining API documentation is an annoying chore for back-end programmers, and we all hate it, but unless you write your own front-end and back-end code, API documentation is an essential interface for back-end collaboration. If it’s inevitable, let’s get a wheel. Life is too short to be lazy.
No graphics, no truth, the resulting document looks like this:
Whereas Swagger writes a bunch of annotations, Spring RestDocs needs to write test cases to generate API documentation. JApiDocs features painless integration, and it only takes a few minutes to figure out how to use it.
Quick start
For JApiDcos to work correctly, your code should look something like this:
/** * user interface */
@RequestMapping("/api/user/")
@RestController
public class UserController {
/** * User list *@param listForm
*/
@RequestMapping(path = "list", method = {RequestMethod.GET, RequestMethod.POST} )
public ApiResult<PageResult<UserVO>> list(UserListForm listForm){
return null;
}
/** * Save user *@param userForm
*/
@PostMapping(path = "save")
public ApiResult<UserVO> saveUser(@RequestBody UserForm userForm){
return null; }}Copy the code
We annotate the Controller class and method as necessary and return the associated object type to the interface method. Yes, JApiDocs will be able to parse the relevant interface information, just as we would normally write code, but note that you need to tell JApiDocs the parameters of the interface via @param, but with the help of the IDE, this work will be easy and pleasant:
You can then generate the document by executing the following code in either of the main entry methods:
DocsConfig config = new DocsConfig();
config.setProjectPath("your springboot project path"); // Project root directory
config.setProjectName("ProjectName"); // Project name
config.setApiVersion("V1.0"); // Declare the API version
config.setDocsPath("your api docs path"); // Generate API document directory
config.setAutoGenerate(Boolean.TRUE); // The configuration is automatically generated
Docs.buildHtmlDocs(config); // Perform the generated document
Copy the code
Then you just write the code, and JApiDocs can do the job of generating the Api documentation. You don’t have to worry about writing and maintaining additional documentation.
features
Code is documentation
JApiDocs works by parsing SpringBoot’s source syntax directly, so as long as the Controller syntax conforms to certain code specifications and is properly commented, it can be exported directly.
2, support to export HTML
Convenient navigation and interface view interface; It can be previewed locally or deployed to an HTTP server. You are advised to deploy it on a server to facilitate collaboration between the front and back ends.
3. Export the client Model code synchronously
Support to export Java and iOS Object C Model code, reduce front-end programmer’s repetitive coding work.
4. More features
Supports interface search. Support different versions and English documents; Custom extensions, etc.
Concise documentation
No matter how useful something is, if there is no documentation, no one will get it. To get you up and running, JApiDocs comes with a minimal documentation to make sure you can use JApiDocs in just a few minutes. Are you sure you won’t look at a productivity tool that will allow you to spend more of your time doing more valuable things in less than five minutes?
Warehouse address: github.com/YeDaxia/JAp…
Chinese document: japidocs.agilestudio.cn/#/zh-cn/