This repository has been archived by the owner on Aug 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
openapi.gradle
91 lines (77 loc) · 2.61 KB
/
openapi.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
buildscript {
ext {
springBootVersion = '2.1.1.RELEASE'
// path to snippets generated by Spring REST Docs
snippetsDir = file('build/generated-snippets')
// used by Spring Auto REST Docs
javadocJsonDir = file("$buildDir/generated-javadoc-json")
}
repositories {
mavenCentral()
jcenter()
maven {url = uri("https://jitpack.io") }
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
// restdoc-apispec
classpath("com.epages:restdocs-api-spec-gradle-plugin:0.8.0")
}
}
// needed for Spring Auto REST Docs
configurations {
jsondoclet
}
apply plugin: 'java'
apply plugin: 'org.springframework.boot'
// restdocs-apispec
apply plugin: 'com.epages.restdocs-api-spec'
apply plugin: 'io.spring.dependency-management'
repositories {
mavenCentral()
jcenter()
}
dependencies {
implementation('org.springframework.boot:spring-boot-starter-data-jpa')
implementation('org.springframework.boot:spring-boot-starter-validation')
implementation('org.springframework.boot:spring-boot-starter-web')
runtimeOnly('com.h2database:h2')
testImplementation('org.springframework.boot:spring-boot-starter-test')
// Spring REST Docs
testImplementation 'org.springframework.restdocs:spring-restdocs-mockmvc:2.0.3.RELEASE'
// Spring Auto REST Docs
testImplementation 'capital.scalable:spring-auto-restdocs-core:2.0.3'
jsondoclet 'capital.scalable:spring-auto-restdocs-json-doclet:2.0.3'
// restdoc-apispec
testCompile('com.epages:restdocs-api-spec-mockmvc:0.8.0')
}
openapi3 {
server = 'http://localhost:8080'
title = 'heidelpay API'
version = '0.1.0'
format = 'json'
outputDirectory="build/openapi/"
snippetsDirectory="build/generated-snippets/openapi/spec/charge"
}
postman {
title = 'heidelpay API'
version = '0.1.0'
baseUrl = 'https://localhost:8080'
}
// used by Spring REST Docs
task jsonDoclet(type: Javadoc, dependsOn: compileJava) {
source = sourceSets.main.allJava
classpath = sourceSets.main.compileClasspath
destinationDir = javadocJsonDir
options.docletpath = configurations.jsondoclet.files.asType(List)
options.doclet = 'capital.scalable.restdocs.jsondoclet.ExtractDocumentationAsJsonDoclet'
options.memberLevel = JavadocMemberLevel.PACKAGE
}
test {
// folder used by spring restdoc
outputs.dir snippetsDir
// Spring Auto REST Docs
systemProperty 'org.springframework.restdocs.outputDir', snippetsDir
systemProperty 'org.springframework.restdocs.javadocJsonDir', javadocJsonDir
// call for auto REST Doc
dependsOn jsonDoclet
}