Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,34 @@ import com.github.phiz71.vertx.swagger.router.SwaggerRouter;
import io.swagger.models.Swagger;
import io.swagger.parser.SwaggerParser;
import io.vertx.core.AbstractVerticle;
import io.vertx.core.Context;
import io.vertx.core.Future;
import io.vertx.core.file.FileSystem;
import io.vertx.core.json.Json;
import io.vertx.core.logging.Logger;
import io.vertx.core.logging.LoggerFactory;
import io.vertx.core.Vertx;
import io.vertx.ext.web.Router;

public class MainApiVerticle extends AbstractVerticle {
final static Logger LOGGER = LoggerFactory.getLogger(MainApiVerticle.class);

final Router router = Router.router(vertx);

protected Router router;

@Override
public void init(Vertx vertx, Context context) {
super.init(vertx, context);
router = Router.router(vertx);
}

@Override
public void start(Future<Void> startFuture) throws Exception {
Json.mapper.registerModule(new JavaTimeModule());
FileSystem vertxFileSystem = vertx.fileSystem();
FileSystem vertxFileSystem = vertx.fileSystem();
vertxFileSystem.readFile("swagger.json", readFile -> {
if (readFile.succeeded()) {
Swagger swagger = new SwaggerParser().parse(readFile.result().toString(Charset.forName("utf-8")));
Router swaggerRouter = SwaggerRouter.swaggerRouter(Router.router(vertx), swagger, vertx.eventBus(), new OperationIdServiceIdResolver());
Router swaggerRouter = SwaggerRouter.swaggerRouter(router, swagger, vertx.eventBus(), new OperationIdServiceIdResolver());

deployVerticles(startFuture);

Expand All @@ -49,7 +57,7 @@ public class MainApiVerticle extends AbstractVerticle {
LOGGER.info("{{classname}}Verticle : Deployed");
} else {
startFuture.fail(res.cause());
LOGGER.error("{{classname}}Verticle : Deployement failed");
LOGGER.error("{{classname}}Verticle : Deployment failed");
}
});
{{/apis}}{{/apiInfo}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,34 @@
import io.swagger.models.Swagger;
import io.swagger.parser.SwaggerParser;
import io.vertx.core.AbstractVerticle;
import io.vertx.core.Context;
import io.vertx.core.Future;
import io.vertx.core.file.FileSystem;
import io.vertx.core.json.Json;
import io.vertx.core.logging.Logger;
import io.vertx.core.logging.LoggerFactory;
import io.vertx.core.Vertx;
import io.vertx.ext.web.Router;

public class MainApiVerticle extends AbstractVerticle {
final static Logger LOGGER = LoggerFactory.getLogger(MainApiVerticle.class);

final Router router = Router.router(vertx);

protected Router router;

@Override
public void init(Vertx vertx, Context context) {
super.init(vertx, context);
router = Router.router(vertx);
}

@Override
public void start(Future<Void> startFuture) throws Exception {
Json.mapper.registerModule(new JavaTimeModule());
FileSystem vertxFileSystem = vertx.fileSystem();
FileSystem vertxFileSystem = vertx.fileSystem();
vertxFileSystem.readFile("swagger.json", readFile -> {
if (readFile.succeeded()) {
Swagger swagger = new SwaggerParser().parse(readFile.result().toString(Charset.forName("utf-8")));
Router swaggerRouter = SwaggerRouter.swaggerRouter(Router.router(vertx), swagger, vertx.eventBus(), new OperationIdServiceIdResolver());
Router swaggerRouter = SwaggerRouter.swaggerRouter(router, swagger, vertx.eventBus(), new OperationIdServiceIdResolver());

deployVerticles(startFuture);

Expand All @@ -49,7 +57,7 @@ public void deployVerticles(Future<Void> startFuture) {
LOGGER.info("PetApiVerticle : Deployed");
} else {
startFuture.fail(res.cause());
LOGGER.error("PetApiVerticle : Deployement failed");
LOGGER.error("PetApiVerticle : Deployment failed");
}
});

Expand All @@ -58,7 +66,7 @@ public void deployVerticles(Future<Void> startFuture) {
LOGGER.info("StoreApiVerticle : Deployed");
} else {
startFuture.fail(res.cause());
LOGGER.error("StoreApiVerticle : Deployement failed");
LOGGER.error("StoreApiVerticle : Deployment failed");
}
});

Expand All @@ -67,7 +75,7 @@ public void deployVerticles(Future<Void> startFuture) {
LOGGER.info("UserApiVerticle : Deployed");
} else {
startFuture.fail(res.cause());
LOGGER.error("UserApiVerticle : Deployement failed");
LOGGER.error("UserApiVerticle : Deployment failed");
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@
"type" : "array",
"items" : {
"type" : "string",
"enum" : [ "available", "pending", "sold" ],
"default" : "available"
"default" : "available",
"enum" : [ "available", "pending", "sold" ]
},
"collectionFormat" : "csv"
} ],
Expand All @@ -134,7 +134,6 @@
"security" : [ {
"petstore_auth" : [ "write:pets", "read:pets" ]
} ],
"x-contentType" : "application/json",
"x-accepts" : "application/json"
}
},
Expand Down Expand Up @@ -174,7 +173,6 @@
"petstore_auth" : [ "write:pets", "read:pets" ]
} ],
"deprecated" : true,
"x-contentType" : "application/json",
"x-accepts" : "application/json"
}
},
Expand Down Expand Up @@ -210,7 +208,6 @@
"security" : [ {
"api_key" : [ ]
} ],
"x-contentType" : "application/json",
"x-accepts" : "application/json"
},
"post" : {
Expand Down Expand Up @@ -278,7 +275,6 @@
"security" : [ {
"petstore_auth" : [ "write:pets", "read:pets" ]
} ],
"x-contentType" : "application/json",
"x-accepts" : "application/json"
}
},
Expand Down Expand Up @@ -348,7 +344,6 @@
"security" : [ {
"api_key" : [ ]
} ],
"x-contentType" : "application/json",
"x-accepts" : "application/json"
}
},
Expand Down Expand Up @@ -414,7 +409,6 @@
"description" : "Order not found"
}
},
"x-contentType" : "application/json",
"x-accepts" : "application/json"
},
"delete" : {
Expand All @@ -438,7 +432,6 @@
"description" : "Order not found"
}
},
"x-contentType" : "application/json",
"x-accepts" : "application/json"
}
},
Expand Down Expand Up @@ -566,7 +559,6 @@
"description" : "Invalid username/password supplied"
}
},
"x-contentType" : "application/json",
"x-accepts" : "application/json"
}
},
Expand All @@ -583,7 +575,6 @@
"description" : "successful operation"
}
},
"x-contentType" : "application/json",
"x-accepts" : "application/json"
}
},
Expand Down Expand Up @@ -615,7 +606,6 @@
"description" : "User not found"
}
},
"x-contentType" : "application/json",
"x-accepts" : "application/json"
},
"put" : {
Expand Down Expand Up @@ -671,7 +661,6 @@
"description" : "User not found"
}
},
"x-contentType" : "application/json",
"x-accepts" : "application/json"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,34 @@
import io.swagger.models.Swagger;
import io.swagger.parser.SwaggerParser;
import io.vertx.core.AbstractVerticle;
import io.vertx.core.Context;
import io.vertx.core.Future;
import io.vertx.core.file.FileSystem;
import io.vertx.core.json.Json;
import io.vertx.core.logging.Logger;
import io.vertx.core.logging.LoggerFactory;
import io.vertx.core.Vertx;
import io.vertx.ext.web.Router;

