Easy Yapi plugin usage details

foreword

In the previous article, I installed Yapi locally step by step with everyone. If you are interested, you can click Mac Yapi local installation stepping pit tutorial

In this article, we come to the use of the Easy Yapi plug-in, and the purpose of installing Yapi is to use the Easy Yapi plug-in.

text

Install

The installation steps of the Idea plug-in are not detailed here. If you are not sure, you can read my historical article. The name of the plug-in is Easy Yapi, as shown in the figure below

 configuration

After the installation is successful, set the Yapi configuration in the figure below

 It can be seen from the configuration that this plug-in supports three interface platforms: PostMan, Yapi, and Markdown, and today we will use one of them, Yapi.

In the middle, find the Yapi module, fill in the Yapi service address and directory in the server box, as shown in the figure above, fill in http://127.0.0.1:3001/

The token content needs to be copied on Yapi, as shown in the following figure:

 Enter Yapi our project, select settings, token configuration, click the copy button, then fill in the plug-in, and check other options as needed, such as feign use json5 select all and so on.

Finally click apply, ok.

use

Right-click the controller file we want to generate the interface, select Export Yapi in the pop-up box, fill in the token just now in the pop-up box, and the following figure is displayed, indicating that the generation is successful.

 We open the Yapi project to refresh the page

Automatically set the Controller class as the category name, and set the display name of the interface as a note. Take a look at the way the code is written.

 Note: the interface will be generated only if the method is marked with annotations like @RequestMapping. In one case, for example, this interface is not only the implementation class of the feign interface, but also the controller interface. Then we can omit Mapping on the method of the Controller class. Annotated, just mark it on the feign interface layer. In this case, the plug-in will not generate interface documents for you, but when you check the feign option on the configuration page, we will generate it on the Controller layer. After the interface document, a second pop-up window will pop up. After entering the token, the method in the feign interface will automatically generate an interface document for you.

Guess you like

Origin blog.csdn.net/zanpengfei/article/details/127011150