File tree Expand file tree Collapse file tree 7 files changed +146
-1
lines changed
main/java/org/springdoc/core
kotlin/test/org/springdoc/api/app4 Expand file tree Collapse file tree 7 files changed +146
-1
lines changed Original file line number Diff line number Diff line change 1414 <artifactId >springdoc-openapi-common</artifactId >
1515 <version >${project.version} </version >
1616 </dependency >
17+ <dependency >
18+ <groupId >com.fasterxml.jackson.module</groupId >
19+ <artifactId >jackson-module-kotlin</artifactId >
20+ </dependency >
1721 <dependency >
1822 <groupId >org.jetbrains.kotlin</groupId >
1923 <artifactId >kotlin-stdlib-jdk8</artifactId >
Original file line number Diff line number Diff line change 1818
1919package org .springdoc .core ;
2020
21+ import com .fasterxml .jackson .module .kotlin .KotlinModule ;
22+ import io .swagger .v3 .core .util .Json ;
2123import kotlin .Deprecated ;
2224import kotlin .coroutines .Continuation ;
2325
@@ -36,6 +38,7 @@ public class SpringDocKotlinConfiguration {
3638 static {
3739 getConfig ().addRequestWrapperToIgnore (Continuation .class )
3840 .addDeprecatedType (Deprecated .class );
41+ Json .mapper ().registerModule (new KotlinModule ());
3942 }
4043
4144 @ 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 5555 "components" : {
5656 "schemas" : {
5757 "SystemStatusResponse" : {
58+ "required" : [
59+ " status"
60+ ],
5861 "type" : " object" ,
5962 "properties" : {
6063 "status" : {
6770 }
6871 }
6972 }
70- }
73+ }
Original file line number Diff line number Diff line change 5656 "components" : {
5757 "schemas" : {
5858 "SystemStatusResponse" : {
59+ "required" : [
60+ " status"
61+ ],
5962 "type" : " object" ,
6063 "properties" : {
6164 "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