public class MainApiVerticle extends AbstractVerticle {
final static Logger LOGGER = LoggerFactory.getLogger(MainApiVerticle.class);

final Router router = Router.router(vertx);

protected Router router;

@Override
public void init(Vertx vertx, Context context) {
super.init(vertx, context);
router = Router.router(vertx);
}

@Override
public void start(Future<Void> startFuture) throws Exception {
Json.mapper.registerModule(new JavaTimeModule());
FileSystem vertxFileSystem = vertx.fileSystem();
FileSystem vertxFileSystem = vertx.fileSystem();
vertxFileSystem.readFile("swagger.json", readFile -> {
if (readFile.succeeded()) {
Swagger swagger = new SwaggerParser().parse(readFile.result().toString(Charset.forName("utf-8")));
Router swaggerRouter = SwaggerRouter.swaggerRouter(Router.router(vertx), swagger, vertx.eventBus(), new OperationIdServiceIdResolver());
Router swaggerRouter = SwaggerRouter.swaggerRouter(router, swagger, vertx.eventBus(), new OperationIdServiceIdResolver());

deployVerticles(startFuture);

Expand All @@ -49,7 +57,7 @@ public void deployVerticles(Future<Void> startFuture) {
LOGGER.info("PetApiVerticle : Deployed");
} else {
startFuture.fail(res.cause());
LOGGER.error("PetApiVerticle : Deployement failed");
LOGGER.error("PetApiVerticle : Deployment failed");
}
});

Expand All @@ -58,7 +66,7 @@ public void deployVerticles(Future<Void> startFuture) {
LOGGER.info("StoreApiVerticle : Deployed");
} else {
startFuture.fail(res.cause());
LOGGER.error("StoreApiVerticle : Deployement failed");
LOGGER.error("StoreApiVerticle : Deployment failed");
}
});

Expand All @@ -67,7 +75,7 @@ public void deployVerticles(Future<Void> startFuture) {
LOGGER.info("UserApiVerticle : Deployed");
} else {
startFuture.fail(res.cause());
LOGGER.error("UserApiVerticle : Deployement failed");
LOGGER.error("UserApiVerticle : Deployment failed");
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@
"type" : "array",
"items" : {
"type" : "string",
"enum" : [ "available", "pending", "sold" ],
"default" : "available"
"default" : "available",
"enum" : [ "available", "pending", "sold" ]
},
"collectionFormat" : "csv"
} ],
Expand All @@ -134,7 +134,6 @@
"security" : [ {
"petstore_auth" : [ "write:pets", "read:pets" ]
} ],
"x-contentType" : "application/json",
"x-accepts" : "application/json"
}
},
Expand Down Expand Up @@ -174,7 +173,6 @@
"petstore_auth" : [ "write:pets", "read:pets" ]
} ],
"deprecated" : true,
"x-contentType" : "application/json",
"x-accepts" : "application/json"
}
},
Expand Down Expand Up @@ -210,7 +208,6 @@
"security" : [ {
"api_key" : [ ]
} ],
"x-contentType" : "application/json",
"x-accepts" : "application/json"
},
"post" : {
Expand Down Expand Up @@ -278,7 +275,6 @@
"security" : [ {
"petstore_auth" : [ "write:pets", "read:pets" ]
} ],
"x-contentType" : "application/json",
"x-accepts" : "application/json"
}
},
Expand Down Expand Up @@ -348,7 +344,6 @@
"security" : [ {
"api_key" : [ ]
} ],
"x-contentType" : "application/json",
"x-accepts" : "application/json"
}
},
Expand Down Expand Up @@ -414,7 +409,6 @@
"description" : "Order not found"
}
},
"x-contentType" : "application/json",
"x-accepts" : "application/json"
},
"delete" : {
Expand All @@ -438,7 +432,6 @@
"description" : "Order not found"
}
},
"x-contentType" : "application/json",
"x-accepts" : "application/json"
}
},
Expand Down Expand Up @@ -566,7 +559,6 @@
"description" : "Invalid username/password supplied"
}
},
"x-contentType" : "application/json",
"x-accepts" : "application/json"
}
},
Expand All @@ -583,7 +575,6 @@
"description" : "successful operation"
}
},
"x-contentType" : "application/json",
"x-accepts" : "application/json"
}
},
Expand Down Expand Up @@ -615,7 +606,6 @@
"description" : "User not found"
}
},
"x-contentType" : "application/json",
"x-accepts" : "application/json"
},
"put" : {
Expand Down Expand Up @@ -671,7 +661,6 @@
"description" : "User not found"
}
},
"x-contentType" : "application/json",
"x-accepts" : "application/json"
}
}
Expand Down