Skip to content

Swagger-bootstrap-ui is the Swagger front-end UI implementation, the purpose is to replace the Swagger default UI implementation Swagger-UI, make the document more friendly....

Notifications You must be signed in to change notification settings

oIdmonk/Swagger-Bootstrap-UI

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 

Repository files navigation

swagger-bootstrap-ui

Maven Central

English introduction | 中文说明

Introduction

Swagger-bootstrap-ui is the Swagger front-end UI implementation, the purpose is to replace the Swagger default UI implementation Swagger-UI, make the document more friendly....

Swagger-bootstrap-ui is just the UI implementation of Swagger, instead of replacing Swagger function. So the back-end module still depends on Swagger, and it needs to cooperate with Swagger's annotation to achieve the effect, annotation explanation.

Functions

  • The interface document is illustrated with the effect diagram as follows:

  • Online debugging function, the effect diagram is as follows:

Demo

see swagger-bootstarp-ui-demo

Download

download address: http://git.oschina.net/xiaoym/swagger-bootstrap-ui/releases

Use

  • First, you need to introduce the configuration package information of swagger, as follows:
<dependency>

 <groupId>io.springfox</groupId>

 <artifactId>springfox-swagger2</artifactId>

 <version>2.2.2</version>

</dependency>



<!-- Here swagger-ui is the default implementation of swagger, and this jar can be replaced with the following swagger-bootstrap-ui substitution--->

<dependency>

 <groupId>io.springfox</groupId>

 <artifactId>springfox-swagger-ui</artifactId>

 <version>2.2.2</version>

</dependency>

  • The jar package dependency of swagger-bootstrap-ui is referenced in the Maven project, as follows:
<dependency>
  <groupId>com.github.xiaoymin</groupId>
  <artifactId>swagger-bootstrap-ui</artifactId>
  <version>1.6</version>
</dependency>
  • Swagger is enabled in the Spring project, and the code is as follows:

1.Annotation

@Configuration

@EnableSwagger2

public class SwaggerConfiguration {



 @Bean

 public Docket createRestApi() {

 return new Docket(DocumentationType.SWAGGER_2)

 .apiInfo(apiInfo())

 .select()

 .apis(RequestHandlerSelectors.basePackage("com.bycdao.cloud"))

 .paths(PathSelectors.any())

 .build();

 }



 private ApiInfo apiInfo() {

 return new ApiInfoBuilder()

 .title("swagger-bootstrap-ui RESTful APIs")

 .description("swagger-bootstrap-ui")

 .termsOfServiceUrl("http://localhost:8999/")

 .contact("developer@mail.com")

 .version("1.0")

 .build();

 }



}

  • swagger-bootstrap-ui default access address:http://${host}:${port}/doc.html

Attention

  • Request address swagger package given by default is /v2/api-docs, so the swagger-bootstrap-ui call back is /v2/api-docs, not with the suffix, and the need to return to the JSON data frame if spring boot can be used directly without modification, if MVC is Spring, the configuration of the DispatcherServlet in web.xml, you need an additional URL matching rules are as follows:
<servlet>

 <servlet-name>cmsMvc</servlet-name>

 <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>

 <init-param>

 <param-name>contextConfigLocation</param-name>

 <param-value>classpath:config/spring.xml</param-value>

 </init-param>

 <load-on-startup>1</load-on-startup>

</servlet>



<!--Default configuration,.Htm|.do|.json and so on configuration-->

<servlet-mapping>

 <servlet-name>cmsMvc</servlet-name>

 <url-pattern>*.htm</url-pattern>

</servlet-mapping>

<!-- Configuring the URL request path for swagger-bootstrap-ui-->

<servlet-mapping>

 <servlet-name>cmsMvc</servlet-name>

 <url-pattern>/v2/api-docs</url-pattern>

</servlet-mapping>

Thanks

Especially thanks to the js/css and HTML front-end frame developed by the following Daniel, beautiful and easy to use

frame website
jquery http://jquery.com/
bootstrap http://getbootstrap.com
layer http://layer.layui.com/
jsonview https://github.com/yesmeck/jquery-jsonview

About

Swagger-bootstrap-ui is the Swagger front-end UI implementation, the purpose is to replace the Swagger default UI implementation Swagger-UI, make the document more friendly....

Resources

Stars

Watchers

Forks

Packages

 
 
 

Languages

  • CSS 72.9%
  • JavaScript 21.7%
  • HTML 5.4%