Skip to content

Commit 18edc27

Browse files
committed
add test springdoc.trim-kotlin-indent
1 parent 2db978a commit 18edc27

File tree

3 files changed

+121
-0
lines changed

3 files changed

+121
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package test.org.springdoc.api.app11
2+
3+
import io.swagger.v3.oas.annotations.Operation
4+
import org.springframework.web.bind.annotation.GetMapping
5+
import org.springframework.web.bind.annotation.RequestParam
6+
import org.springframework.web.bind.annotation.RestController
7+
8+
@RestController
9+
class ExampleController {
10+
11+
@Operation(
12+
summary = "foo api",
13+
description = """
14+
this api is foo
15+
16+
#### Custom exception case
17+
| Http Status | Error Code | Error Message | Error Data | Remark |
18+
|-------------|-------------|--------------|------------|-----------|
19+
| 403 | NO_PERMISSION |This request is only available to administrators. | | |
20+
| 400 | STORE_NOT_FOUND |Store not found. | | |
21+
"""
22+
)
23+
@GetMapping("/foo/remove-kotlin-indent")
24+
fun readFoo(@RequestParam name: String?) = FooResponse("Hello ${name ?: "world"}")
25+
26+
}
27+
28+
data class FooResponse(
29+
private val name: String,
30+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
*
3+
* * Copyright 2019-2023 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.app11
20+
21+
import org.springframework.boot.autoconfigure.SpringBootApplication
22+
import org.springframework.context.annotation.ComponentScan
23+
import org.springframework.test.context.TestPropertySource
24+
import test.org.springdoc.api.AbstractKotlinSpringDocMVCTest
25+
26+
@TestPropertySource(properties = ["springdoc.trim-kotlin-indent=true"])
27+
class SpringDocApp11Test : AbstractKotlinSpringDocMVCTest() {
28+
@SpringBootApplication
29+
@ComponentScan(basePackages = ["org.springdoc", "test.org.springdoc.api.app11"])
30+
class DemoApplication
31+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
{
2+
"openapi": "3.0.1",
3+
"info": {
4+
"title": "OpenAPI definition",
5+
"version": "v0"
6+
},
7+
"servers": [
8+
{
9+
"url": "http://localhost",
10+
"description": "Generated server url"
11+
}
12+
],
13+
"paths": {
14+
"/foo/remove-kotlin-indent": {
15+
"get": {
16+
"tags": [
17+
"example-controller"
18+
],
19+
"summary": "foo api",
20+
"description": "\nthis api is foo\n\n#### Custom exception case\n| Http Status | Error Code | Error Message | Error Data | Remark |\n|-------------|-------------|--------------|------------|-----------|\n| 403 | NO_PERMISSION |This request is only available to administrators. | | |\n| 400 | STORE_NOT_FOUND |Store not found. | | |\n",
21+
"operationId": "readFoo",
22+
"parameters": [
23+
{
24+
"name": "name",
25+
"in": "query",
26+
"required": false,
27+
"schema": {
28+
"type": "string"
29+
}
30+
}
31+
],
32+
"responses": {
33+
"200": {
34+
"description": "OK",
35+
"content": {
36+
"*/*": {
37+
"schema": {
38+
"$ref": "#/components/schemas/FooResponse"
39+
}
40+
}
41+
}
42+
}
43+
}
44+
}
45+
}
46+
},
47+
"components": {
48+
"schemas": {
49+
"FooResponse": {
50+
"type": "object",
51+
"properties": {
52+
"name": {
53+
"type": "string",
54+
"writeOnly": true
55+
}
56+
}
57+
}
58+
}
59+
}
60+
}

0 commit comments

Comments
 (0)