-
-
Notifications
You must be signed in to change notification settings - Fork 501
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
All request parameters marked as required for Java controllers in mix…
…ed projects in 2.0.3. Fixes #2170
- Loading branch information
1 parent
57fb0f6
commit a70f518
Showing
5 changed files
with
116 additions
and
9 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
20 changes: 20 additions & 0 deletions
20
springdoc-openapi-kotlin/src/test/java/test/org/springdoc/api/app21/HelloController.java
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,20 @@ | ||
package test.org.springdoc.api.app21; | ||
|
||
import io.swagger.v3.oas.annotations.Parameter; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
|
||
import org.springframework.http.MediaType; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@Tag(name = "Test") | ||
@RestController | ||
@RequestMapping(value = "/api/v2/test", produces = MediaType.APPLICATION_JSON_VALUE) | ||
public class HelloController { | ||
|
||
@GetMapping("/") | ||
public void greet(@RequestParam(required = false) @Parameter(required = false) final String name) { | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
springdoc-openapi-kotlin/src/test/java/test/org/springdoc/api/app21/SpringDocApp21Test.java
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,37 @@ | ||
/* | ||
* | ||
* * | ||
* * * | ||
* * * * | ||
* * * * * Copyright 2019-2022 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.app21; | ||
import test.org.springdoc.api.AbstractSpringDocTest; | ||
|
||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
import org.springframework.context.annotation.ComponentScan; | ||
|
||
|
||
public class SpringDocApp21Test extends AbstractSpringDocTest { | ||
|
||
@SpringBootApplication | ||
@ComponentScan(basePackages = { "org.springdoc", "test.org.springdoc.api.app21" }) | ||
static class SpringDocTestApp {} | ||
} |
39 changes: 39 additions & 0 deletions
39
springdoc-openapi-kotlin/src/test/resources/results/app21.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,39 @@ | ||
{ | ||
"openapi": "3.0.1", | ||
"info": { | ||
"title": "OpenAPI definition", | ||
"version": "v0" | ||
}, | ||
"servers": [ | ||
{ | ||
"url": "", | ||
"description": "Generated server url" | ||
} | ||
], | ||
"paths": { | ||
"/api/v2/test/": { | ||
"get": { | ||
"tags": [ | ||
"Test" | ||
], | ||
"operationId": "greet", | ||
"parameters": [ | ||
{ | ||
"name": "name", | ||
"in": "query", | ||
"required": false, | ||
"schema": { | ||
"type": "string" | ||
} | ||
} | ||
], | ||
"responses": { | ||
"200": { | ||
"description": "OK" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"components": {} | ||
} |