Skip to content

sc-docs is a swagger tools that can be generated according to the Java docs specification

Notifications You must be signed in to change notification settings

wu191287278/sc-docs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

74 Commits
 
 
 
 
 
 
 
 

Repository files navigation

sc-docs

Introduction

sc-docs 可以根据Java docs规范以及springmvc 注解,jsr 311注解 生成 swagger 文档,无需侵入到项目之中

Requirements

需要安装环境 Maven and Java8 .

installation

At first generate the JAR by executing:

mvn package

Then manually install the following JARs:

  • target/sc-docs.jar

Download

curl -o sc-docs.jar -L https://github.com/wu191287278/sc-docs/releases/download/v2.8.0/sc-docs.jar

Java docs Example

/**
 * 搜索接口
 */
@RestController
@RequestMapping(value="/search")
public class SearchController {

    /**
     * 搜索用户
     *
     * @param nickname 用户昵称
     * @throws 未找到用户
     * @return 用户列表
     */
    @GetMapping(value = "user")
    public String user(@RequestParam(value = "nickname") String nickname) throws NotFoundException{
        return "user:"+nickname;
    }

}

Getting Started

git clone https://github.com/shuzheng/zheng.git
java -jar sc-docs.jar -i ./zheng -o ./docs

启动静态服务器

java -jar sc-docs.jar -serve ./docs

Other

usage: java -jar sc-docs.jar  [-i <arg>] [-o <arg>] [-serve <arg>] [-t]
-i,--input <arg>    Source directory
-o,--output <arg>   Output directory
-serve <arg>        Start server

支持环境变量替换swagger.json

Name Description
-Ddocs.projectName.host=localhost 指定host
-Ddocs.projectName.basePath=/ 指定基础路径
-Ddocs.projectName.scheme=http 指定http/https
-Ddocs.projectName.info.title=demo 指定标题

环境变量使用样例

java -Ddocs.projectName.host=localhost:8080 -Ddocs.projectName.scheme=http -Ddocs.projectName.info.title=demo -jar sc-docs.jar -i sourceDirectory -o outDirectory -t

About

sc-docs is a swagger tools that can be generated according to the Java docs specification

Resources

Stars

Watchers

Forks

Packages

No packages published