Skip to content

Commit e59eb75

Browse files
committed
Add swagger plugin
1 parent d4f2383 commit e59eb75

File tree

3 files changed

+40
-49
lines changed

3 files changed

+40
-49
lines changed

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ node_modules
55
_book
66
.gradle/
77
classes/
8+
generated/
89
libs/
910
jars/
1011
stroom-dashboard-gwt/hs_err_pid*.log

Diff for: build.gradle

+22-49
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ buildscript {
88
dependencies {
99
classpath group: 'gchq', name: 'urlDependencyPlugin', version: 'v0.1'
1010
classpath group: 'ca.cutterslade.gradle', name: 'gradle-dependency-analyze', version: '1.1.0'
11-
classpath 'com.benjaminsproule:swagger-gradle-plugin:0.1.0'
11+
classpath 'com.benjaminsproule:swagger-gradle-plugin:+'
1212
}
1313
}
1414

1515
plugins {
1616
id "de.undercouch.download" version "3.2.0"
17+
//id "com.benjaminsproule.swagger" version "0.1.2"
1718
}
1819

1920
apply plugin: 'gchq.urldependencies'
20-
apply plugin: 'com.benjaminsproule.swagger'
2121

2222

2323
//if the project has a value for the passed property (i.e from the cmd line via -PpropName=xxx)
@@ -215,6 +215,7 @@ task wrapper(type: Wrapper) {
215215
allprojects {
216216
apply plugin: 'maven'
217217
apply plugin: 'maven-publish'
218+
//apply plugin: 'com.benjaminsproule.swagger'
218219

219220
group = 'stroom'
220221
//version = getPropertyOrDefault('version', 'SNAPSHOT')
@@ -283,6 +284,25 @@ subprojects {
283284
showStackTraces = true
284285
}
285286
}
287+
288+
//See https://github.com/kongchen/swagger-maven-plugin for details of the properties of apiSource
289+
//See https://stackoverflow.com/questions/43104791/how-to-prevent-xml-wrapper-element-in-swagger-ui for details
290+
//of using xml and json with swagger
291+
//swagger {
292+
//apiSource {
293+
//springmvc = false
294+
//locations = [ 'stroom.resources.query.v2.SqlStatisticsQueryResource' ]
295+
//schemes = [ 'http' ]
296+
//host = 'www.example.com:8080'
297+
//basePath = '/'
298+
//info {
299+
//title = 'Swagger Gradle Plugin Sample'
300+
//version = 'v1'
301+
//}
302+
//outputPath = "${project.rootDir}/generated/document.html"
303+
//swaggerDirectory = "${project.rootDir}/generated/swagger-ui"
304+
//}
305+
//}
286306
}
287307

288308

@@ -385,50 +405,3 @@ urlDependencies {
385405
"https://github.com/gchq/hadoop-common-shaded/releases/download/$versions.hadoopCommonShaded/${urlLibs.hadoopCommonShaded}.jar")
386406
}
387407

388-
//See https://github.com/kongchen/swagger-maven-plugin for details of the properties of apiSource
389-
//See https://stackoverflow.com/questions/43104791/how-to-prevent-xml-wrapper-element-in-swagger-ui for details
390-
//of using xml and json with swagger
391-
swagger {
392-
apiSource {
393-
springmvc = false
394-
locations = [ 'stroom.resources.query.v2.SqlStatisticsQueryResource' ]
395-
schemes = [ 'http' ]
396-
host = 'www.example.com:8080'
397-
basePath = '/'
398-
info {
399-
title = 'Swagger Gradle Plugin Sample'
400-
version = 'v1'
401-
//<!-- use markdown here because I'm using markdown for output,
402-
//if you need to use html or other markup language, you need to use your target language -->
403-
//description = 'This is a sample.'
404-
//termsOfService = 'http://www.example.com/termsOfService'
405-
//contact {
406-
//email = '[email protected]'
407-
//name = 'Name'
408-
//url = 'http://www.example.com'
409-
//}
410-
//license {
411-
//url = 'http://www.apache.org/licenses/LICENSE-2.0.html'
412-
//name = 'Apache 2.0'
413-
//}
414-
}
415-
//securityDefinition {
416-
//name = 'basicAuth'
417-
//type = 'basic'
418-
//}
419-
//securityDefinition {
420-
//json = '/securityDefinition.json'
421-
//}
422-
//
423-
//Support classpath or file absolute path here.
424-
//1) classpath e.g: "classpath:/markdown.hbs", "classpath:/templates/hello.html"
425-
//2) file e.g: "${project.rootDir}/src/main/resources/markdown.hbs", "${project.rootDir}/src/main/resources/template/hello.html"
426-
//
427-
//templatePath = "${project.rootDir}/src/test/resources/strapdown.html.hbs"
428-
outputPath = "${project.rootDir}/generated/document.html"
429-
swaggerDirectory = "${project.rootDir}/generated/swagger-ui"
430-
//swaggerApiReader = 'com.wordnik.swagger.jaxrs.reader.DefaultJaxrsApiReader'
431-
//modelConverters = [ 'io.swagger.validator.BeanValidator' ]
432-
// attachSwaggerArtifact = true - WILL BE ADDED IN THE FUTURE
433-
}
434-
}

Diff for: stroom-app/build.gradle

+17
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ plugins {
33
}
44

55
apply plugin: 'application'
6+
apply plugin: 'com.benjaminsproule.swagger'
67
mainClassName = 'stroom.startup.App'
78

89
jar {
@@ -153,3 +154,19 @@ run {
153154
//missing all the GWT generated files and the UI will fail to start
154155
processResources.dependsOn(':stroom-app-gwt:gwtCompile')
155156
processResources.dependsOn(':stroom-dashboard-gwt:gwtCompile')
157+
158+
swagger {
159+
apiSource {
160+
springmvc = false
161+
locations = [ 'stroom.resources.query.v2.SqlStatisticsQueryResource' ]
162+
schemes = [ 'http' ]
163+
host = 'www.example.com:8080'
164+
basePath = '/'
165+
info {
166+
title = 'Swagger Gradle Plugin Sample'
167+
version = 'v1'
168+
}
169+
outputPath = "${project.rootDir}/generated/document.html"
170+
swaggerDirectory = "${project.rootDir}/generated/swagger-ui"
171+
}
172+
}

0 commit comments

Comments
 (0)