File tree 7 files changed +146
-1
lines changed
main/java/org/springdoc/core
kotlin/test/org/springdoc/api/app4
7 files changed +146
-1
lines changed Original file line number Diff line number Diff line change 14
14
<artifactId >springdoc-openapi-common</artifactId >
15
15
<version >${project.version} </version >
16
16
</dependency >
17
+ <dependency >
18
+ <groupId >com.fasterxml.jackson.module</groupId >
19
+ <artifactId >jackson-module-kotlin</artifactId >
20
+ </dependency >
17
21
<dependency >
18
22
<groupId >org.jetbrains.kotlin</groupId >
19
23
<artifactId >kotlin-stdlib-jdk8</artifactId >
Original file line number Diff line number Diff line change 18
18
19
19
package org .springdoc .core ;
20
20
21
+ import com .fasterxml .jackson .module .kotlin .KotlinModule ;
22
+ import io .swagger .v3 .core .util .Json ;
21
23
import kotlin .Deprecated ;
22
24
import kotlin .coroutines .Continuation ;
23
25
@@ -36,6 +38,7 @@ public class SpringDocKotlinConfiguration {
36
38
static {
37
39
getConfig ().addRequestWrapperToIgnore (Continuation .class )
38
40
.addDeprecatedType (Deprecated .class );
41
+ Json .mapper ().registerModule (new KotlinModule ());
39
42
}
40
43
41
44
@ Bean
Original file line number Diff line number Diff line change
1
+ /*
2
+ *
3
+ * * Copyright 2019-2020 the original author or authors.
4
+ * *
5
+ * * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * * you may not use this file except in compliance with the License.
7
+ * * You may obtain a copy of the License at
8
+ * *
9
+ * * https://www.apache.org/licenses/LICENSE-2.0
10
+ * *
11
+ * * Unless required by applicable law or agreed to in writing, software
12
+ * * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * * See the License for the specific language governing permissions and
15
+ * * limitations under the License.
16
+ *
17
+ */
18
+
19
+ package test.org.springdoc.api.app4
20
+
21
+ import org.springframework.web.bind.annotation.GetMapping
22
+ import org.springframework.web.bind.annotation.RequestMapping
23
+ import org.springframework.web.bind.annotation.RestController
24
+
25
+
26
+ data class Person (
27
+ val name : String ,
28
+ val nickname : String?
29
+ )
30
+
31
+ @RestController
32
+ @RequestMapping(" /test" )
33
+ class HelloController {
34
+ @GetMapping
35
+ suspend fun index (s : Person ) = Person (" name" ," nickname" )
36
+
37
+
38
+ }
Original file line number Diff line number Diff line change
1
+ /*
2
+ *
3
+ * * Copyright 2019-2020 the original author or authors.
4
+ * *
5
+ * * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * * you may not use this file except in compliance with the License.
7
+ * * You may obtain a copy of the License at
8
+ * *
9
+ * * https://www.apache.org/licenses/LICENSE-2.0
10
+ * *
11
+ * * Unless required by applicable law or agreed to in writing, software
12
+ * * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * * See the License for the specific language governing permissions and
15
+ * * limitations under the License.
16
+ *
17
+ */
18
+
19
+ package test.org.springdoc.api.app4
20
+
21
+ import org.springframework.boot.autoconfigure.SpringBootApplication
22
+ import org.springframework.context.annotation.ComponentScan
23
+ import test.org.springdoc.api.AbstractKotlinSpringDocTest
24
+
25
+ @ComponentScan(basePackages = [" org.springdoc" , " test.org.springdoc.api.app4" ])
26
+ class SpringDocApp4Test : AbstractKotlinSpringDocTest () {
27
+
28
+ @SpringBootApplication
29
+ open class DemoApplication
30
+
31
+ }
Original file line number Diff line number Diff line change 55
55
"components" : {
56
56
"schemas" : {
57
57
"SystemStatusResponse" : {
58
+ "required" : [
59
+ " status"
60
+ ],
58
61
"type" : " object" ,
59
62
"properties" : {
60
63
"status" : {
67
70
}
68
71
}
69
72
}
70
- }
73
+ }
Original file line number Diff line number Diff line change 56
56
"components" : {
57
57
"schemas" : {
58
58
"SystemStatusResponse" : {
59
+ "required" : [
60
+ " status"
61
+ ],
59
62
"type" : " object" ,
60
63
"properties" : {
61
64
"status" : {
Original file line number Diff line number Diff line change
1
+ {
2
+ "openapi" : " 3.0.1" ,
3
+ "info" : {
4
+ "title" : " OpenAPI definition" ,
5
+ "version" : " v0"
6
+ },
7
+ "servers" : [
8
+ {
9
+ "url" : " " ,
10
+ "description" : " Generated server url"
11
+ }
12
+ ],
13
+ "paths" : {
14
+ "/test" : {
15
+ "get" : {
16
+ "tags" : [
17
+ " hello-controller"
18
+ ],
19
+ "operationId" : " index" ,
20
+ "parameters" : [
21
+ {
22
+ "name" : " s" ,
23
+ "in" : " query" ,
24
+ "required" : true ,
25
+ "schema" : {
26
+ "$ref" : " #/components/schemas/Person"
27
+ }
28
+ }
29
+ ],
30
+ "responses" : {
31
+ "200" : {
32
+ "description" : " default response" ,
33
+ "content" : {
34
+ "*/*" : {
35
+ "schema" : {
36
+ "$ref" : " #/components/schemas/Person"
37
+ }
38
+ }
39
+ }
40
+ }
41
+ }
42
+ }
43
+ }
44
+ },
45
+ "components" : {
46
+ "schemas" : {
47
+ "Person" : {
48
+ "required" : [
49
+ " name"
50
+ ],
51
+ "type" : " object" ,
52
+ "properties" : {
53
+ "name" : {
54
+ "type" : " string"
55
+ },
56
+ "nickname" : {
57
+ "type" : " string"
58
+ }
59
+ }
60
+ }
61
+ }
62
+ }
63
+ }
You can’t perform that action at this time.
0 commit comments