Add gorgeous coat I developed an API

In the daily development, is most likely to be Tucao code written bad, you know this is not a comment ghosts What does it mean ah?

Another document is not complete, these interfaces are doing it? Parameters What does it mean? And so on.

In the final analysis there is no strict development standards, the most important thing is to have a handy tool to help us landing these specifications.

Today we recommend an open source API management tool, if you do not spend feeling to see it.

STRUCTURE

YApi is efficient, easy to use, powerful api management platform designed for the development of products, testers provide a more elegant interface management services. Can help developers easily create, publish, maintain API, YApi also provides users with excellent interactive experience, developers can simply use the interface data platform provides tools and write a single click you can manage interface.

Home: yapi.demo.qunar.com/

GitHub:github.com/YMFE/yapi

characteristic

  • Based Json5 and Mockjs return data structure defines the interface and documentation efficiencies times
  • Flat design rights, which is to ensure the management of large-scale enterprise projects, but also to ensure ease of use
  • Similar postman debugging interface
  • Automated testing, support for the assertion Response
  • In addition to supporting common random MockServer mock, but also increased the Mock desired function, according to filtering rules set by the request, return the expected data
  • Support postman, har, swagger data import
  • Free and open source, network deployment, no longer afraid of leaked information

home page

image

API Basic Information

image

Parameters and responses

image

Swagger

Introduction

Swagger is a standardized and complete framework for generating, description, and visualization calls for RESTful Web services. Swagger's goal is to define a standard REST API and language-independent interface, and computer people have no need to access the source code, documents, or network traffic monitoring capabilities and understanding of services can be found. When properly defined by Swagger, the user can understand and use the remote service and remote service implementation logic minimal interaction. And for the underlying programming interfaces implemented similar, Swagger may have eliminated the guesswork call service.

GitHub:github.com/swagger-api

integrated

Spring Boot may be used in the open source package for integrated starter will be more simple, such as we use the package of spring4all, Maven dependency as follows:

<dependency>
    <groupId>com.spring4all</groupId>
    <artifactId>swagger-spring-boot-starter</artifactId>
    <version>1.9.1.RELEASE</version>
</dependency>
复制代码

After relies plus a good plus @ EnableSwagger2Doc to enable Swagger on startup class.

use

Then do not explain the specific use, and is relatively simple, it is to add some notes on your interface to describe this interface is doing it.

The default without comment your interface can also show up all of a scanning method that is in your @RestController.

image

home page

image

Interface List

There is a problem you might encounter

Generally, we will conduct a global exception handling in the project, when an error occurs, an exception will be captured and then converted into a fixed format of the response to the caller. This unified API data format.

We will configure the following, tell SpringBoot do not create a resource file mapping our project, so that you can return the contents of pure JSON.

spring.resources.add-mappings=false
复制代码

But then our swagger-ui.html can not access, so resources need to swagger-ui.html related maps alone.

@Configuration
public class WebAppConfigurer extends WebMvcConfigurationSupport {
    @Override
    protected void addResourceHandlers(ResourceHandlerRegistry registry) {
       
        registry.addResourceHandler("/swagger-ui.html")
                .addResourceLocations("classpath:/META-INF/resources/");
        registry.addResourceHandler("/webjars/**")
                .addResourceLocations("classpath:/META-INF/resources/webjars/");
        super.addResourceHandlers(registry);
        
    }
    
}
复制代码

ShowDoc

ShowDoc online API documentation is a very suitable IT team, technical documentation tools.

Home: www.showdoc.cc/

GitHub:github.com/star7th/sho…

We can do ShowDoc API documentation, data dictionary, for illustrative purposes documents. It can be deployed their own, personal, then you can also use the online official shows listed.

ShowDoc support rights management, support for markdown editing, support for export, support the sharing and other functions.

API documentation

image

image

Data Dictionary

image

CRAP-API

CRAP-API is completely open source, free of collaboration management system API. Providing collaborative development, online test, document management, export interface, personalization features, such as customized features.

Home: api.crap.cn/

GitHub:github.com/EhsanTang/A…

characteristic

  • BUG simple and efficient management system to record every change
  • Teamwork, access control, change log
  • Database tables, markdown, restful, mock, pdf, word
  • Chrome open source plug-ins, support for cross-domain, local, on-line debugging interfaces
  • The system is completely free, fully open source

API Management

image

New API

Data Dictionary

The data dictionary also supports the generation of MyBatis XML file to generate the Entity Java objects.

image

Interested can follow my micro letter public number ape world , the first time to read more technical articles. I also have some GitHub open source code github.com/yinjihuan

Guess you like

Origin juejin.im/post/5e78c6656fb9a07c8679226b