-
-
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.
Support returning null in ParameterCustomizer/ Fixes #2822
- Loading branch information
1 parent
39ef9f4
commit 915a071
Showing
6 changed files
with
206 additions
and
6 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
40 changes: 40 additions & 0 deletions
40
...i-starter-webmvc-api/src/test/java/test/org/springdoc/api/v30/app234/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,40 @@ | ||
/* | ||
* | ||
* * | ||
* * * | ||
* * * * | ||
* * * * * Copyright 2019-2024 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.v30.app234; | ||
|
||
import test.org.springdoc.api.v30.app179.MyObj; | ||
|
||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
|
||
@RestController | ||
public class HelloController { | ||
|
||
@GetMapping("/test") | ||
String test(MyObj obj) { | ||
return obj.getContent(); | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
...doc-openapi-starter-webmvc-api/src/test/java/test/org/springdoc/api/v30/app234/MyObj.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,44 @@ | ||
/* | ||
* | ||
* * | ||
* * * | ||
* * * * | ||
* * * * * Copyright 2019-2024 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.v30.app234; | ||
|
||
public class MyObj { | ||
private final String id; | ||
|
||
private final String content; | ||
|
||
public MyObj(String id, String content) { | ||
this.id = id; | ||
this.content = content; | ||
} | ||
|
||
public String getId() { | ||
return id; | ||
} | ||
|
||
public String getContent() { | ||
return content; | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
...webmvc-api/src/test/java/test/org/springdoc/api/v30/app234/MyPathParameterCustomizer.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,39 @@ | ||
/* | ||
* | ||
* * | ||
* * * | ||
* * * * | ||
* * * * * Copyright 2019-2024 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.v30.app234; | ||
|
||
import io.swagger.v3.oas.models.parameters.Parameter; | ||
import org.springdoc.core.customizers.ParameterCustomizer; | ||
|
||
import org.springframework.core.MethodParameter; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class MyPathParameterCustomizer implements ParameterCustomizer { | ||
@Override | ||
public Parameter customize(Parameter parameterModel, MethodParameter methodParameter) { | ||
return null; | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
...arter-webmvc-api/src/test/java/test/org/springdoc/api/v30/app234/SpringDocApp234Test.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,35 @@ | ||
/* | ||
* | ||
* * | ||
* * * | ||
* * * * | ||
* * * * * Copyright 2019-2024 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.v30.app234; | ||
|
||
import test.org.springdoc.api.v30.AbstractSpringDocV30Test; | ||
|
||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
||
public class SpringDocApp234Test extends AbstractSpringDocV30Test { | ||
|
||
@SpringBootApplication | ||
static class SpringDocTestApp {} | ||
} |
38 changes: 38 additions & 0 deletions
38
springdoc-openapi-starter-webmvc-api/src/test/resources/results/3.0.1/app234.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,38 @@ | ||
{ | ||
"openapi": "3.0.1", | ||
"info": { | ||
"title": "OpenAPI definition", | ||
"version": "v0" | ||
}, | ||
"servers": [ | ||
{ | ||
"url": "http://localhost", | ||
"description": "Generated server url" | ||
} | ||
], | ||
"paths": { | ||
"/test": { | ||
"get": { | ||
"tags": [ | ||
"hello-controller" | ||
], | ||
"operationId": "test", | ||
"responses": { | ||
"200": { | ||
"description": "OK", | ||
"content": { | ||
"*/*": { | ||
"schema": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"components": { | ||
"schemas": {} | ||
} | ||
} |