-
-
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 'uc4w6c-fix_npe_request_body_service'
- Loading branch information
Showing
5 changed files
with
174 additions
and
1 deletion.
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
45 changes: 45 additions & 0 deletions
45
...est/java/test/org/springdoc/api/app168/DescriptionFieldInRequestBodyIsNullController.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,45 @@ | ||
/* | ||
* | ||
* * 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.app168; | ||
|
||
import io.swagger.v3.oas.annotations.media.Content; | ||
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; | ||
|
||
/** | ||
* If the RequestBody description field is null, get the description from the javadoc. | ||
*/ | ||
@RestController | ||
@RequestMapping("description-in-requestbody-is-null") | ||
public class DescriptionFieldInRequestBodyIsNullController { | ||
|
||
/** | ||
* Person person. | ||
* | ||
* @param person the person | ||
*/ | ||
@PostMapping | ||
public void person( | ||
@io.swagger.v3.oas.annotations.parameters.RequestBody(content = @Content(schema = @Schema(implementation = Person.class))) @RequestBody Person person) { | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
springdoc-openapi-javadoc/src/test/java/test/org/springdoc/api/app168/Person.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,29 @@ | ||
package test.org.springdoc.api.app168; | ||
|
||
/** | ||
* The type Person. | ||
*/ | ||
public class Person { | ||
/** | ||
* The Id. | ||
*/ | ||
private long id; | ||
|
||
/** | ||
* Gets id. | ||
* | ||
* @return the id | ||
*/ | ||
public long getId() { | ||
return id; | ||
} | ||
|
||
/** | ||
* Sets id. | ||
* | ||
* @param id the id | ||
*/ | ||
public void setId(long id) { | ||
this.id = id; | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
...gdoc-openapi-javadoc/src/test/java/test/org/springdoc/api/app168/SpringDocApp168Test.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,36 @@ | ||
/* | ||
* | ||
* * 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.app168; | ||
|
||
import test.org.springdoc.api.AbstractSpringDocTest; | ||
|
||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
||
/** | ||
* The type Spring doc app 168 test. | ||
*/ | ||
public class SpringDocApp168Test extends AbstractSpringDocTest { | ||
|
||
/** | ||
* The type Spring doc test app. | ||
*/ | ||
@SpringBootApplication | ||
static class SpringDocTestApp { | ||
} | ||
} |
63 changes: 63 additions & 0 deletions
63
springdoc-openapi-javadoc/src/test/resources/results/app168.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,63 @@ | ||
{ | ||
"openapi": "3.0.1", | ||
"info": { | ||
"title": "OpenAPI definition", | ||
"version": "v0" | ||
}, | ||
"servers": [ | ||
{ | ||
"url": "http://localhost", | ||
"description": "Generated server url" | ||
} | ||
], | ||
"tags": [ | ||
{ | ||
"name": "description-field-in-request-body-is-null-controller", | ||
"description": "If the RequestBody description field is null, get the description from the javadoc." | ||
} | ||
], | ||
"paths": { | ||
"/description-in-requestbody-is-null": { | ||
"post": { | ||
"tags": [ | ||
"description-field-in-request-body-is-null-controller" | ||
], | ||
"operationId": "person", | ||
"summary": "Person person.", | ||
"description": "Person person.", | ||
"operationId": "person", | ||
"requestBody": { | ||
"description": "the person", | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"$ref": "#/components/schemas/Person" | ||
} | ||
} | ||
}, | ||
"required": true | ||
}, | ||
"responses": { | ||
"200": { | ||
"description": "OK" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"components": { | ||
"schemas": { | ||
"Person": { | ||
"type": "object", | ||
"properties": { | ||
"id": { | ||
"type": "integer", | ||
"description": "The Id.", | ||
"format": "int64" | ||
} | ||
}, | ||
"description": "The type Person." | ||
} | ||
} | ||
} | ||
} |