mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-10 10:46:11 +00:00
* fix template for RequestBody, added 'required' attribute (#3134) * update Spring samples (#3134)
This commit is contained in:
committed by
William Cheng
parent
7bd378c026
commit
a9cc96b50f
@@ -66,7 +66,7 @@ public interface FakeApi {
|
||||
@RequestMapping(value = "/fake/outer/boolean",
|
||||
produces = { "*/*" },
|
||||
method = RequestMethod.POST)
|
||||
ResponseEntity<Boolean> fakeOuterBooleanSerialize(@ApiParam(value = "Input boolean as post body" ) @Valid @RequestBody Boolean body);
|
||||
ResponseEntity<Boolean> fakeOuterBooleanSerialize(@ApiParam(value = "Input boolean as post body" ) @Valid @RequestBody(required = false) Boolean body);
|
||||
|
||||
|
||||
/**
|
||||
@@ -82,7 +82,7 @@ public interface FakeApi {
|
||||
@RequestMapping(value = "/fake/outer/composite",
|
||||
produces = { "*/*" },
|
||||
method = RequestMethod.POST)
|
||||
ResponseEntity<OuterComposite> fakeOuterCompositeSerialize(@ApiParam(value = "Input composite as post body" ) @Valid @RequestBody OuterComposite body);
|
||||
ResponseEntity<OuterComposite> fakeOuterCompositeSerialize(@ApiParam(value = "Input composite as post body" ) @Valid @RequestBody(required = false) OuterComposite body);
|
||||
|
||||
|
||||
/**
|
||||
@@ -98,7 +98,7 @@ public interface FakeApi {
|
||||
@RequestMapping(value = "/fake/outer/number",
|
||||
produces = { "*/*" },
|
||||
method = RequestMethod.POST)
|
||||
ResponseEntity<BigDecimal> fakeOuterNumberSerialize(@ApiParam(value = "Input number as post body" ) @Valid @RequestBody BigDecimal body);
|
||||
ResponseEntity<BigDecimal> fakeOuterNumberSerialize(@ApiParam(value = "Input number as post body" ) @Valid @RequestBody(required = false) BigDecimal body);
|
||||
|
||||
|
||||
/**
|
||||
@@ -114,7 +114,7 @@ public interface FakeApi {
|
||||
@RequestMapping(value = "/fake/outer/string",
|
||||
produces = { "*/*" },
|
||||
method = RequestMethod.POST)
|
||||
ResponseEntity<String> fakeOuterStringSerialize(@ApiParam(value = "Input string as post body" ) @Valid @RequestBody String body);
|
||||
ResponseEntity<String> fakeOuterStringSerialize(@ApiParam(value = "Input string as post body" ) @Valid @RequestBody(required = false) String body);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -62,7 +62,7 @@ public class FakeApiController implements FakeApi {
|
||||
* @return Output boolean (status code 200)
|
||||
* @see FakeApi#fakeOuterBooleanSerialize
|
||||
*/
|
||||
public ResponseEntity<Boolean> fakeOuterBooleanSerialize(@ApiParam(value = "Input boolean as post body" ) @Valid @RequestBody Boolean body) {
|
||||
public ResponseEntity<Boolean> fakeOuterBooleanSerialize(@ApiParam(value = "Input boolean as post body" ) @Valid @RequestBody(required = false) Boolean body) {
|
||||
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
|
||||
|
||||
}
|
||||
@@ -75,7 +75,7 @@ public class FakeApiController implements FakeApi {
|
||||
* @return Output composite (status code 200)
|
||||
* @see FakeApi#fakeOuterCompositeSerialize
|
||||
*/
|
||||
public ResponseEntity<OuterComposite> fakeOuterCompositeSerialize(@ApiParam(value = "Input composite as post body" ) @Valid @RequestBody OuterComposite body) {
|
||||
public ResponseEntity<OuterComposite> fakeOuterCompositeSerialize(@ApiParam(value = "Input composite as post body" ) @Valid @RequestBody(required = false) OuterComposite body) {
|
||||
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
|
||||
if (mediaType.isCompatibleWith(MediaType.valueOf("*/*"))) {
|
||||
String exampleString = "{ \"my_string\" : \"my_string\", \"my_number\" : 0.8008281904610115, \"my_boolean\" : true }";
|
||||
@@ -95,7 +95,7 @@ public class FakeApiController implements FakeApi {
|
||||
* @return Output number (status code 200)
|
||||
* @see FakeApi#fakeOuterNumberSerialize
|
||||
*/
|
||||
public ResponseEntity<BigDecimal> fakeOuterNumberSerialize(@ApiParam(value = "Input number as post body" ) @Valid @RequestBody BigDecimal body) {
|
||||
public ResponseEntity<BigDecimal> fakeOuterNumberSerialize(@ApiParam(value = "Input number as post body" ) @Valid @RequestBody(required = false) BigDecimal body) {
|
||||
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
|
||||
|
||||
}
|
||||
@@ -108,7 +108,7 @@ public class FakeApiController implements FakeApi {
|
||||
* @return Output string (status code 200)
|
||||
* @see FakeApi#fakeOuterStringSerialize
|
||||
*/
|
||||
public ResponseEntity<String> fakeOuterStringSerialize(@ApiParam(value = "Input string as post body" ) @Valid @RequestBody String body) {
|
||||
public ResponseEntity<String> fakeOuterStringSerialize(@ApiParam(value = "Input string as post body" ) @Valid @RequestBody(required = false) String body) {
|
||||
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user