forked from loafle/openapi-generator-original
		
	[Java][library: vertx] Add default value and required parameter support to vertx server temp… (#7410)
* Add default value and required parameter support to vertx server templates. Fix for #7409. * Added missing serviceId declaration to workaround #allParams section clearing the vendorExtensions map
This commit is contained in:
		
							parent
							
								
									ef832e7157
								
							
						
					
					
						commit
						59ff4c198b
					
				@ -37,23 +37,61 @@ public class {{classname}}Verticle extends AbstractVerticle {
 | 
			
		||||
        //Consumer for {{#vendorExtensions}}{{x-serviceid}}{{/vendorExtensions}}
 | 
			
		||||
        vertx.eventBus().<JsonObject> consumer({{#vendorExtensions}}{{x-serviceid-varname}}{{/vendorExtensions}}).handler(message -> {
 | 
			
		||||
            try {
 | 
			
		||||
                // Workaround for #allParams section clearing the vendorExtensions map
 | 
			
		||||
                String serviceId = "{{#vendorExtensions}}{{x-serviceid}}{{/vendorExtensions}}";
 | 
			
		||||
                {{#hasParams}}
 | 
			
		||||
                    {{#allParams}}
 | 
			
		||||
                        {{#isListContainer}}
 | 
			
		||||
                {{{dataType}}} {{paramName}} = Json.mapper.readValue(message.body().getJsonArray("{{baseName}}").encode(),
 | 
			
		||||
                        Json.mapper.getTypeFactory().constructCollectionType(List.class, {{{baseType}}}.class));
 | 
			
		||||
                JsonArray {{paramName}}Param = message.body().getJsonArray("{{baseName}}");
 | 
			
		||||
                {{#required}}
 | 
			
		||||
                if({{paramName}}Param == null) {
 | 
			
		||||
                    manageError(message, new MainApiException(400, "{{baseName}} is required"), serviceId);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                {{{dataType}}} {{paramName}} = Json.mapper.readValue({{paramName}}Param.encode(),
 | 
			
		||||
                    Json.mapper.getTypeFactory().constructCollectionType(List.class, {{{baseType}}}.class));
 | 
			
		||||
                {{/required}}
 | 
			
		||||
                {{^required}}
 | 
			
		||||
                {{{dataType}}} {{paramName}} = ({{paramName}}Param == null) ? {{#defaultValue}}{{defaultValue}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}} : Json.mapper.readValue({{paramName}}Param.encode(),
 | 
			
		||||
                    Json.mapper.getTypeFactory().constructCollectionType(List.class, {{{baseType}}}.class));
 | 
			
		||||
                {{/required}}
 | 
			
		||||
                        {{/isListContainer}}
 | 
			
		||||
                        {{^isListContainer}}
 | 
			
		||||
                            {{#isPrimitiveType}}
 | 
			
		||||
                                {{#isString}}
 | 
			
		||||
                {{{dataType}}} {{paramName}} = message.body().getString("{{baseName}}");
 | 
			
		||||
                String {{paramName}}Param = message.body().getString("{{baseName}}");
 | 
			
		||||
                {{#required}}
 | 
			
		||||
                if({{paramName}}Param == null) {
 | 
			
		||||
                    manageError(message, new MainApiException(400, "{{baseName}} is required"), serviceId);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                {{{dataType}}} {{paramName}} = {{paramName}}Param;
 | 
			
		||||
                {{/required}}
 | 
			
		||||
                {{^required}}
 | 
			
		||||
                {{{dataType}}} {{paramName}} = ({{paramName}}Param == null) ? {{#defaultValue}}{{defaultValue}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}} : {{paramName}}Param;
 | 
			
		||||
                {{/required}}
 | 
			
		||||
                                {{/isString}}
 | 
			
		||||
                                {{^isString}}
 | 
			
		||||
                {{{dataType}}} {{paramName}} = Json.mapper.readValue(message.body().getString("{{baseName}}"), {{{dataType}}}.class);
 | 
			
		||||
                String {{paramName}}Param = message.body().getString("{{baseName}}");
 | 
			
		||||
                {{#required}}
 | 
			
		||||
                if({{paramName}}Param == null) {
 | 
			
		||||
                    manageError(message, new MainApiException(400, "{{baseName}} is required"), serviceId);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                {{{dataType}}} {{paramName}} = Json.mapper.readValue({{paramName}}Param, {{{dataType}}}.class);
 | 
			
		||||
                {{/required}}
 | 
			
		||||
                {{^required}}
 | 
			
		||||
                {{{dataType}}} {{paramName}} = ({{paramName}}Param == null) ? {{#defaultValue}}{{defaultValue}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}} : Json.mapper.readValue({{paramName}}Param, {{{dataType}}}.class);
 | 
			
		||||
                {{/required}}
 | 
			
		||||
                                {{/isString}}
 | 
			
		||||
                            {{/isPrimitiveType}}
 | 
			
		||||
                            {{^isPrimitiveType}}
 | 
			
		||||
                {{{dataType}}} {{paramName}} = Json.mapper.readValue(message.body().getJsonObject("{{baseName}}").encode(), {{{dataType}}}.class);
 | 
			
		||||
                JsonObject {{paramName}}Param = message.body().getJsonObject("{{baseName}}");
 | 
			
		||||
                if ({{paramName}}Param == null) {
 | 
			
		||||
                    manageError(message, new MainApiException(400, "{{baseName}} is required"), serviceId);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                {{{dataType}}} {{paramName}} = Json.mapper.readValue({{paramName}}Param.encode(), {{{dataType}}}.class);
 | 
			
		||||
                            {{/isPrimitiveType}}
 | 
			
		||||
                        {{/isListContainer}}
 | 
			
		||||
                    {{/allParams}}
 | 
			
		||||
 | 
			
		||||
@ -1 +1 @@
 | 
			
		||||
2.3.1-SNAPSHOT
 | 
			
		||||
2.3.1
 | 
			
		||||
@ -46,7 +46,14 @@ public class PetApiVerticle extends AbstractVerticle {
 | 
			
		||||
        //Consumer for addPet
 | 
			
		||||
        vertx.eventBus().<JsonObject> consumer(ADDPET_SERVICE_ID).handler(message -> {
 | 
			
		||||
            try {
 | 
			
		||||
                Pet body = Json.mapper.readValue(message.body().getJsonObject("body").encode(), Pet.class);
 | 
			
		||||
                // Workaround for #allParams section clearing the vendorExtensions map
 | 
			
		||||
                String serviceId = "addPet";
 | 
			
		||||
                JsonObject bodyParam = message.body().getJsonObject("body");
 | 
			
		||||
                if (bodyParam == null) {
 | 
			
		||||
                    manageError(message, new MainApiException(400, "body is required"), serviceId);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                Pet body = Json.mapper.readValue(bodyParam.encode(), Pet.class);
 | 
			
		||||
                service.addPet(body, result -> {
 | 
			
		||||
                    if (result.succeeded())
 | 
			
		||||
                        message.reply(null);
 | 
			
		||||
@ -64,8 +71,16 @@ public class PetApiVerticle extends AbstractVerticle {
 | 
			
		||||
        //Consumer for deletePet
 | 
			
		||||
        vertx.eventBus().<JsonObject> consumer(DELETEPET_SERVICE_ID).handler(message -> {
 | 
			
		||||
            try {
 | 
			
		||||
                Long petId = Json.mapper.readValue(message.body().getString("petId"), Long.class);
 | 
			
		||||
                String apiKey = message.body().getString("api_key");
 | 
			
		||||
                // Workaround for #allParams section clearing the vendorExtensions map
 | 
			
		||||
                String serviceId = "deletePet";
 | 
			
		||||
                String petIdParam = message.body().getString("petId");
 | 
			
		||||
                if(petIdParam == null) {
 | 
			
		||||
                    manageError(message, new MainApiException(400, "petId is required"), serviceId);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                Long petId = Json.mapper.readValue(petIdParam, Long.class);
 | 
			
		||||
                String apiKeyParam = message.body().getString("api_key");
 | 
			
		||||
                String apiKey = (apiKeyParam == null) ? null : apiKeyParam;
 | 
			
		||||
                service.deletePet(petId, apiKey, result -> {
 | 
			
		||||
                    if (result.succeeded())
 | 
			
		||||
                        message.reply(null);
 | 
			
		||||
@ -83,8 +98,15 @@ public class PetApiVerticle extends AbstractVerticle {
 | 
			
		||||
        //Consumer for findPetsByStatus
 | 
			
		||||
        vertx.eventBus().<JsonObject> consumer(FINDPETSBYSTATUS_SERVICE_ID).handler(message -> {
 | 
			
		||||
            try {
 | 
			
		||||
                List<String> status = Json.mapper.readValue(message.body().getJsonArray("status").encode(),
 | 
			
		||||
                        Json.mapper.getTypeFactory().constructCollectionType(List.class, String.class));
 | 
			
		||||
                // Workaround for #allParams section clearing the vendorExtensions map
 | 
			
		||||
                String serviceId = "findPetsByStatus";
 | 
			
		||||
                JsonArray statusParam = message.body().getJsonArray("status");
 | 
			
		||||
                if(statusParam == null) {
 | 
			
		||||
                    manageError(message, new MainApiException(400, "status is required"), serviceId);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                List<String> status = Json.mapper.readValue(statusParam.encode(),
 | 
			
		||||
                    Json.mapper.getTypeFactory().constructCollectionType(List.class, String.class));
 | 
			
		||||
                service.findPetsByStatus(status, result -> {
 | 
			
		||||
                    if (result.succeeded())
 | 
			
		||||
                        message.reply(new JsonArray(Json.encode(result.result())).encodePrettily());
 | 
			
		||||
@ -102,8 +124,15 @@ public class PetApiVerticle extends AbstractVerticle {
 | 
			
		||||
        //Consumer for findPetsByTags
 | 
			
		||||
        vertx.eventBus().<JsonObject> consumer(FINDPETSBYTAGS_SERVICE_ID).handler(message -> {
 | 
			
		||||
            try {
 | 
			
		||||
                List<String> tags = Json.mapper.readValue(message.body().getJsonArray("tags").encode(),
 | 
			
		||||
                        Json.mapper.getTypeFactory().constructCollectionType(List.class, String.class));
 | 
			
		||||
                // Workaround for #allParams section clearing the vendorExtensions map
 | 
			
		||||
                String serviceId = "findPetsByTags";
 | 
			
		||||
                JsonArray tagsParam = message.body().getJsonArray("tags");
 | 
			
		||||
                if(tagsParam == null) {
 | 
			
		||||
                    manageError(message, new MainApiException(400, "tags is required"), serviceId);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                List<String> tags = Json.mapper.readValue(tagsParam.encode(),
 | 
			
		||||
                    Json.mapper.getTypeFactory().constructCollectionType(List.class, String.class));
 | 
			
		||||
                service.findPetsByTags(tags, result -> {
 | 
			
		||||
                    if (result.succeeded())
 | 
			
		||||
                        message.reply(new JsonArray(Json.encode(result.result())).encodePrettily());
 | 
			
		||||
@ -121,7 +150,14 @@ public class PetApiVerticle extends AbstractVerticle {
 | 
			
		||||
        //Consumer for getPetById
 | 
			
		||||
        vertx.eventBus().<JsonObject> consumer(GETPETBYID_SERVICE_ID).handler(message -> {
 | 
			
		||||
            try {
 | 
			
		||||
                Long petId = Json.mapper.readValue(message.body().getString("petId"), Long.class);
 | 
			
		||||
                // Workaround for #allParams section clearing the vendorExtensions map
 | 
			
		||||
                String serviceId = "getPetById";
 | 
			
		||||
                String petIdParam = message.body().getString("petId");
 | 
			
		||||
                if(petIdParam == null) {
 | 
			
		||||
                    manageError(message, new MainApiException(400, "petId is required"), serviceId);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                Long petId = Json.mapper.readValue(petIdParam, Long.class);
 | 
			
		||||
                service.getPetById(petId, result -> {
 | 
			
		||||
                    if (result.succeeded())
 | 
			
		||||
                        message.reply(new JsonObject(Json.encode(result.result())).encodePrettily());
 | 
			
		||||
@ -139,7 +175,14 @@ public class PetApiVerticle extends AbstractVerticle {
 | 
			
		||||
        //Consumer for updatePet
 | 
			
		||||
        vertx.eventBus().<JsonObject> consumer(UPDATEPET_SERVICE_ID).handler(message -> {
 | 
			
		||||
            try {
 | 
			
		||||
                Pet body = Json.mapper.readValue(message.body().getJsonObject("body").encode(), Pet.class);
 | 
			
		||||
                // Workaround for #allParams section clearing the vendorExtensions map
 | 
			
		||||
                String serviceId = "updatePet";
 | 
			
		||||
                JsonObject bodyParam = message.body().getJsonObject("body");
 | 
			
		||||
                if (bodyParam == null) {
 | 
			
		||||
                    manageError(message, new MainApiException(400, "body is required"), serviceId);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                Pet body = Json.mapper.readValue(bodyParam.encode(), Pet.class);
 | 
			
		||||
                service.updatePet(body, result -> {
 | 
			
		||||
                    if (result.succeeded())
 | 
			
		||||
                        message.reply(null);
 | 
			
		||||
@ -157,9 +200,18 @@ public class PetApiVerticle extends AbstractVerticle {
 | 
			
		||||
        //Consumer for updatePetWithForm
 | 
			
		||||
        vertx.eventBus().<JsonObject> consumer(UPDATEPETWITHFORM_SERVICE_ID).handler(message -> {
 | 
			
		||||
            try {
 | 
			
		||||
                Long petId = Json.mapper.readValue(message.body().getString("petId"), Long.class);
 | 
			
		||||
                String name = message.body().getString("name");
 | 
			
		||||
                String status = message.body().getString("status");
 | 
			
		||||
                // Workaround for #allParams section clearing the vendorExtensions map
 | 
			
		||||
                String serviceId = "updatePetWithForm";
 | 
			
		||||
                String petIdParam = message.body().getString("petId");
 | 
			
		||||
                if(petIdParam == null) {
 | 
			
		||||
                    manageError(message, new MainApiException(400, "petId is required"), serviceId);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                Long petId = Json.mapper.readValue(petIdParam, Long.class);
 | 
			
		||||
                String nameParam = message.body().getString("name");
 | 
			
		||||
                String name = (nameParam == null) ? null : nameParam;
 | 
			
		||||
                String statusParam = message.body().getString("status");
 | 
			
		||||
                String status = (statusParam == null) ? null : statusParam;
 | 
			
		||||
                service.updatePetWithForm(petId, name, status, result -> {
 | 
			
		||||
                    if (result.succeeded())
 | 
			
		||||
                        message.reply(null);
 | 
			
		||||
@ -177,9 +229,22 @@ public class PetApiVerticle extends AbstractVerticle {
 | 
			
		||||
        //Consumer for uploadFile
 | 
			
		||||
        vertx.eventBus().<JsonObject> consumer(UPLOADFILE_SERVICE_ID).handler(message -> {
 | 
			
		||||
            try {
 | 
			
		||||
                Long petId = Json.mapper.readValue(message.body().getString("petId"), Long.class);
 | 
			
		||||
                String additionalMetadata = message.body().getString("additionalMetadata");
 | 
			
		||||
                File file = Json.mapper.readValue(message.body().getJsonObject("file").encode(), File.class);
 | 
			
		||||
                // Workaround for #allParams section clearing the vendorExtensions map
 | 
			
		||||
                String serviceId = "uploadFile";
 | 
			
		||||
                String petIdParam = message.body().getString("petId");
 | 
			
		||||
                if(petIdParam == null) {
 | 
			
		||||
                    manageError(message, new MainApiException(400, "petId is required"), serviceId);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                Long petId = Json.mapper.readValue(petIdParam, Long.class);
 | 
			
		||||
                String additionalMetadataParam = message.body().getString("additionalMetadata");
 | 
			
		||||
                String additionalMetadata = (additionalMetadataParam == null) ? null : additionalMetadataParam;
 | 
			
		||||
                JsonObject fileParam = message.body().getJsonObject("file");
 | 
			
		||||
                if (fileParam == null) {
 | 
			
		||||
                    manageError(message, new MainApiException(400, "file is required"), serviceId);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                File file = Json.mapper.readValue(fileParam.encode(), File.class);
 | 
			
		||||
                service.uploadFile(petId, additionalMetadata, file, result -> {
 | 
			
		||||
                    if (result.succeeded())
 | 
			
		||||
                        message.reply(new JsonObject(Json.encode(result.result())).encodePrettily());
 | 
			
		||||
 | 
			
		||||
@ -40,7 +40,14 @@ public class StoreApiVerticle extends AbstractVerticle {
 | 
			
		||||
        //Consumer for deleteOrder
 | 
			
		||||
        vertx.eventBus().<JsonObject> consumer(DELETEORDER_SERVICE_ID).handler(message -> {
 | 
			
		||||
            try {
 | 
			
		||||
                String orderId = message.body().getString("orderId");
 | 
			
		||||
                // Workaround for #allParams section clearing the vendorExtensions map
 | 
			
		||||
                String serviceId = "deleteOrder";
 | 
			
		||||
                String orderIdParam = message.body().getString("orderId");
 | 
			
		||||
                if(orderIdParam == null) {
 | 
			
		||||
                    manageError(message, new MainApiException(400, "orderId is required"), serviceId);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                String orderId = orderIdParam;
 | 
			
		||||
                service.deleteOrder(orderId, result -> {
 | 
			
		||||
                    if (result.succeeded())
 | 
			
		||||
                        message.reply(null);
 | 
			
		||||
@ -58,6 +65,8 @@ public class StoreApiVerticle extends AbstractVerticle {
 | 
			
		||||
        //Consumer for getInventory
 | 
			
		||||
        vertx.eventBus().<JsonObject> consumer(GETINVENTORY_SERVICE_ID).handler(message -> {
 | 
			
		||||
            try {
 | 
			
		||||
                // Workaround for #allParams section clearing the vendorExtensions map
 | 
			
		||||
                String serviceId = "getInventory";
 | 
			
		||||
                service.getInventory(result -> {
 | 
			
		||||
                    if (result.succeeded())
 | 
			
		||||
                        message.reply(new JsonObject(Json.encode(result.result())).encodePrettily());
 | 
			
		||||
@ -75,7 +84,14 @@ public class StoreApiVerticle extends AbstractVerticle {
 | 
			
		||||
        //Consumer for getOrderById
 | 
			
		||||
        vertx.eventBus().<JsonObject> consumer(GETORDERBYID_SERVICE_ID).handler(message -> {
 | 
			
		||||
            try {
 | 
			
		||||
                Long orderId = Json.mapper.readValue(message.body().getString("orderId"), Long.class);
 | 
			
		||||
                // Workaround for #allParams section clearing the vendorExtensions map
 | 
			
		||||
                String serviceId = "getOrderById";
 | 
			
		||||
                String orderIdParam = message.body().getString("orderId");
 | 
			
		||||
                if(orderIdParam == null) {
 | 
			
		||||
                    manageError(message, new MainApiException(400, "orderId is required"), serviceId);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                Long orderId = Json.mapper.readValue(orderIdParam, Long.class);
 | 
			
		||||
                service.getOrderById(orderId, result -> {
 | 
			
		||||
                    if (result.succeeded())
 | 
			
		||||
                        message.reply(new JsonObject(Json.encode(result.result())).encodePrettily());
 | 
			
		||||
@ -93,7 +109,14 @@ public class StoreApiVerticle extends AbstractVerticle {
 | 
			
		||||
        //Consumer for placeOrder
 | 
			
		||||
        vertx.eventBus().<JsonObject> consumer(PLACEORDER_SERVICE_ID).handler(message -> {
 | 
			
		||||
            try {
 | 
			
		||||
                Order body = Json.mapper.readValue(message.body().getJsonObject("body").encode(), Order.class);
 | 
			
		||||
                // Workaround for #allParams section clearing the vendorExtensions map
 | 
			
		||||
                String serviceId = "placeOrder";
 | 
			
		||||
                JsonObject bodyParam = message.body().getJsonObject("body");
 | 
			
		||||
                if (bodyParam == null) {
 | 
			
		||||
                    manageError(message, new MainApiException(400, "body is required"), serviceId);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                Order body = Json.mapper.readValue(bodyParam.encode(), Order.class);
 | 
			
		||||
                service.placeOrder(body, result -> {
 | 
			
		||||
                    if (result.succeeded())
 | 
			
		||||
                        message.reply(new JsonObject(Json.encode(result.result())).encodePrettily());
 | 
			
		||||
 | 
			
		||||
@ -44,7 +44,14 @@ public class UserApiVerticle extends AbstractVerticle {
 | 
			
		||||
        //Consumer for createUser
 | 
			
		||||
        vertx.eventBus().<JsonObject> consumer(CREATEUSER_SERVICE_ID).handler(message -> {
 | 
			
		||||
            try {
 | 
			
		||||
                User body = Json.mapper.readValue(message.body().getJsonObject("body").encode(), User.class);
 | 
			
		||||
                // Workaround for #allParams section clearing the vendorExtensions map
 | 
			
		||||
                String serviceId = "createUser";
 | 
			
		||||
                JsonObject bodyParam = message.body().getJsonObject("body");
 | 
			
		||||
                if (bodyParam == null) {
 | 
			
		||||
                    manageError(message, new MainApiException(400, "body is required"), serviceId);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                User body = Json.mapper.readValue(bodyParam.encode(), User.class);
 | 
			
		||||
                service.createUser(body, result -> {
 | 
			
		||||
                    if (result.succeeded())
 | 
			
		||||
                        message.reply(null);
 | 
			
		||||
@ -62,8 +69,15 @@ public class UserApiVerticle extends AbstractVerticle {
 | 
			
		||||
        //Consumer for createUsersWithArrayInput
 | 
			
		||||
        vertx.eventBus().<JsonObject> consumer(CREATEUSERSWITHARRAYINPUT_SERVICE_ID).handler(message -> {
 | 
			
		||||
            try {
 | 
			
		||||
                List<User> body = Json.mapper.readValue(message.body().getJsonArray("body").encode(),
 | 
			
		||||
                        Json.mapper.getTypeFactory().constructCollectionType(List.class, User.class));
 | 
			
		||||
                // Workaround for #allParams section clearing the vendorExtensions map
 | 
			
		||||
                String serviceId = "createUsersWithArrayInput";
 | 
			
		||||
                JsonArray bodyParam = message.body().getJsonArray("body");
 | 
			
		||||
                if(bodyParam == null) {
 | 
			
		||||
                    manageError(message, new MainApiException(400, "body is required"), serviceId);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                List<User> body = Json.mapper.readValue(bodyParam.encode(),
 | 
			
		||||
                    Json.mapper.getTypeFactory().constructCollectionType(List.class, User.class));
 | 
			
		||||
                service.createUsersWithArrayInput(body, result -> {
 | 
			
		||||
                    if (result.succeeded())
 | 
			
		||||
                        message.reply(null);
 | 
			
		||||
@ -81,8 +95,15 @@ public class UserApiVerticle extends AbstractVerticle {
 | 
			
		||||
        //Consumer for createUsersWithListInput
 | 
			
		||||
        vertx.eventBus().<JsonObject> consumer(CREATEUSERSWITHLISTINPUT_SERVICE_ID).handler(message -> {
 | 
			
		||||
            try {
 | 
			
		||||
                List<User> body = Json.mapper.readValue(message.body().getJsonArray("body").encode(),
 | 
			
		||||
                        Json.mapper.getTypeFactory().constructCollectionType(List.class, User.class));
 | 
			
		||||
                // Workaround for #allParams section clearing the vendorExtensions map
 | 
			
		||||
                String serviceId = "createUsersWithListInput";
 | 
			
		||||
                JsonArray bodyParam = message.body().getJsonArray("body");
 | 
			
		||||
                if(bodyParam == null) {
 | 
			
		||||
                    manageError(message, new MainApiException(400, "body is required"), serviceId);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                List<User> body = Json.mapper.readValue(bodyParam.encode(),
 | 
			
		||||
                    Json.mapper.getTypeFactory().constructCollectionType(List.class, User.class));
 | 
			
		||||
                service.createUsersWithListInput(body, result -> {
 | 
			
		||||
                    if (result.succeeded())
 | 
			
		||||
                        message.reply(null);
 | 
			
		||||
@ -100,7 +121,14 @@ public class UserApiVerticle extends AbstractVerticle {
 | 
			
		||||
        //Consumer for deleteUser
 | 
			
		||||
        vertx.eventBus().<JsonObject> consumer(DELETEUSER_SERVICE_ID).handler(message -> {
 | 
			
		||||
            try {
 | 
			
		||||
                String username = message.body().getString("username");
 | 
			
		||||
                // Workaround for #allParams section clearing the vendorExtensions map
 | 
			
		||||
                String serviceId = "deleteUser";
 | 
			
		||||
                String usernameParam = message.body().getString("username");
 | 
			
		||||
                if(usernameParam == null) {
 | 
			
		||||
                    manageError(message, new MainApiException(400, "username is required"), serviceId);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                String username = usernameParam;
 | 
			
		||||
                service.deleteUser(username, result -> {
 | 
			
		||||
                    if (result.succeeded())
 | 
			
		||||
                        message.reply(null);
 | 
			
		||||
@ -118,7 +146,14 @@ public class UserApiVerticle extends AbstractVerticle {
 | 
			
		||||
        //Consumer for getUserByName
 | 
			
		||||
        vertx.eventBus().<JsonObject> consumer(GETUSERBYNAME_SERVICE_ID).handler(message -> {
 | 
			
		||||
            try {
 | 
			
		||||
                String username = message.body().getString("username");
 | 
			
		||||
                // Workaround for #allParams section clearing the vendorExtensions map
 | 
			
		||||
                String serviceId = "getUserByName";
 | 
			
		||||
                String usernameParam = message.body().getString("username");
 | 
			
		||||
                if(usernameParam == null) {
 | 
			
		||||
                    manageError(message, new MainApiException(400, "username is required"), serviceId);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                String username = usernameParam;
 | 
			
		||||
                service.getUserByName(username, result -> {
 | 
			
		||||
                    if (result.succeeded())
 | 
			
		||||
                        message.reply(new JsonObject(Json.encode(result.result())).encodePrettily());
 | 
			
		||||
@ -136,8 +171,20 @@ public class UserApiVerticle extends AbstractVerticle {
 | 
			
		||||
        //Consumer for loginUser
 | 
			
		||||
        vertx.eventBus().<JsonObject> consumer(LOGINUSER_SERVICE_ID).handler(message -> {
 | 
			
		||||
            try {
 | 
			
		||||
                String username = message.body().getString("username");
 | 
			
		||||
                String password = message.body().getString("password");
 | 
			
		||||
                // Workaround for #allParams section clearing the vendorExtensions map
 | 
			
		||||
                String serviceId = "loginUser";
 | 
			
		||||
                String usernameParam = message.body().getString("username");
 | 
			
		||||
                if(usernameParam == null) {
 | 
			
		||||
                    manageError(message, new MainApiException(400, "username is required"), serviceId);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                String username = usernameParam;
 | 
			
		||||
                String passwordParam = message.body().getString("password");
 | 
			
		||||
                if(passwordParam == null) {
 | 
			
		||||
                    manageError(message, new MainApiException(400, "password is required"), serviceId);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                String password = passwordParam;
 | 
			
		||||
                service.loginUser(username, password, result -> {
 | 
			
		||||
                    if (result.succeeded())
 | 
			
		||||
                        message.reply(new JsonObject(Json.encode(result.result())).encodePrettily());
 | 
			
		||||
@ -155,6 +202,8 @@ public class UserApiVerticle extends AbstractVerticle {
 | 
			
		||||
        //Consumer for logoutUser
 | 
			
		||||
        vertx.eventBus().<JsonObject> consumer(LOGOUTUSER_SERVICE_ID).handler(message -> {
 | 
			
		||||
            try {
 | 
			
		||||
                // Workaround for #allParams section clearing the vendorExtensions map
 | 
			
		||||
                String serviceId = "logoutUser";
 | 
			
		||||
                service.logoutUser(result -> {
 | 
			
		||||
                    if (result.succeeded())
 | 
			
		||||
                        message.reply(null);
 | 
			
		||||
@ -172,8 +221,20 @@ public class UserApiVerticle extends AbstractVerticle {
 | 
			
		||||
        //Consumer for updateUser
 | 
			
		||||
        vertx.eventBus().<JsonObject> consumer(UPDATEUSER_SERVICE_ID).handler(message -> {
 | 
			
		||||
            try {
 | 
			
		||||
                String username = message.body().getString("username");
 | 
			
		||||
                User body = Json.mapper.readValue(message.body().getJsonObject("body").encode(), User.class);
 | 
			
		||||
                // Workaround for #allParams section clearing the vendorExtensions map
 | 
			
		||||
                String serviceId = "updateUser";
 | 
			
		||||
                String usernameParam = message.body().getString("username");
 | 
			
		||||
                if(usernameParam == null) {
 | 
			
		||||
                    manageError(message, new MainApiException(400, "username is required"), serviceId);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                String username = usernameParam;
 | 
			
		||||
                JsonObject bodyParam = message.body().getJsonObject("body");
 | 
			
		||||
                if (bodyParam == null) {
 | 
			
		||||
                    manageError(message, new MainApiException(400, "body is required"), serviceId);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                User body = Json.mapper.readValue(bodyParam.encode(), User.class);
 | 
			
		||||
                service.updateUser(username, body, result -> {
 | 
			
		||||
                    if (result.succeeded())
 | 
			
		||||
                        message.reply(null);
 | 
			
		||||
 | 
			
		||||
@ -1 +1 @@
 | 
			
		||||
2.3.1-SNAPSHOT
 | 
			
		||||
2.3.1
 | 
			
		||||
@ -46,7 +46,14 @@ public class PetApiVerticle extends AbstractVerticle {
 | 
			
		||||
        //Consumer for addPet
 | 
			
		||||
        vertx.eventBus().<JsonObject> consumer(ADDPET_SERVICE_ID).handler(message -> {
 | 
			
		||||
            try {
 | 
			
		||||
                Pet body = Json.mapper.readValue(message.body().getJsonObject("body").encode(), Pet.class);
 | 
			
		||||
                // Workaround for #allParams section clearing the vendorExtensions map
 | 
			
		||||
                String serviceId = "addPet";
 | 
			
		||||
                JsonObject bodyParam = message.body().getJsonObject("body");
 | 
			
		||||
                if (bodyParam == null) {
 | 
			
		||||
                    manageError(message, new MainApiException(400, "body is required"), serviceId);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                Pet body = Json.mapper.readValue(bodyParam.encode(), Pet.class);
 | 
			
		||||
                service.addPet(body).subscribe(
 | 
			
		||||
                    () -> {
 | 
			
		||||
                        message.reply(null);
 | 
			
		||||
@ -63,8 +70,16 @@ public class PetApiVerticle extends AbstractVerticle {
 | 
			
		||||
        //Consumer for deletePet
 | 
			
		||||
        vertx.eventBus().<JsonObject> consumer(DELETEPET_SERVICE_ID).handler(message -> {
 | 
			
		||||
            try {
 | 
			
		||||
                Long petId = Json.mapper.readValue(message.body().getString("petId"), Long.class);
 | 
			
		||||
                String apiKey = message.body().getString("api_key");
 | 
			
		||||
                // Workaround for #allParams section clearing the vendorExtensions map
 | 
			
		||||
                String serviceId = "deletePet";
 | 
			
		||||
                String petIdParam = message.body().getString("petId");
 | 
			
		||||
                if(petIdParam == null) {
 | 
			
		||||
                    manageError(message, new MainApiException(400, "petId is required"), serviceId);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                Long petId = Json.mapper.readValue(petIdParam, Long.class);
 | 
			
		||||
                String apiKeyParam = message.body().getString("api_key");
 | 
			
		||||
                String apiKey = (apiKeyParam == null) ? null : apiKeyParam;
 | 
			
		||||
                service.deletePet(petId, apiKey).subscribe(
 | 
			
		||||
                    () -> {
 | 
			
		||||
                        message.reply(null);
 | 
			
		||||
@ -81,8 +96,15 @@ public class PetApiVerticle extends AbstractVerticle {
 | 
			
		||||
        //Consumer for findPetsByStatus
 | 
			
		||||
        vertx.eventBus().<JsonObject> consumer(FINDPETSBYSTATUS_SERVICE_ID).handler(message -> {
 | 
			
		||||
            try {
 | 
			
		||||
                List<String> status = Json.mapper.readValue(message.body().getJsonArray("status").encode(),
 | 
			
		||||
                        Json.mapper.getTypeFactory().constructCollectionType(List.class, String.class));
 | 
			
		||||
                // Workaround for #allParams section clearing the vendorExtensions map
 | 
			
		||||
                String serviceId = "findPetsByStatus";
 | 
			
		||||
                JsonArray statusParam = message.body().getJsonArray("status");
 | 
			
		||||
                if(statusParam == null) {
 | 
			
		||||
                    manageError(message, new MainApiException(400, "status is required"), serviceId);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                List<String> status = Json.mapper.readValue(statusParam.encode(),
 | 
			
		||||
                    Json.mapper.getTypeFactory().constructCollectionType(List.class, String.class));
 | 
			
		||||
                service.findPetsByStatus(status).subscribe(
 | 
			
		||||
                    result -> {
 | 
			
		||||
                        message.reply(new JsonArray(Json.encode(result)).encodePrettily());
 | 
			
		||||
@ -99,8 +121,15 @@ public class PetApiVerticle extends AbstractVerticle {
 | 
			
		||||
        //Consumer for findPetsByTags
 | 
			
		||||
        vertx.eventBus().<JsonObject> consumer(FINDPETSBYTAGS_SERVICE_ID).handler(message -> {
 | 
			
		||||
            try {
 | 
			
		||||
                List<String> tags = Json.mapper.readValue(message.body().getJsonArray("tags").encode(),
 | 
			
		||||
                        Json.mapper.getTypeFactory().constructCollectionType(List.class, String.class));
 | 
			
		||||
                // Workaround for #allParams section clearing the vendorExtensions map
 | 
			
		||||
                String serviceId = "findPetsByTags";
 | 
			
		||||
                JsonArray tagsParam = message.body().getJsonArray("tags");
 | 
			
		||||
                if(tagsParam == null) {
 | 
			
		||||
                    manageError(message, new MainApiException(400, "tags is required"), serviceId);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                List<String> tags = Json.mapper.readValue(tagsParam.encode(),
 | 
			
		||||
                    Json.mapper.getTypeFactory().constructCollectionType(List.class, String.class));
 | 
			
		||||
                service.findPetsByTags(tags).subscribe(
 | 
			
		||||
                    result -> {
 | 
			
		||||
                        message.reply(new JsonArray(Json.encode(result)).encodePrettily());
 | 
			
		||||
@ -117,7 +146,14 @@ public class PetApiVerticle extends AbstractVerticle {
 | 
			
		||||
        //Consumer for getPetById
 | 
			
		||||
        vertx.eventBus().<JsonObject> consumer(GETPETBYID_SERVICE_ID).handler(message -> {
 | 
			
		||||
            try {
 | 
			
		||||
                Long petId = Json.mapper.readValue(message.body().getString("petId"), Long.class);
 | 
			
		||||
                // Workaround for #allParams section clearing the vendorExtensions map
 | 
			
		||||
                String serviceId = "getPetById";
 | 
			
		||||
                String petIdParam = message.body().getString("petId");
 | 
			
		||||
                if(petIdParam == null) {
 | 
			
		||||
                    manageError(message, new MainApiException(400, "petId is required"), serviceId);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                Long petId = Json.mapper.readValue(petIdParam, Long.class);
 | 
			
		||||
                service.getPetById(petId).subscribe(
 | 
			
		||||
                    result -> {
 | 
			
		||||
                        message.reply(new JsonObject(Json.encode(result)).encodePrettily());
 | 
			
		||||
@ -134,7 +170,14 @@ public class PetApiVerticle extends AbstractVerticle {
 | 
			
		||||
        //Consumer for updatePet
 | 
			
		||||
        vertx.eventBus().<JsonObject> consumer(UPDATEPET_SERVICE_ID).handler(message -> {
 | 
			
		||||
            try {
 | 
			
		||||
                Pet body = Json.mapper.readValue(message.body().getJsonObject("body").encode(), Pet.class);
 | 
			
		||||
                // Workaround for #allParams section clearing the vendorExtensions map
 | 
			
		||||
                String serviceId = "updatePet";
 | 
			
		||||
                JsonObject bodyParam = message.body().getJsonObject("body");
 | 
			
		||||
                if (bodyParam == null) {
 | 
			
		||||
                    manageError(message, new MainApiException(400, "body is required"), serviceId);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                Pet body = Json.mapper.readValue(bodyParam.encode(), Pet.class);
 | 
			
		||||
                service.updatePet(body).subscribe(
 | 
			
		||||
                    () -> {
 | 
			
		||||
                        message.reply(null);
 | 
			
		||||
@ -151,9 +194,18 @@ public class PetApiVerticle extends AbstractVerticle {
 | 
			
		||||
        //Consumer for updatePetWithForm
 | 
			
		||||
        vertx.eventBus().<JsonObject> consumer(UPDATEPETWITHFORM_SERVICE_ID).handler(message -> {
 | 
			
		||||
            try {
 | 
			
		||||
                Long petId = Json.mapper.readValue(message.body().getString("petId"), Long.class);
 | 
			
		||||
                String name = message.body().getString("name");
 | 
			
		||||
                String status = message.body().getString("status");
 | 
			
		||||
                // Workaround for #allParams section clearing the vendorExtensions map
 | 
			
		||||
                String serviceId = "updatePetWithForm";
 | 
			
		||||
                String petIdParam = message.body().getString("petId");
 | 
			
		||||
                if(petIdParam == null) {
 | 
			
		||||
                    manageError(message, new MainApiException(400, "petId is required"), serviceId);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                Long petId = Json.mapper.readValue(petIdParam, Long.class);
 | 
			
		||||
                String nameParam = message.body().getString("name");
 | 
			
		||||
                String name = (nameParam == null) ? null : nameParam;
 | 
			
		||||
                String statusParam = message.body().getString("status");
 | 
			
		||||
                String status = (statusParam == null) ? null : statusParam;
 | 
			
		||||
                service.updatePetWithForm(petId, name, status).subscribe(
 | 
			
		||||
                    () -> {
 | 
			
		||||
                        message.reply(null);
 | 
			
		||||
@ -170,9 +222,22 @@ public class PetApiVerticle extends AbstractVerticle {
 | 
			
		||||
        //Consumer for uploadFile
 | 
			
		||||
        vertx.eventBus().<JsonObject> consumer(UPLOADFILE_SERVICE_ID).handler(message -> {
 | 
			
		||||
            try {
 | 
			
		||||
                Long petId = Json.mapper.readValue(message.body().getString("petId"), Long.class);
 | 
			
		||||
                String additionalMetadata = message.body().getString("additionalMetadata");
 | 
			
		||||
                File file = Json.mapper.readValue(message.body().getJsonObject("file").encode(), File.class);
 | 
			
		||||
                // Workaround for #allParams section clearing the vendorExtensions map
 | 
			
		||||
                String serviceId = "uploadFile";
 | 
			
		||||
                String petIdParam = message.body().getString("petId");
 | 
			
		||||
                if(petIdParam == null) {
 | 
			
		||||
                    manageError(message, new MainApiException(400, "petId is required"), serviceId);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                Long petId = Json.mapper.readValue(petIdParam, Long.class);
 | 
			
		||||
                String additionalMetadataParam = message.body().getString("additionalMetadata");
 | 
			
		||||
                String additionalMetadata = (additionalMetadataParam == null) ? null : additionalMetadataParam;
 | 
			
		||||
                JsonObject fileParam = message.body().getJsonObject("file");
 | 
			
		||||
                if (fileParam == null) {
 | 
			
		||||
                    manageError(message, new MainApiException(400, "file is required"), serviceId);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                File file = Json.mapper.readValue(fileParam.encode(), File.class);
 | 
			
		||||
                service.uploadFile(petId, additionalMetadata, file).subscribe(
 | 
			
		||||
                    result -> {
 | 
			
		||||
                        message.reply(new JsonObject(Json.encode(result)).encodePrettily());
 | 
			
		||||
 | 
			
		||||
@ -40,7 +40,14 @@ public class StoreApiVerticle extends AbstractVerticle {
 | 
			
		||||
        //Consumer for deleteOrder
 | 
			
		||||
        vertx.eventBus().<JsonObject> consumer(DELETEORDER_SERVICE_ID).handler(message -> {
 | 
			
		||||
            try {
 | 
			
		||||
                String orderId = message.body().getString("orderId");
 | 
			
		||||
                // Workaround for #allParams section clearing the vendorExtensions map
 | 
			
		||||
                String serviceId = "deleteOrder";
 | 
			
		||||
                String orderIdParam = message.body().getString("orderId");
 | 
			
		||||
                if(orderIdParam == null) {
 | 
			
		||||
                    manageError(message, new MainApiException(400, "orderId is required"), serviceId);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                String orderId = orderIdParam;
 | 
			
		||||
                service.deleteOrder(orderId).subscribe(
 | 
			
		||||
                    () -> {
 | 
			
		||||
                        message.reply(null);
 | 
			
		||||
@ -57,6 +64,8 @@ public class StoreApiVerticle extends AbstractVerticle {
 | 
			
		||||
        //Consumer for getInventory
 | 
			
		||||
        vertx.eventBus().<JsonObject> consumer(GETINVENTORY_SERVICE_ID).handler(message -> {
 | 
			
		||||
            try {
 | 
			
		||||
                // Workaround for #allParams section clearing the vendorExtensions map
 | 
			
		||||
                String serviceId = "getInventory";
 | 
			
		||||
                service.getInventory().subscribe(
 | 
			
		||||
                    result -> {
 | 
			
		||||
                        message.reply(new JsonObject(Json.encode(result)).encodePrettily());
 | 
			
		||||
@ -73,7 +82,14 @@ public class StoreApiVerticle extends AbstractVerticle {
 | 
			
		||||
        //Consumer for getOrderById
 | 
			
		||||
        vertx.eventBus().<JsonObject> consumer(GETORDERBYID_SERVICE_ID).handler(message -> {
 | 
			
		||||
            try {
 | 
			
		||||
                Long orderId = Json.mapper.readValue(message.body().getString("orderId"), Long.class);
 | 
			
		||||
                // Workaround for #allParams section clearing the vendorExtensions map
 | 
			
		||||
                String serviceId = "getOrderById";
 | 
			
		||||
                String orderIdParam = message.body().getString("orderId");
 | 
			
		||||
                if(orderIdParam == null) {
 | 
			
		||||
                    manageError(message, new MainApiException(400, "orderId is required"), serviceId);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                Long orderId = Json.mapper.readValue(orderIdParam, Long.class);
 | 
			
		||||
                service.getOrderById(orderId).subscribe(
 | 
			
		||||
                    result -> {
 | 
			
		||||
                        message.reply(new JsonObject(Json.encode(result)).encodePrettily());
 | 
			
		||||
@ -90,7 +106,14 @@ public class StoreApiVerticle extends AbstractVerticle {
 | 
			
		||||
        //Consumer for placeOrder
 | 
			
		||||
        vertx.eventBus().<JsonObject> consumer(PLACEORDER_SERVICE_ID).handler(message -> {
 | 
			
		||||
            try {
 | 
			
		||||
                Order body = Json.mapper.readValue(message.body().getJsonObject("body").encode(), Order.class);
 | 
			
		||||
                // Workaround for #allParams section clearing the vendorExtensions map
 | 
			
		||||
                String serviceId = "placeOrder";
 | 
			
		||||
                JsonObject bodyParam = message.body().getJsonObject("body");
 | 
			
		||||
                if (bodyParam == null) {
 | 
			
		||||
                    manageError(message, new MainApiException(400, "body is required"), serviceId);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                Order body = Json.mapper.readValue(bodyParam.encode(), Order.class);
 | 
			
		||||
                service.placeOrder(body).subscribe(
 | 
			
		||||
                    result -> {
 | 
			
		||||
                        message.reply(new JsonObject(Json.encode(result)).encodePrettily());
 | 
			
		||||
 | 
			
		||||
@ -44,7 +44,14 @@ public class UserApiVerticle extends AbstractVerticle {
 | 
			
		||||
        //Consumer for createUser
 | 
			
		||||
        vertx.eventBus().<JsonObject> consumer(CREATEUSER_SERVICE_ID).handler(message -> {
 | 
			
		||||
            try {
 | 
			
		||||
                User body = Json.mapper.readValue(message.body().getJsonObject("body").encode(), User.class);
 | 
			
		||||
                // Workaround for #allParams section clearing the vendorExtensions map
 | 
			
		||||
                String serviceId = "createUser";
 | 
			
		||||
                JsonObject bodyParam = message.body().getJsonObject("body");
 | 
			
		||||
                if (bodyParam == null) {
 | 
			
		||||
                    manageError(message, new MainApiException(400, "body is required"), serviceId);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                User body = Json.mapper.readValue(bodyParam.encode(), User.class);
 | 
			
		||||
                service.createUser(body).subscribe(
 | 
			
		||||
                    () -> {
 | 
			
		||||
                        message.reply(null);
 | 
			
		||||
@ -61,8 +68,15 @@ public class UserApiVerticle extends AbstractVerticle {
 | 
			
		||||
        //Consumer for createUsersWithArrayInput
 | 
			
		||||
        vertx.eventBus().<JsonObject> consumer(CREATEUSERSWITHARRAYINPUT_SERVICE_ID).handler(message -> {
 | 
			
		||||
            try {
 | 
			
		||||
                List<User> body = Json.mapper.readValue(message.body().getJsonArray("body").encode(),
 | 
			
		||||
                        Json.mapper.getTypeFactory().constructCollectionType(List.class, User.class));
 | 
			
		||||
                // Workaround for #allParams section clearing the vendorExtensions map
 | 
			
		||||
                String serviceId = "createUsersWithArrayInput";
 | 
			
		||||
                JsonArray bodyParam = message.body().getJsonArray("body");
 | 
			
		||||
                if(bodyParam == null) {
 | 
			
		||||
                    manageError(message, new MainApiException(400, "body is required"), serviceId);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                List<User> body = Json.mapper.readValue(bodyParam.encode(),
 | 
			
		||||
                    Json.mapper.getTypeFactory().constructCollectionType(List.class, User.class));
 | 
			
		||||
                service.createUsersWithArrayInput(body).subscribe(
 | 
			
		||||
                    () -> {
 | 
			
		||||
                        message.reply(null);
 | 
			
		||||
@ -79,8 +93,15 @@ public class UserApiVerticle extends AbstractVerticle {
 | 
			
		||||
        //Consumer for createUsersWithListInput
 | 
			
		||||
        vertx.eventBus().<JsonObject> consumer(CREATEUSERSWITHLISTINPUT_SERVICE_ID).handler(message -> {
 | 
			
		||||
            try {
 | 
			
		||||
                List<User> body = Json.mapper.readValue(message.body().getJsonArray("body").encode(),
 | 
			
		||||
                        Json.mapper.getTypeFactory().constructCollectionType(List.class, User.class));
 | 
			
		||||
                // Workaround for #allParams section clearing the vendorExtensions map
 | 
			
		||||
                String serviceId = "createUsersWithListInput";
 | 
			
		||||
                JsonArray bodyParam = message.body().getJsonArray("body");
 | 
			
		||||
                if(bodyParam == null) {
 | 
			
		||||
                    manageError(message, new MainApiException(400, "body is required"), serviceId);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                List<User> body = Json.mapper.readValue(bodyParam.encode(),
 | 
			
		||||
                    Json.mapper.getTypeFactory().constructCollectionType(List.class, User.class));
 | 
			
		||||
                service.createUsersWithListInput(body).subscribe(
 | 
			
		||||
                    () -> {
 | 
			
		||||
                        message.reply(null);
 | 
			
		||||
@ -97,7 +118,14 @@ public class UserApiVerticle extends AbstractVerticle {
 | 
			
		||||
        //Consumer for deleteUser
 | 
			
		||||
        vertx.eventBus().<JsonObject> consumer(DELETEUSER_SERVICE_ID).handler(message -> {
 | 
			
		||||
            try {
 | 
			
		||||
                String username = message.body().getString("username");
 | 
			
		||||
                // Workaround for #allParams section clearing the vendorExtensions map
 | 
			
		||||
                String serviceId = "deleteUser";
 | 
			
		||||
                String usernameParam = message.body().getString("username");
 | 
			
		||||
                if(usernameParam == null) {
 | 
			
		||||
                    manageError(message, new MainApiException(400, "username is required"), serviceId);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                String username = usernameParam;
 | 
			
		||||
                service.deleteUser(username).subscribe(
 | 
			
		||||
                    () -> {
 | 
			
		||||
                        message.reply(null);
 | 
			
		||||
@ -114,7 +142,14 @@ public class UserApiVerticle extends AbstractVerticle {
 | 
			
		||||
        //Consumer for getUserByName
 | 
			
		||||
        vertx.eventBus().<JsonObject> consumer(GETUSERBYNAME_SERVICE_ID).handler(message -> {
 | 
			
		||||
            try {
 | 
			
		||||
                String username = message.body().getString("username");
 | 
			
		||||
                // Workaround for #allParams section clearing the vendorExtensions map
 | 
			
		||||
                String serviceId = "getUserByName";
 | 
			
		||||
                String usernameParam = message.body().getString("username");
 | 
			
		||||
                if(usernameParam == null) {
 | 
			
		||||
                    manageError(message, new MainApiException(400, "username is required"), serviceId);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                String username = usernameParam;
 | 
			
		||||
                service.getUserByName(username).subscribe(
 | 
			
		||||
                    result -> {
 | 
			
		||||
                        message.reply(new JsonObject(Json.encode(result)).encodePrettily());
 | 
			
		||||
@ -131,8 +166,20 @@ public class UserApiVerticle extends AbstractVerticle {
 | 
			
		||||
        //Consumer for loginUser
 | 
			
		||||
        vertx.eventBus().<JsonObject> consumer(LOGINUSER_SERVICE_ID).handler(message -> {
 | 
			
		||||
            try {
 | 
			
		||||
                String username = message.body().getString("username");
 | 
			
		||||
                String password = message.body().getString("password");
 | 
			
		||||
                // Workaround for #allParams section clearing the vendorExtensions map
 | 
			
		||||
                String serviceId = "loginUser";
 | 
			
		||||
                String usernameParam = message.body().getString("username");
 | 
			
		||||
                if(usernameParam == null) {
 | 
			
		||||
                    manageError(message, new MainApiException(400, "username is required"), serviceId);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                String username = usernameParam;
 | 
			
		||||
                String passwordParam = message.body().getString("password");
 | 
			
		||||
                if(passwordParam == null) {
 | 
			
		||||
                    manageError(message, new MainApiException(400, "password is required"), serviceId);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                String password = passwordParam;
 | 
			
		||||
                service.loginUser(username, password).subscribe(
 | 
			
		||||
                    result -> {
 | 
			
		||||
                        message.reply(new JsonObject(Json.encode(result)).encodePrettily());
 | 
			
		||||
@ -149,6 +196,8 @@ public class UserApiVerticle extends AbstractVerticle {
 | 
			
		||||
        //Consumer for logoutUser
 | 
			
		||||
        vertx.eventBus().<JsonObject> consumer(LOGOUTUSER_SERVICE_ID).handler(message -> {
 | 
			
		||||
            try {
 | 
			
		||||
                // Workaround for #allParams section clearing the vendorExtensions map
 | 
			
		||||
                String serviceId = "logoutUser";
 | 
			
		||||
                service.logoutUser().subscribe(
 | 
			
		||||
                    () -> {
 | 
			
		||||
                        message.reply(null);
 | 
			
		||||
@ -165,8 +214,20 @@ public class UserApiVerticle extends AbstractVerticle {
 | 
			
		||||
        //Consumer for updateUser
 | 
			
		||||
        vertx.eventBus().<JsonObject> consumer(UPDATEUSER_SERVICE_ID).handler(message -> {
 | 
			
		||||
            try {
 | 
			
		||||
                String username = message.body().getString("username");
 | 
			
		||||
                User body = Json.mapper.readValue(message.body().getJsonObject("body").encode(), User.class);
 | 
			
		||||
                // Workaround for #allParams section clearing the vendorExtensions map
 | 
			
		||||
                String serviceId = "updateUser";
 | 
			
		||||
                String usernameParam = message.body().getString("username");
 | 
			
		||||
                if(usernameParam == null) {
 | 
			
		||||
                    manageError(message, new MainApiException(400, "username is required"), serviceId);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                String username = usernameParam;
 | 
			
		||||
                JsonObject bodyParam = message.body().getJsonObject("body");
 | 
			
		||||
                if (bodyParam == null) {
 | 
			
		||||
                    manageError(message, new MainApiException(400, "body is required"), serviceId);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                User body = Json.mapper.readValue(bodyParam.encode(), User.class);
 | 
			
		||||
                service.updateUser(username, body).subscribe(
 | 
			
		||||
                    () -> {
 | 
			
		||||
                        message.reply(null);
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user