-
-
Notifications
You must be signed in to change notification settings - Fork 505
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'martinitus-2801-infinite-recursion-with-all-of'
- Loading branch information
Showing
7 changed files
with
322 additions
and
2 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
44 changes: 44 additions & 0 deletions
44
...pi-kotlin-webmvc-tests/src/test/kotlin/test/org/springdoc/api/app13/SpringDocApp13Test.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,44 @@ | ||
/* | ||
* | ||
* * Copyright 2019-2020 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.app13 | ||
|
||
import org.springdoc.core.properties.SpringDocConfigProperties | ||
import org.springdoc.core.properties.SpringDocConfigProperties.ApiDocs.OpenApiVersion | ||
import org.springframework.boot.autoconfigure.SpringBootApplication | ||
import org.springframework.boot.test.context.SpringBootTest | ||
import org.springframework.context.annotation.Bean | ||
import org.springframework.context.annotation.ComponentScan | ||
import org.springframework.context.annotation.Configuration | ||
import test.org.springdoc.api.AbstractKotlinSpringDocMVCTest | ||
|
||
|
||
class SpringDocApp13Test : AbstractKotlinSpringDocMVCTest() { | ||
|
||
@SpringBootApplication | ||
class DemoApplication { | ||
@Bean | ||
fun springDocConfigProperties():SpringDocConfigProperties{ | ||
val x= SpringDocConfigProperties() | ||
x.apiDocs.version = OpenApiVersion.OPENAPI_3_1 | ||
return x | ||
} | ||
} | ||
|
||
|
||
} |
50 changes: 50 additions & 0 deletions
50
...penapi-kotlin-webmvc-tests/src/test/kotlin/test/org/springdoc/api/app13/TestController.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,50 @@ | ||
/* | ||
* | ||
* * Copyright 2019-2020 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.app13 | ||
|
||
|
||
import io.swagger.v3.oas.annotations.media.Schema | ||
import org.springframework.web.bind.annotation.PostMapping | ||
import org.springframework.web.bind.annotation.RequestBody | ||
import org.springframework.web.bind.annotation.RequestMapping | ||
import org.springframework.web.bind.annotation.RestController | ||
|
||
@Schema(description = "Generic description") | ||
data class KeyValue( | ||
val key: String, | ||
val value: String, | ||
) | ||
|
||
@Schema | ||
data class SomeDTO( | ||
@Schema(description = "Description A") val fieldA: KeyValue, | ||
@Schema(description = "Description B") val fieldB: KeyValue, | ||
) | ||
|
||
|
||
|
||
@RestController | ||
@RequestMapping("/test") | ||
class TestController { | ||
@PostMapping("/test") | ||
fun create(@RequestBody some: SomeDTO) { | ||
|
||
} | ||
} | ||
|
30 changes: 30 additions & 0 deletions
30
...pi-kotlin-webmvc-tests/src/test/kotlin/test/org/springdoc/api/app14/SpringDocApp14Test.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 @@ | ||
/* | ||
* | ||
* * Copyright 2019-2020 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.app14 | ||
|
||
import org.springframework.boot.autoconfigure.SpringBootApplication | ||
import org.springframework.context.annotation.ComponentScan | ||
import test.org.springdoc.api.AbstractKotlinSpringDocMVCTest | ||
|
||
class SpringDocApp14Test : AbstractKotlinSpringDocMVCTest() { | ||
|
||
@SpringBootApplication | ||
class DemoApplication | ||
|
||
} |
47 changes: 47 additions & 0 deletions
47
...penapi-kotlin-webmvc-tests/src/test/kotlin/test/org/springdoc/api/app14/TestController.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,47 @@ | ||
/* | ||
* | ||
* * Copyright 2019-2020 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.app14 | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema | ||
import org.springframework.web.bind.annotation.PostMapping | ||
import org.springframework.web.bind.annotation.RequestBody | ||
import org.springframework.web.bind.annotation.RequestMapping | ||
import org.springframework.web.bind.annotation.RestController | ||
|
||
@Schema(description = "Generic description") | ||
data class KeyValue( | ||
val key: String, | ||
val value: String, | ||
) | ||
|
||
@Schema | ||
data class SomeDTO( | ||
@Schema(description = "Description A", allOf = [KeyValue::class]) val field_a: KeyValue, | ||
@Schema(description = "Description B", allOf = [KeyValue::class]) val field_b: KeyValue, | ||
) | ||
|
||
@RestController | ||
@RequestMapping("/test") | ||
class TestController { | ||
|
||
@PostMapping("/test") | ||
fun create(@RequestBody some: SomeDTO) { | ||
|
||
} | ||
} |
68 changes: 68 additions & 0 deletions
68
...openapi-tests/springdoc-openapi-kotlin-webmvc-tests/src/test/resources/results/app13.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,68 @@ | ||
{ | ||
"openapi" : "3.1.0", | ||
"info" : { | ||
"title" : "OpenAPI definition", | ||
"version" : "v0" | ||
}, | ||
"servers" : [ { | ||
"url" : "http://localhost", | ||
"description" : "Generated server url" | ||
} ], | ||
"paths" : { | ||
"/test/test" : { | ||
"post" : { | ||
"tags" : [ "test-controller" ], | ||
"operationId" : "create", | ||
"requestBody" : { | ||
"content" : { | ||
"application/json" : { | ||
"schema" : { | ||
"$ref" : "#/components/schemas/SomeDTO" | ||
} | ||
} | ||
}, | ||
"required" : true | ||
}, | ||
"responses" : { | ||
"200" : { | ||
"description" : "OK" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"components" : { | ||
"schemas" : { | ||
"KeyValue" : { | ||
"required" : [ "key", "value" ], | ||
"type" : "object", | ||
"description" : "Generic description", | ||
"properties" : { | ||
"key" : { | ||
"type" : "string" | ||
}, | ||
"value" : { | ||
"type" : "string" | ||
} | ||
} | ||
}, | ||
"SomeDTO" : { | ||
"required": [ | ||
"fieldA", | ||
"fieldB" | ||
], | ||
"type": "object", | ||
"properties": { | ||
"fieldA": { | ||
"description": "Description A", | ||
"$ref": "#/components/schemas/KeyValue" | ||
}, | ||
"fieldB": { | ||
"description": "Description B", | ||
"$ref": "#/components/schemas/KeyValue" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
81 changes: 81 additions & 0 deletions
81
...openapi-tests/springdoc-openapi-kotlin-webmvc-tests/src/test/resources/results/app14.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,81 @@ | ||
{ | ||
"openapi": "3.0.1", | ||
"info": { | ||
"title": "OpenAPI definition", | ||
"version": "v0" | ||
}, | ||
"servers": [ | ||
{ | ||
"url": "http://localhost", | ||
"description": "Generated server url" | ||
} | ||
], | ||
"paths": { | ||
"/test/test": { | ||
"post": { | ||
"tags": [ | ||
"test-controller" | ||
], | ||
"operationId": "create", | ||
"requestBody": { | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"$ref": "#/components/schemas/SomeDTO" | ||
} | ||
} | ||
}, | ||
"required": true | ||
}, | ||
"responses": { | ||
"200": { | ||
"description": "OK" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"components": { | ||
"schemas": { | ||
"KeyValue": { | ||
"required": [ | ||
"key", | ||
"value" | ||
], | ||
"type": "object", | ||
"description": "Generic description", | ||
"allOf": [ | ||
{ | ||
"$ref": "#/components/schemas/KeyValue" | ||
}, | ||
{ | ||
"type": "object", | ||
"properties": { | ||
"key": { | ||
"type": "string" | ||
}, | ||
"value": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
"SomeDTO": { | ||
"required": [ | ||
"field_a", | ||
"field_b" | ||
], | ||
"type": "object", | ||
"properties": { | ||
"field_a": { | ||
"$ref": "#/components/schemas/KeyValue" | ||
}, | ||
"field_b": { | ||
"$ref": "#/components/schemas/KeyValue" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |