[Spring] Add an option to return success code (#1197)

* Returns status code which defined at Response Object

* Tweak indent

Remove the spacer "{{#async}} ... {{/async}}" "{{^async}} ... {{/async}}"

* Update samples^

* Fix broken indentation

* Update samples

* Revert methodBody.mustache

* Revert "Fix broken indentation"
  * This reverts commit 95b6a00f8b1d92a65e0d4467b5c4f034a9579e43.
* Revert "Tweak indent"
  * This reverts commit ba2cedc89723ed480e8282c0a4e07ab2d3670262.
* Revert "Returns status code which defined at Response Object"
  * This reverts commit f676a89e230dde6741aa96d7b2e27e04b35dbf5a.

* Example contains status code

* Update samples

./bin/spring-all-pestore.sh

* Fix syntax error

* Update samples

* Run bin/utils/ensure-up-to-date

* Make the changes an option `returnSuccessCode`

* Run bin/spring-all-pestore.sh to update samples

* Run ./bin/utils/export_docs_generators.sh
This commit is contained in:
Akihito Nakano 2018-11-29 11:51:25 +09:00 committed by GitHub
parent 777bf1f3aa
commit f7c857cc39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 78 additions and 41 deletions

View File

@ -170,6 +170,9 @@ CONFIG OPTIONS for spring
hateoas
Use Spring HATEOAS library to allow adding HATEOAS links (Default: false)
returnSuccessCode
Generated server returns 2xx code (Default: false)
library
library template (sub-template) to use (Default: spring-boot)
spring-boot - Spring-boot Server application using the SpringFox integration.

View File

@ -2365,7 +2365,13 @@ public class DefaultCodegen implements CodegenConfig {
}
// generate examples
op.examples = new ExampleGenerator(schemas, openAPI).generateFromResponseSchema(responseSchema, getProducesInfo(openAPI, operation));
String exampleStatusCode = "200";
for (String key : operation.getResponses().keySet()) {
if (operation.getResponses().get(key) == methodResponse && !key.equals("default")) {
exampleStatusCode = key;
}
}
op.examples = new ExampleGenerator(schemas, openAPI).generateFromResponseSchema(exampleStatusCode, responseSchema, getProducesInfo(openAPI, operation));
op.defaultResponse = toDefaultValue(responseSchema);
op.returnType = cm.dataType;
op.hasReference = schemas != null && schemas.containsKey(op.returnBaseType);

View File

@ -42,6 +42,7 @@ public class ExampleGenerator {
private static final String NONE = "none";
private static final String URL = "url";
private static final String URI = "uri";
private static final String STATUS_CODE = "statusCode";
protected Map<String, Schema> examples;
private OpenAPI openAPI;
@ -54,7 +55,20 @@ public class ExampleGenerator {
this.random = new Random("ExampleGenerator".hashCode());
}
public List<Map<String, String>> generateFromResponseSchema(Schema responseSchema, Set<String> producesInfo) {
public List<Map<String, String>> generateFromResponseSchema(String statusCode, Schema responseSchema, Set<String> producesInfo) {
List<Map<String, String>> examples = generateFromResponseSchema(responseSchema, producesInfo);
if (examples == null) {
return null;
}
for (Map<String, String> example : examples) {
example.put(STATUS_CODE, statusCode);
}
return examples;
}
private List<Map<String, String>> generateFromResponseSchema(Schema responseSchema, Set<String> producesInfo) {
if (responseSchema.getExample() == null && StringUtils.isEmpty(responseSchema.get$ref()) && !ModelUtils.isArraySchema(responseSchema)) {
// no example provided
return null;

View File

@ -77,6 +77,7 @@ public class SpringCodegen extends AbstractJavaCodegen
public static final String OPENAPI_DOCKET_CONFIG = "swaggerDocketConfig";
public static final String API_FIRST = "apiFirst";
public static final String HATEOAS = "hateoas";
public static final String RETURN_SUCCESS_CODE = "returnSuccessCode";
protected String title = "OpenAPI Spring";
protected String configPackage = "org.openapitools.configuration";
@ -98,6 +99,7 @@ public class SpringCodegen extends AbstractJavaCodegen
protected boolean useOptional = false;
protected boolean virtualService = false;
protected boolean hateoas = false;
protected boolean returnSuccessCode = false;
public SpringCodegen() {
super();
@ -131,6 +133,7 @@ public class SpringCodegen extends AbstractJavaCodegen
cliOptions.add(CliOption.newBoolean(API_FIRST, "Generate the API from the OAI spec at server compile time (API first approach)", apiFirst));
cliOptions.add(CliOption.newBoolean(USE_OPTIONAL,"Use Optional container for optional parameters", useOptional));
cliOptions.add(CliOption.newBoolean(HATEOAS, "Use Spring HATEOAS library to allow adding HATEOAS links", hateoas));
cliOptions.add(CliOption.newBoolean(RETURN_SUCCESS_CODE, "Generated server returns 2xx code", returnSuccessCode));
supportedLibraries.put(SPRING_BOOT, "Spring-boot Server application using the SpringFox integration.");
supportedLibraries.put(SPRING_MVC_LIBRARY, "Spring-MVC Server application using the SpringFox integration.");
@ -277,6 +280,10 @@ public class SpringCodegen extends AbstractJavaCodegen
this.setHateoas(Boolean.valueOf(additionalProperties.get(HATEOAS).toString()));
}
if (additionalProperties.containsKey(RETURN_SUCCESS_CODE)) {
this.setReturnSuccessCode(Boolean.valueOf(additionalProperties.get(RETURN_SUCCESS_CODE).toString()));
}
typeMapping.put("file", "Resource");
importMapping.put("Resource", "org.springframework.core.io.Resource");
@ -721,6 +728,10 @@ public class SpringCodegen extends AbstractJavaCodegen
this.hateoas = hateoas;
}
public void setReturnSuccessCode(boolean returnSuccessCode) {
this.returnSuccessCode = returnSuccessCode;
}
@Override
public void postProcessModelProperty(CodegenModel model, CodegenProperty property) {
super.postProcessModelProperty(model, property);

View File

@ -16,7 +16,7 @@ return CompletableFuture.supplyAsync(()-> {
{{#jdk8}}
{{#async}} {{/async}} });
{{/jdk8}}
{{#async}} {{/async}} return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
{{#async}} {{/async}} return new ResponseEntity<>({{#returnSuccessCode}}HttpStatus.valueOf({{{statusCode}}}){{/returnSuccessCode}}{{^returnSuccessCode}}HttpStatus.NOT_IMPLEMENTED{{/returnSuccessCode}});
{{#jdk8}}
{{#async}}
}, Runnable::run);
@ -25,14 +25,14 @@ return CompletableFuture.supplyAsync(()-> {
{{/-last}}
{{/examples}}
{{^examples}}
return {{#jdk8}}{{#async}}CompletableFuture.completedFuture({{/async}}{{/jdk8}}new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED){{#jdk8}}{{#async}}){{/async}}{{/jdk8}};
return {{#jdk8}}{{#async}}CompletableFuture.completedFuture({{/async}}{{/jdk8}}new ResponseEntity<>({{#returnSuccessCode}}HttpStatus.OK{{/returnSuccessCode}}{{^returnSuccessCode}}HttpStatus.NOT_IMPLEMENTED{{/returnSuccessCode}}){{#jdk8}}{{#async}}){{/async}}{{/jdk8}};
{{/examples}}
{{/reactive}}
{{#reactive}}
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
Mono<Void> result = Mono.empty();
Mono<Void> result = Mono.empty();
{{#examples}}
{{#-first}}
exchange.getResponse().setStatusCode({{#returnSuccessCode}}HttpStatus.valueOf({{{statusCode}}}){{/returnSuccessCode}}{{^returnSuccessCode}}HttpStatus.NOT_IMPLEMENTED{{/returnSuccessCode}});
for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) {
{{/-first}}
if (mediaType.isCompatibleWith(MediaType.valueOf("{{{contentType}}}"))) {
@ -43,5 +43,8 @@ exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
}
{{/-last}}
{{/examples}}
{{^examples}}
exchange.getResponse().setStatusCode({{#returnSuccessCode}}HttpStatus.OK{{/returnSuccessCode}}{{^returnSuccessCode}}HttpStatus.NOT_IMPLEMENTED{{/returnSuccessCode}});
{{/examples}}
return result.then(Mono.empty());
{{/reactive}}

View File

@ -31,8 +31,8 @@ public interface AnotherFakeApiDelegate {
*/
default Mono<ResponseEntity<Client>> call123testSpecialTags(Mono<Client> client,
ServerWebExchange exchange) {
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
Mono<Void> result = Mono.empty();
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
result = ApiUtil.getExampleResponse(exchange, "{ \"client\" : \"client\"}");

View File

@ -40,8 +40,8 @@ public interface FakeApiDelegate {
*/
default Mono<ResponseEntity<Boolean>> fakeOuterBooleanSerialize(Mono<Boolean> body,
ServerWebExchange exchange) {
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
Mono<Void> result = Mono.empty();
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
return result.then(Mono.empty());
}
@ -51,8 +51,8 @@ public interface FakeApiDelegate {
*/
default Mono<ResponseEntity<OuterComposite>> fakeOuterCompositeSerialize(Mono<OuterComposite> outerComposite,
ServerWebExchange exchange) {
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
Mono<Void> result = Mono.empty();
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) {
if (mediaType.isCompatibleWith(MediaType.valueOf("*/*"))) {
result = ApiUtil.getExampleResponse(exchange, "{ \"my_string\" : \"my_string\", \"my_number\" : 0.80082819046101150206595775671303272247314453125, \"my_boolean\" : true}");
@ -68,8 +68,8 @@ public interface FakeApiDelegate {
*/
default Mono<ResponseEntity<BigDecimal>> fakeOuterNumberSerialize(Mono<BigDecimal> body,
ServerWebExchange exchange) {
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
Mono<Void> result = Mono.empty();
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
return result.then(Mono.empty());
}
@ -79,8 +79,8 @@ public interface FakeApiDelegate {
*/
default Mono<ResponseEntity<String>> fakeOuterStringSerialize(Mono<String> body,
ServerWebExchange exchange) {
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
Mono<Void> result = Mono.empty();
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
return result.then(Mono.empty());
}
@ -90,8 +90,8 @@ public interface FakeApiDelegate {
*/
default Mono<ResponseEntity<Void>> testBodyWithFileSchema(Mono<FileSchemaTestClass> fileSchemaTestClass,
ServerWebExchange exchange) {
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
Mono<Void> result = Mono.empty();
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
return result.then(Mono.empty());
}
@ -102,8 +102,8 @@ public interface FakeApiDelegate {
default Mono<ResponseEntity<Void>> testBodyWithQueryParams(String query,
Mono<User> user,
ServerWebExchange exchange) {
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
Mono<Void> result = Mono.empty();
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
return result.then(Mono.empty());
}
@ -113,8 +113,8 @@ public interface FakeApiDelegate {
*/
default Mono<ResponseEntity<Client>> testClientModel(Mono<Client> client,
ServerWebExchange exchange) {
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
Mono<Void> result = Mono.empty();
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
result = ApiUtil.getExampleResponse(exchange, "{ \"client\" : \"client\"}");
@ -143,8 +143,8 @@ public interface FakeApiDelegate {
String password,
String paramCallback,
ServerWebExchange exchange) {
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
Mono<Void> result = Mono.empty();
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
return result.then(Mono.empty());
}
@ -161,8 +161,8 @@ public interface FakeApiDelegate {
List<String> enumFormStringArray,
String enumFormString,
ServerWebExchange exchange) {
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
Mono<Void> result = Mono.empty();
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
return result.then(Mono.empty());
}
@ -177,8 +177,8 @@ public interface FakeApiDelegate {
Boolean booleanGroup,
Long int64Group,
ServerWebExchange exchange) {
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
Mono<Void> result = Mono.empty();
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
return result.then(Mono.empty());
}
@ -188,8 +188,8 @@ public interface FakeApiDelegate {
*/
default Mono<ResponseEntity<Void>> testInlineAdditionalProperties(Mono<String> requestBody,
ServerWebExchange exchange) {
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
Mono<Void> result = Mono.empty();
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
return result.then(Mono.empty());
}
@ -200,8 +200,8 @@ public interface FakeApiDelegate {
default Mono<ResponseEntity<Void>> testJsonFormData(String param,
String param2,
ServerWebExchange exchange) {
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
Mono<Void> result = Mono.empty();
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
return result.then(Mono.empty());
}
@ -213,8 +213,8 @@ public interface FakeApiDelegate {
MultipartFile requiredFile,
String additionalMetadata,
ServerWebExchange exchange) {
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
Mono<Void> result = Mono.empty();
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
result = ApiUtil.getExampleResponse(exchange, "{ \"code\" : 0, \"type\" : \"type\", \"message\" : \"message\"}");

View File

@ -31,8 +31,8 @@ public interface FakeClassnameTestApiDelegate {
*/
default Mono<ResponseEntity<Client>> testClassname(Mono<Client> client,
ServerWebExchange exchange) {
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
Mono<Void> result = Mono.empty();
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
result = ApiUtil.getExampleResponse(exchange, "{ \"client\" : \"client\"}");

View File

@ -33,8 +33,8 @@ public interface PetApiDelegate {
*/
default Mono<ResponseEntity<Void>> addPet(Mono<Pet> pet,
ServerWebExchange exchange) {
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
Mono<Void> result = Mono.empty();
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
return result.then(Mono.empty());
}
@ -45,8 +45,8 @@ public interface PetApiDelegate {
default Mono<ResponseEntity<Void>> deletePet(Long petId,
String apiKey,
ServerWebExchange exchange) {
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
Mono<Void> result = Mono.empty();
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
return result.then(Mono.empty());
}
@ -56,8 +56,8 @@ public interface PetApiDelegate {
*/
default Mono<ResponseEntity<Flux<Pet>>> findPetsByStatus(List<String> status,
ServerWebExchange exchange) {
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
Mono<Void> result = Mono.empty();
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
result = ApiUtil.getExampleResponse(exchange, "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}");
@ -77,8 +77,8 @@ public interface PetApiDelegate {
*/
default Mono<ResponseEntity<Flux<Pet>>> findPetsByTags(List<String> tags,
ServerWebExchange exchange) {
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
Mono<Void> result = Mono.empty();
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
result = ApiUtil.getExampleResponse(exchange, "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}");
@ -98,8 +98,8 @@ public interface PetApiDelegate {
*/
default Mono<ResponseEntity<Pet>> getPetById(Long petId,
ServerWebExchange exchange) {
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
Mono<Void> result = Mono.empty();
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
result = ApiUtil.getExampleResponse(exchange, "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}");
@ -119,8 +119,8 @@ public interface PetApiDelegate {
*/
default Mono<ResponseEntity<Void>> updatePet(Mono<Pet> pet,
ServerWebExchange exchange) {
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
Mono<Void> result = Mono.empty();
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
return result.then(Mono.empty());
}
@ -132,8 +132,8 @@ public interface PetApiDelegate {
String name,
String status,
ServerWebExchange exchange) {
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
Mono<Void> result = Mono.empty();
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
return result.then(Mono.empty());
}
@ -145,8 +145,8 @@ public interface PetApiDelegate {
String additionalMetadata,
MultipartFile file,
ServerWebExchange exchange) {
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
Mono<Void> result = Mono.empty();
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
result = ApiUtil.getExampleResponse(exchange, "{ \"code\" : 0, \"type\" : \"type\", \"message\" : \"message\"}");

View File

@ -32,8 +32,8 @@ public interface StoreApiDelegate {
*/
default Mono<ResponseEntity<Void>> deleteOrder(String orderId,
ServerWebExchange exchange) {
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
Mono<Void> result = Mono.empty();
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
return result.then(Mono.empty());
}
@ -42,8 +42,8 @@ public interface StoreApiDelegate {
* @see StoreApi#getInventory
*/
default Mono<ResponseEntity<Map<String, Integer>>> getInventory(ServerWebExchange exchange) {
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
Mono<Void> result = Mono.empty();
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
return result.then(Mono.empty());
}
@ -53,8 +53,8 @@ public interface StoreApiDelegate {
*/
default Mono<ResponseEntity<Order>> getOrderById(Long orderId,
ServerWebExchange exchange) {
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
Mono<Void> result = Mono.empty();
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
result = ApiUtil.getExampleResponse(exchange, "{ \"petId\" : 6, \"quantity\" : 1, \"id\" : 0, \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\", \"complete\" : false, \"status\" : \"placed\"}");
@ -74,8 +74,8 @@ public interface StoreApiDelegate {
*/
default Mono<ResponseEntity<Order>> placeOrder(Mono<Order> order,
ServerWebExchange exchange) {
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
Mono<Void> result = Mono.empty();
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
result = ApiUtil.getExampleResponse(exchange, "{ \"petId\" : 6, \"quantity\" : 1, \"id\" : 0, \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\", \"complete\" : false, \"status\" : \"placed\"}");

View File

@ -32,8 +32,8 @@ public interface UserApiDelegate {
*/
default Mono<ResponseEntity<Void>> createUser(Mono<User> user,
ServerWebExchange exchange) {
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
Mono<Void> result = Mono.empty();
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
return result.then(Mono.empty());
}
@ -43,8 +43,8 @@ public interface UserApiDelegate {
*/
default Mono<ResponseEntity<Void>> createUsersWithArrayInput(Flux<List> user,
ServerWebExchange exchange) {
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
Mono<Void> result = Mono.empty();
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
return result.then(Mono.empty());
}
@ -54,8 +54,8 @@ public interface UserApiDelegate {
*/
default Mono<ResponseEntity<Void>> createUsersWithListInput(Flux<List> user,
ServerWebExchange exchange) {
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
Mono<Void> result = Mono.empty();
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
return result.then(Mono.empty());
}
@ -65,8 +65,8 @@ public interface UserApiDelegate {
*/
default Mono<ResponseEntity<Void>> deleteUser(String username,
ServerWebExchange exchange) {
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
Mono<Void> result = Mono.empty();
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
return result.then(Mono.empty());
}
@ -76,8 +76,8 @@ public interface UserApiDelegate {
*/
default Mono<ResponseEntity<User>> getUserByName(String username,
ServerWebExchange exchange) {
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
Mono<Void> result = Mono.empty();
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
result = ApiUtil.getExampleResponse(exchange, "{ \"firstName\" : \"firstName\", \"lastName\" : \"lastName\", \"password\" : \"password\", \"userStatus\" : 6, \"phone\" : \"phone\", \"id\" : 0, \"email\" : \"email\", \"username\" : \"username\"}");
@ -98,8 +98,8 @@ public interface UserApiDelegate {
default Mono<ResponseEntity<String>> loginUser(String username,
String password,
ServerWebExchange exchange) {
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
Mono<Void> result = Mono.empty();
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
return result.then(Mono.empty());
}
@ -108,8 +108,8 @@ public interface UserApiDelegate {
* @see UserApi#logoutUser
*/
default Mono<ResponseEntity<Void>> logoutUser(ServerWebExchange exchange) {
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
Mono<Void> result = Mono.empty();
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
return result.then(Mono.empty());
}
@ -120,8 +120,8 @@ public interface UserApiDelegate {
default Mono<ResponseEntity<Void>> updateUser(String username,
Mono<User> user,
ServerWebExchange exchange) {
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
Mono<Void> result = Mono.empty();
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
return result.then(Mono.empty());
}