-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Dave Ellis
committed
Jul 1, 2014
1 parent
8082e94
commit 7f995ad
Showing
1 changed file
with
40 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,45 @@ | ||
gradle-swagger-plugin | ||
===================== | ||
|
||
This a port of kongchen's maven plugin for generating swagger documents. | ||
This a port of kongchen's maven plugin for generating swagger documents. (See https://github.com/kongchen/swagger-maven-plugin) | ||
|
||
# Usage | ||
|
||
``` | ||
buildscript { | ||
repositories { | ||
mavenLocal() | ||
maven { url "http://repo.maven.apache.org/maven2" } | ||
} | ||
dependencies { | ||
classpath group: 'com.github.gradle-swagger', name: 'gradle-swagger-plugin', version: '1.0.1-SNAPSHOT' | ||
} | ||
} | ||
apply plugin: 'maven' | ||
apply plugin: 'swagger' | ||
apply plugin: 'java' | ||
swagger { | ||
endPoints = [ | ||
'com.foo.bar.apis', | ||
'com.foo.bar.apis.internal.Resource' | ||
] | ||
apiVersion = 'v1' | ||
basePath = 'http://www.example.com' | ||
mustacheFileRoot = "${projectDir}/src/main/resources/" | ||
outputTemplate = "${mustacheFileRoot}/strapdown.html.mustache" | ||
swaggerDirectory = "${buildDir}/site/api-docs" | ||
outputPath = "${buildDir}/site/swagger/strapdown.html" | ||
} | ||
``` | ||
swagger { | ||
endPoints = [ | ||
'com.recordsure.vaultserver.endpoints.recordings', | ||
'com.recordsure.vaultserver.endpoints.uploads', | ||
'com.recordsure.vaultserver.endpoints.base', | ||
'com.recordsure.vaultserver.endpoints.segments', | ||
'com.recordsure.vaultserver.endpoints.phrases' | ||
] | ||
apiVersion = 'v1' | ||
basePath = 'http://host:port/vaultService' | ||
mustacheFileRoot = "${projectDir}/src/main/resources/" | ||
outputTemplate = "${mustacheFileRoot}/strapdown.html.mustache" | ||
swaggerDirectory = "${buildDir}/site/api-docs" | ||
outputPath = "${buildDir}/site/swagger/strapdown.html" | ||
} | ||
``` | ||
|
||
|
||
* The swagger block currently only allows the definition of one `apiSource`. | ||
* Java classes containing Swagger's annotation `@Api`, or Java packages containing those classes can be configured in `endPoints` list. | ||
* `outputTemplate` is the path of the mustache template file. | ||
* `outputPath` is the path of your output file, not existed parent directory of the file will be created. | ||
* If `swaggerDirectory` is configured, the plugin will also generate a Swagger resource listing suitable for feeding to swagger-ui. | ||
* `useOutputFlatStructure` indicates whether swagger output will be created in sub-directories by path defined in | ||
@com.wordnik.swagger.annotations.Api#value (false), or the filename will be the path with replaced slashes to | ||
underscores (true). Default: true |