Skip to content

wangcansunking/swagger-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

swagger-server

alt tag

Doc Ui

We use swagger ui as the ui show.

maven config (Java)

Step 0: change parent

    <parent>
        <groupId>com.baiwangmaoyi</groupId>
        <artifactId>backend-parent</artifactId>
        <version>1.16</version>
    </parent>

Step 1: Dependency

   <!--swagger-->
   <dependency>
       <groupId>io.swagger</groupId>
       <artifactId>swagger-jersey2-jaxrs</artifactId>
       <version>1.5.0</version>
       <scope>compile</scope>
   </dependency>

Step 2: update Plugin

Reference: How to Use Plugin

Some configurations have been filled in common. So just configure some project-related.

Attention:remember to change version to away from covering others doc.

            <plugin>
                <groupId>com.github.kongchen</groupId>
                <artifactId>swagger-maven-plugin</artifactId>
                <configuration>
                    <apiSources>
                        <apiSource>
                            <locations>
                                com.baiwangmaoyi.ap.rest //your rest folder
                            </locations>
                            <info>
                                <title>test</title> // the doc name
                                <version>1.0.0</version> //the doc version
                            </info>
                        </apiSource>
                    </apiSources>
                </configuration>
            </plugin>

Step 3: Java Code Annotations

Reference: Swagger Annotations

    @GET
    @Produces(MediaType.APPLICATION_JSON)
    @ApiOperation(value = "Find incoming invoice list", response = InvoiceInputDTO.class, responseContainer = "List")
    @ApiResponses(@ApiResponse(code = 500, message = "internal error"))

Step 4: upload generated json file

Step 4.1:

run mvn clean compile -DskipTests

Step 4.2:

Download api.js in the related folder, and put it on your project root directory such as SC-Invoice-Input/.

Step 4.3:

  1. temp version: run node api.js
  2. stable version(we must on master branch): run node api.js -stable

visit UI

TODOs

  1. authentication setting
  2. material UI

About

swagger server tool

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages