-
-
Notifications
You must be signed in to change notification settings - Fork 504
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'remove-kotlin-indent' of https://github.com/e-build/spr…
…ingdoc-openapi into e-build-remove-kotlin-indent
- Loading branch information
Showing
5 changed files
with
187 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
...api-kotlin-webmvc-tests/src/test/kotlin/test/org/springdoc/api/app11/ExampleController.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package test.org.springdoc.api.app11 | ||
|
||
import io.swagger.v3.oas.annotations.Operation | ||
import org.springframework.web.bind.annotation.GetMapping | ||
import org.springframework.web.bind.annotation.RequestParam | ||
import org.springframework.web.bind.annotation.RestController | ||
|
||
@RestController | ||
class ExampleController { | ||
|
||
@Operation( | ||
summary = "foo api", | ||
description = """ | ||
this api is foo | ||
#### Custom exception case | ||
| Http Status | Error Code | Error Message | Error Data | Remark | | ||
|-------------|-------------|--------------|------------|-----------| | ||
| 403 | NO_PERMISSION |This request is only available to administrators. | | | | ||
| 400 | STORE_NOT_FOUND |Store not found. | | | | ||
""" | ||
) | ||
@GetMapping("/foo/remove-kotlin-indent") | ||
fun readFoo(@RequestParam name: String?) = FooResponse("Hello ${name ?: "world"}") | ||
|
||
} | ||
|
||
data class FooResponse( | ||
private val name: String, | ||
) |
31 changes: 31 additions & 0 deletions
31
...pi-kotlin-webmvc-tests/src/test/kotlin/test/org/springdoc/api/app11/SpringDocApp11Test.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* | ||
* * Copyright 2019-2023 the original author or authors. | ||
* * | ||
* * Licensed under the Apache License, Version 2.0 (the "License"); | ||
* * you may not use this file except in compliance with the License. | ||
* * You may obtain a copy of the License at | ||
* * | ||
* * https://www.apache.org/licenses/LICENSE-2.0 | ||
* * | ||
* * Unless required by applicable law or agreed to in writing, software | ||
* * distributed under the License is distributed on an "AS IS" BASIS, | ||
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* * See the License for the specific language governing permissions and | ||
* * limitations under the License. | ||
* | ||
*/ | ||
|
||
package test.org.springdoc.api.app11 | ||
|
||
import org.springframework.boot.autoconfigure.SpringBootApplication | ||
import org.springframework.context.annotation.ComponentScan | ||
import org.springframework.test.context.TestPropertySource | ||
import test.org.springdoc.api.AbstractKotlinSpringDocMVCTest | ||
|
||
@TestPropertySource(properties = ["springdoc.trim-kotlin-indent=true"]) | ||
class SpringDocApp11Test : AbstractKotlinSpringDocMVCTest() { | ||
@SpringBootApplication | ||
@ComponentScan(basePackages = ["org.springdoc", "test.org.springdoc.api.app11"]) | ||
class DemoApplication | ||
} |
60 changes: 60 additions & 0 deletions
60
...openapi-tests/springdoc-openapi-kotlin-webmvc-tests/src/test/resources/results/app11.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
{ | ||
"openapi": "3.0.1", | ||
"info": { | ||
"title": "OpenAPI definition", | ||
"version": "v0" | ||
}, | ||
"servers": [ | ||
{ | ||
"url": "http://localhost", | ||
"description": "Generated server url" | ||
} | ||
], | ||
"paths": { | ||
"/foo/remove-kotlin-indent": { | ||
"get": { | ||
"tags": [ | ||
"example-controller" | ||
], | ||
"summary": "foo api", | ||
"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", | ||
"operationId": "readFoo", | ||
"parameters": [ | ||
{ | ||
"name": "name", | ||
"in": "query", | ||
"required": false, | ||
"schema": { | ||
"type": "string" | ||
} | ||
} | ||
], | ||
"responses": { | ||
"200": { | ||
"description": "OK", | ||
"content": { | ||
"*/*": { | ||
"schema": { | ||
"$ref": "#/components/schemas/FooResponse" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"components": { | ||
"schemas": { | ||
"FooResponse": { | ||
"type": "object", | ||
"properties": { | ||
"name": { | ||
"type": "string", | ||
"writeOnly": true | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |