Generate vertx OAS2 (#226)

This commit is contained in:
Jérémie Bresson
2018-04-27 10:19:48 +02:00
committed by GitHub
parent bec559a6e8
commit 3f976afca8
52 changed files with 2419 additions and 1976 deletions

View File

@@ -27,6 +27,6 @@ fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="$@ generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -l java-vertx -o samples/server/petstore/java-vertx/async -DvertxSwaggerRouterVersion=1.2.0"
ags="$@ generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -l java-vertx -o samples/server/petstore/java-vertx/async -DvertxSwaggerRouterVersion=1.4.0 -DhideGenerationTimestamp=true"
java $JAVA_OPTS -jar $executable $ags

View File

@@ -27,6 +27,6 @@ fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="$@ generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -l java-vertx --artifact-id java-vertx-rx-server -o samples/server/petstore/java-vertx/rx -DvertxSwaggerRouterVersion=1.2.0,rxInterface=true"
ags="$@ generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -l java-vertx --artifact-id java-vertx-rx-server -o samples/server/petstore/java-vertx/rx -DvertxSwaggerRouterVersion=1.4.0,rxInterface=true -DhideGenerationTimestamp=true"
java $JAVA_OPTS -jar $executable $ags

View File

@@ -1,5 +1,11 @@
package org.openapitools.codegen.languages;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.Operation;
import io.swagger.v3.oas.models.PathItem;
import io.swagger.v3.oas.models.PathItem.HttpMethod;
import io.swagger.v3.oas.models.media.Schema;
import org.openapitools.codegen.CliOption;
import org.openapitools.codegen.CodegenModel;
import org.openapitools.codegen.CodegenOperation;
@@ -7,12 +13,6 @@ import org.openapitools.codegen.CodegenProperty;
import org.openapitools.codegen.CodegenType;
import org.openapitools.codegen.SupportingFile;
import org.openapitools.codegen.utils.URLPathUtils;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.Operation;
import io.swagger.v3.oas.models.media.*;
import io.swagger.v3.oas.models.PathItem;
import io.swagger.v3.oas.models.PathItem.HttpMethod;
import io.swagger.v3.core.util.Json;
import java.io.File;
import java.net.URL;
@@ -25,7 +25,7 @@ import java.util.regex.Pattern;
public class JavaVertXServerCodegen extends AbstractJavaCodegen {
protected String resourceFolder = "src/main/resources";
protected String rootPackage = "io.swagger.server.api";
protected String rootPackage = "org.openapitools.server.api";
protected String apiVersion = "1.0.0-SNAPSHOT";
public static final String ROOT_PACKAGE = "rootPackage";
@@ -124,7 +124,7 @@ public class JavaVertXServerCodegen extends AbstractJavaCodegen {
apiDocTemplateFiles.clear();
supportingFiles.clear();
supportingFiles.add(new SupportingFile("swagger.mustache", resourceFolder, "swagger.json"));
supportingFiles.add(new SupportingFile("openapi.mustache", resourceFolder, "openapi.json"));
supportingFiles.add(new SupportingFile("MainApiVerticle.mustache",
sourceFolder + File.separator + rootPackage.replace(".", File.separator),
"MainApiVerticle.java"));
@@ -173,6 +173,13 @@ public class JavaVertXServerCodegen extends AbstractJavaCodegen {
return newObjs;
}
@Override
public Map<String, Object> postProcessSupportingFileData(Map<String, Object> objs) {
generateJSONSpecFile(objs);
return super.postProcessSupportingFileData(objs);
}
@Override
public CodegenOperation fromOperation(String path, String httpMethod, Operation operation,
Map<String, Schema> definitions, OpenAPI openAPI) {
@@ -194,10 +201,6 @@ public class JavaVertXServerCodegen extends AbstractJavaCodegen {
public void preprocessOpenAPI(OpenAPI openAPI) {
super.preprocessOpenAPI(openAPI);
// add full swagger definition in a mustache parameter
String openAPIDef = Json.pretty(openAPI);
this.additionalProperties.put("fullOpenAPI", openAPIDef);
// add server port from the swagger file, 8080 by default
URL url = URLPathUtils.getServerURL(openAPI);
this.additionalProperties.put("serverPort", URLPathUtils.getPort(url, 8080));

View File

@@ -1 +1,3 @@
{{^hideGenerationTimestamp}}
Project generated on : {{generatedDate}}
{{/hideGenerationTimestamp}}

View File

@@ -0,0 +1 @@
{{{openapi-json}}}

View File

@@ -1,11 +1,11 @@
# Swagger Codegen Ignore
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.
# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs
# You can match any string of characters against a directory, file or extension with a single asterisk (*):

View File

@@ -1 +1 @@
2.4.0-SNAPSHOT
3.0.0-SNAPSHOT

View File

@@ -1 +0,0 @@
Project generated on : 2017-07-08T16:03:02.953+02:00

View File

@@ -2,8 +2,8 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>io.swagger</groupId>
<artifactId>swagger-java-vertx-server</artifactId>
<groupId>org.openapitools</groupId>
<artifactId>openapi-java-vertx-server</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
@@ -28,24 +28,25 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-unit</artifactId>
<version>${vertx.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-unit</artifactId>
<version>${vertx.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.phiz71</groupId>
<artifactId>vertx-swagger-router</artifactId>
<version>${vertx-swagger-router.version}</version>
</dependency>
<groupId>com.github.phiz71</groupId>
<artifactId>vertx-swagger-router</artifactId>
<version>${vertx-swagger-router.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>${jackson-datatype-jsr310.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>${jackson-datatype-jsr310.version}</version>
</dependency>
</dependencies>
<build>
@@ -75,7 +76,7 @@
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<Main-Class>io.vertx.core.Starter</Main-Class>
<Main-Verticle>io.swagger.server.api.MainApiVerticle</Main-Verticle>
<Main-Verticle>org.openapitools.server.api.MainApiVerticle</Main-Verticle>
</manifestEntries>
</transformer>
</transformers>
@@ -87,4 +88,4 @@
</plugin>
</plugins>
</build>
</project>
</project>

View File

@@ -1,4 +1,4 @@
package io.swagger.server.api;
package org.openapitools.server.api;
public class MainApiException extends Exception {
private int statusCode;

View File

@@ -1,4 +1,4 @@
package io.swagger.server.api;
package org.openapitools.server.api;
import java.nio.charset.Charset;
@@ -42,7 +42,7 @@ public class MainApiVerticle extends AbstractVerticle {
public void start(Future<Void> startFuture) throws Exception {
Json.mapper.registerModule(new JavaTimeModule());
FileSystem vertxFileSystem = vertx.fileSystem();
vertxFileSystem.readFile("swagger.json", readFile -> {
vertxFileSystem.readFile("openapi.json", readFile -> {
if (readFile.succeeded()) {
Swagger swagger = new SwaggerParser().parse(readFile.result().toString(Charset.forName("utf-8")));
Router swaggerRouter = SwaggerRouter.swaggerRouter(router, swagger, vertx.eventBus(), new OperationIdServiceIdResolver());
@@ -66,7 +66,7 @@ public class MainApiVerticle extends AbstractVerticle {
public void deployVerticles(Future<Void> startFuture) {
vertx.deployVerticle("io.swagger.server.api.verticle.PetApiVerticle", res -> {
vertx.deployVerticle("org.openapitools.server.api.verticle.PetApiVerticle", res -> {
if (res.succeeded()) {
LOGGER.info("PetApiVerticle : Deployed");
} else {
@@ -75,7 +75,7 @@ public class MainApiVerticle extends AbstractVerticle {
}
});
vertx.deployVerticle("io.swagger.server.api.verticle.StoreApiVerticle", res -> {
vertx.deployVerticle("org.openapitools.server.api.verticle.StoreApiVerticle", res -> {
if (res.succeeded()) {
LOGGER.info("StoreApiVerticle : Deployed");
} else {
@@ -84,7 +84,7 @@ public class MainApiVerticle extends AbstractVerticle {
}
});
vertx.deployVerticle("io.swagger.server.api.verticle.UserApiVerticle", res -> {
vertx.deployVerticle("org.openapitools.server.api.verticle.UserApiVerticle", res -> {
if (res.succeeded()) {
LOGGER.info("UserApiVerticle : Deployed");
} else {

View File

@@ -1,4 +1,4 @@
package io.swagger.server.api.model;
package org.openapitools.server.api.model;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonInclude;

View File

@@ -1,4 +1,4 @@
package io.swagger.server.api.model;
package org.openapitools.server.api.model;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonInclude;

View File

@@ -1,4 +1,4 @@
package io.swagger.server.api.model;
package org.openapitools.server.api.model;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonInclude;

View File

@@ -1,13 +1,13 @@
package io.swagger.server.api.model;
package org.openapitools.server.api.model;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.server.api.model.Category;
import io.swagger.server.api.model.Tag;
import java.util.ArrayList;
import java.util.List;
import org.openapitools.server.api.model.Category;
import org.openapitools.server.api.model.Tag;
/**
* A pet for sale in the pet store

View File

@@ -1,4 +1,4 @@
package io.swagger.server.api.model;
package org.openapitools.server.api.model;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonInclude;

View File

@@ -1,4 +1,4 @@
package io.swagger.server.api.model;
package org.openapitools.server.api.model;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonInclude;

View File

@@ -1,9 +1,9 @@
package io.swagger.server.api.verticle;
package org.openapitools.server.api.verticle;
import java.io.File;
import io.swagger.server.api.MainApiException;
import io.swagger.server.api.model.ModelApiResponse;
import io.swagger.server.api.model.Pet;
import org.openapitools.server.api.MainApiException;
import org.openapitools.server.api.model.ModelApiResponse;
import org.openapitools.server.api.model.Pet;
import io.vertx.core.AsyncResult;
import io.vertx.core.Handler;
@@ -13,7 +13,7 @@ import java.util.Map;
public interface PetApi {
//addPet
void addPet(Pet body, Handler<AsyncResult<Void>> handler);
void addPet(Pet pet, Handler<AsyncResult<Void>> handler);
//deletePet
void deletePet(Long petId, String apiKey, Handler<AsyncResult<Void>> handler);
@@ -28,7 +28,7 @@ public interface PetApi {
void getPetById(Long petId, Handler<AsyncResult<Pet>> handler);
//updatePet
void updatePet(Pet body, Handler<AsyncResult<Void>> handler);
void updatePet(Pet pet, Handler<AsyncResult<Void>> handler);
//updatePetWithForm
void updatePetWithForm(Long petId, String name, String status, Handler<AsyncResult<Void>> handler);

View File

@@ -1,9 +1,9 @@
package io.swagger.server.api.verticle;
package org.openapitools.server.api.verticle;
import java.io.File;
import io.swagger.server.api.MainApiException;
import io.swagger.server.api.model.ModelApiResponse;
import io.swagger.server.api.model.Pet;
import org.openapitools.server.api.MainApiException;
import org.openapitools.server.api.model.ModelApiResponse;
import org.openapitools.server.api.model.Pet;
public final class PetApiException extends MainApiException {
public PetApiException(int statusCode, String statusMessage) {

View File

@@ -1,4 +1,4 @@
package io.swagger.server.api.verticle;
package org.openapitools.server.api.verticle;
import io.vertx.core.AbstractVerticle;
import io.vertx.core.eventbus.Message;
@@ -9,9 +9,9 @@ import io.vertx.core.logging.Logger;
import io.vertx.core.logging.LoggerFactory;
import java.io.File;
import io.swagger.server.api.MainApiException;
import io.swagger.server.api.model.ModelApiResponse;
import io.swagger.server.api.model.Pet;
import org.openapitools.server.api.MainApiException;
import org.openapitools.server.api.model.ModelApiResponse;
import org.openapitools.server.api.model.Pet;
import java.util.List;
import java.util.Map;
@@ -32,7 +32,7 @@ public class PetApiVerticle extends AbstractVerticle {
public PetApiVerticle() {
try {
Class serviceImplClass = getClass().getClassLoader().loadClass("io.swagger.server.api.verticle.PetApiImpl");
Class serviceImplClass = getClass().getClassLoader().loadClass("org.openapitools.server.api.verticle.PetApiImpl");
service = (PetApi)serviceImplClass.newInstance();
} catch (Exception e) {
logUnexpectedError("PetApiVerticle constructor", e);
@@ -48,13 +48,13 @@ public class PetApiVerticle extends AbstractVerticle {
try {
// 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);
JsonObject petParam = message.body().getJsonObject("Pet");
if (petParam == null) {
manageError(message, new MainApiException(400, "Pet is required"), serviceId);
return;
}
Pet body = Json.mapper.readValue(bodyParam.encode(), Pet.class);
service.addPet(body, result -> {
Pet pet = Json.mapper.readValue(petParam.encode(), Pet.class);
service.addPet(pet, result -> {
if (result.succeeded())
message.reply(null);
else {
@@ -177,13 +177,13 @@ public class PetApiVerticle extends AbstractVerticle {
try {
// 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);
JsonObject petParam = message.body().getJsonObject("Pet");
if (petParam == null) {
manageError(message, new MainApiException(400, "Pet is required"), serviceId);
return;
}
Pet body = Json.mapper.readValue(bodyParam.encode(), Pet.class);
service.updatePet(body, result -> {
Pet pet = Json.mapper.readValue(petParam.encode(), Pet.class);
service.updatePet(pet, result -> {
if (result.succeeded())
message.reply(null);
else {
@@ -239,12 +239,8 @@ public class PetApiVerticle extends AbstractVerticle {
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);
String fileParam = message.body().getString("file");
File file = (fileParam == null) ? null : Json.mapper.readValue(fileParam, File.class);
service.uploadFile(petId, additionalMetadata, file, result -> {
if (result.succeeded())
message.reply(new JsonObject(Json.encode(result.result())).encodePrettily());

View File

@@ -1,7 +1,7 @@
package io.swagger.server.api.verticle;
package org.openapitools.server.api.verticle;
import io.swagger.server.api.MainApiException;
import io.swagger.server.api.model.Order;
import org.openapitools.server.api.MainApiException;
import org.openapitools.server.api.model.Order;
import io.vertx.core.AsyncResult;
import io.vertx.core.Handler;
@@ -20,6 +20,6 @@ public interface StoreApi {
void getOrderById(Long orderId, Handler<AsyncResult<Order>> handler);
//placeOrder
void placeOrder(Order body, Handler<AsyncResult<Order>> handler);
void placeOrder(Order order, Handler<AsyncResult<Order>> handler);
}

View File

@@ -1,7 +1,7 @@
package io.swagger.server.api.verticle;
package org.openapitools.server.api.verticle;
import io.swagger.server.api.MainApiException;
import io.swagger.server.api.model.Order;
import org.openapitools.server.api.MainApiException;
import org.openapitools.server.api.model.Order;
public final class StoreApiException extends MainApiException {
public StoreApiException(int statusCode, String statusMessage) {

View File

@@ -1,4 +1,4 @@
package io.swagger.server.api.verticle;
package org.openapitools.server.api.verticle;
import io.vertx.core.AbstractVerticle;
import io.vertx.core.eventbus.Message;
@@ -8,8 +8,8 @@ import io.vertx.core.json.JsonObject;
import io.vertx.core.logging.Logger;
import io.vertx.core.logging.LoggerFactory;
import io.swagger.server.api.MainApiException;
import io.swagger.server.api.model.Order;
import org.openapitools.server.api.MainApiException;
import org.openapitools.server.api.model.Order;
import java.util.List;
import java.util.Map;
@@ -26,7 +26,7 @@ public class StoreApiVerticle extends AbstractVerticle {
public StoreApiVerticle() {
try {
Class serviceImplClass = getClass().getClassLoader().loadClass("io.swagger.server.api.verticle.StoreApiImpl");
Class serviceImplClass = getClass().getClassLoader().loadClass("org.openapitools.server.api.verticle.StoreApiImpl");
service = (StoreApi)serviceImplClass.newInstance();
} catch (Exception e) {
logUnexpectedError("StoreApiVerticle constructor", e);
@@ -111,13 +111,13 @@ public class StoreApiVerticle extends AbstractVerticle {
try {
// 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);
JsonObject orderParam = message.body().getJsonObject("Order");
if (orderParam == null) {
manageError(message, new MainApiException(400, "Order is required"), serviceId);
return;
}
Order body = Json.mapper.readValue(bodyParam.encode(), Order.class);
service.placeOrder(body, result -> {
Order order = Json.mapper.readValue(orderParam.encode(), Order.class);
service.placeOrder(order, result -> {
if (result.succeeded())
message.reply(new JsonObject(Json.encode(result.result())).encodePrettily());
else {

View File

@@ -1,7 +1,7 @@
package io.swagger.server.api.verticle;
package org.openapitools.server.api.verticle;
import io.swagger.server.api.MainApiException;
import io.swagger.server.api.model.User;
import org.openapitools.server.api.MainApiException;
import org.openapitools.server.api.model.User;
import io.vertx.core.AsyncResult;
import io.vertx.core.Handler;
@@ -11,13 +11,13 @@ import java.util.Map;
public interface UserApi {
//createUser
void createUser(User body, Handler<AsyncResult<Void>> handler);
void createUser(User user, Handler<AsyncResult<Void>> handler);
//createUsersWithArrayInput
void createUsersWithArrayInput(List<User> body, Handler<AsyncResult<Void>> handler);
void createUsersWithArrayInput(List<User> user, Handler<AsyncResult<Void>> handler);
//createUsersWithListInput
void createUsersWithListInput(List<User> body, Handler<AsyncResult<Void>> handler);
void createUsersWithListInput(List<User> user, Handler<AsyncResult<Void>> handler);
//deleteUser
void deleteUser(String username, Handler<AsyncResult<Void>> handler);
@@ -32,6 +32,6 @@ public interface UserApi {
void logoutUser(Handler<AsyncResult<Void>> handler);
//updateUser
void updateUser(String username, User body, Handler<AsyncResult<Void>> handler);
void updateUser(String username, User user, Handler<AsyncResult<Void>> handler);
}

View File

@@ -1,7 +1,7 @@
package io.swagger.server.api.verticle;
package org.openapitools.server.api.verticle;
import io.swagger.server.api.MainApiException;
import io.swagger.server.api.model.User;
import org.openapitools.server.api.MainApiException;
import org.openapitools.server.api.model.User;
public final class UserApiException extends MainApiException {
public UserApiException(int statusCode, String statusMessage) {

View File

@@ -1,4 +1,4 @@
package io.swagger.server.api.verticle;
package org.openapitools.server.api.verticle;
import io.vertx.core.AbstractVerticle;
import io.vertx.core.eventbus.Message;
@@ -8,8 +8,8 @@ import io.vertx.core.json.JsonObject;
import io.vertx.core.logging.Logger;
import io.vertx.core.logging.LoggerFactory;
import io.swagger.server.api.MainApiException;
import io.swagger.server.api.model.User;
import org.openapitools.server.api.MainApiException;
import org.openapitools.server.api.model.User;
import java.util.List;
import java.util.Map;
@@ -30,7 +30,7 @@ public class UserApiVerticle extends AbstractVerticle {
public UserApiVerticle() {
try {
Class serviceImplClass = getClass().getClassLoader().loadClass("io.swagger.server.api.verticle.UserApiImpl");
Class serviceImplClass = getClass().getClassLoader().loadClass("org.openapitools.server.api.verticle.UserApiImpl");
service = (UserApi)serviceImplClass.newInstance();
} catch (Exception e) {
logUnexpectedError("UserApiVerticle constructor", e);
@@ -46,13 +46,13 @@ public class UserApiVerticle extends AbstractVerticle {
try {
// 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);
JsonObject userParam = message.body().getJsonObject("User");
if (userParam == null) {
manageError(message, new MainApiException(400, "User is required"), serviceId);
return;
}
User body = Json.mapper.readValue(bodyParam.encode(), User.class);
service.createUser(body, result -> {
User user = Json.mapper.readValue(userParam.encode(), User.class);
service.createUser(user, result -> {
if (result.succeeded())
message.reply(null);
else {
@@ -71,14 +71,14 @@ public class UserApiVerticle extends AbstractVerticle {
try {
// 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);
JsonArray userParam = message.body().getJsonArray("User");
if(userParam == null) {
manageError(message, new MainApiException(400, "User is required"), serviceId);
return;
}
List<User> body = Json.mapper.readValue(bodyParam.encode(),
Json.mapper.getTypeFactory().constructCollectionType(List.class, User.class));
service.createUsersWithArrayInput(body, result -> {
List<User> user = Json.mapper.readValue(userParam.encode(),
Json.mapper.getTypeFactory().constructCollectionType(List.class, List.class));
service.createUsersWithArrayInput(user, result -> {
if (result.succeeded())
message.reply(null);
else {
@@ -97,14 +97,14 @@ public class UserApiVerticle extends AbstractVerticle {
try {
// 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);
JsonArray userParam = message.body().getJsonArray("User");
if(userParam == null) {
manageError(message, new MainApiException(400, "User is required"), serviceId);
return;
}
List<User> body = Json.mapper.readValue(bodyParam.encode(),
Json.mapper.getTypeFactory().constructCollectionType(List.class, User.class));
service.createUsersWithListInput(body, result -> {
List<User> user = Json.mapper.readValue(userParam.encode(),
Json.mapper.getTypeFactory().constructCollectionType(List.class, List.class));
service.createUsersWithListInput(user, result -> {
if (result.succeeded())
message.reply(null);
else {
@@ -229,13 +229,13 @@ public class UserApiVerticle extends AbstractVerticle {
return;
}
String username = usernameParam;
JsonObject bodyParam = message.body().getJsonObject("body");
if (bodyParam == null) {
manageError(message, new MainApiException(400, "body is required"), serviceId);
JsonObject userParam = message.body().getJsonObject("User");
if (userParam == null) {
manageError(message, new MainApiException(400, "User is required"), serviceId);
return;
}
User body = Json.mapper.readValue(bodyParam.encode(), User.class);
service.updateUser(username, body, result -> {
User user = Json.mapper.readValue(userParam.encode(), User.class);
service.updateUser(username, user, result -> {
if (result.succeeded())
message.reply(null);
else {

File diff suppressed because it is too large Load Diff

View File

@@ -1,860 +0,0 @@
{
"swagger" : "2.0",
"info" : {
"description" : "This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.",
"version" : "1.0.0",
"title" : "Swagger Petstore",
"termsOfService" : "http://swagger.io/terms/",
"contact" : {
"email" : "apiteam@swagger.io"
},
"license" : {
"name" : "Apache-2.0",
"url" : "http://www.apache.org/licenses/LICENSE-2.0.html"
}
},
"host" : "petstore.swagger.io",
"basePath" : "/v2",
"tags" : [ {
"name" : "pet",
"description" : "Everything about your Pets",
"externalDocs" : {
"description" : "Find out more",
"url" : "http://swagger.io"
}
}, {
"name" : "store",
"description" : "Access to Petstore orders"
}, {
"name" : "user",
"description" : "Operations about user",
"externalDocs" : {
"description" : "Find out more about our store",
"url" : "http://swagger.io"
}
} ],
"schemes" : [ "http" ],
"paths" : {
"/pet" : {
"post" : {
"tags" : [ "pet" ],
"summary" : "Add a new pet to the store",
"description" : "",
"operationId" : "addPet",
"consumes" : [ "application/json", "application/xml" ],
"produces" : [ "application/xml", "application/json" ],
"parameters" : [ {
"in" : "body",
"name" : "body",
"description" : "Pet object that needs to be added to the store",
"required" : true,
"schema" : {
"$ref" : "#/definitions/Pet"
}
} ],
"responses" : {
"405" : {
"description" : "Invalid input"
}
},
"security" : [ {
"petstore_auth" : [ "write:pets", "read:pets" ]
} ],
"x-contentType" : "application/json",
"x-accepts" : "application/json"
},
"put" : {
"tags" : [ "pet" ],
"summary" : "Update an existing pet",
"description" : "",
"operationId" : "updatePet",
"consumes" : [ "application/json", "application/xml" ],
"produces" : [ "application/xml", "application/json" ],
"parameters" : [ {
"in" : "body",
"name" : "body",
"description" : "Pet object that needs to be added to the store",
"required" : true,
"schema" : {
"$ref" : "#/definitions/Pet"
}
} ],
"responses" : {
"400" : {
"description" : "Invalid ID supplied"
},
"404" : {
"description" : "Pet not found"
},
"405" : {
"description" : "Validation exception"
}
},
"security" : [ {
"petstore_auth" : [ "write:pets", "read:pets" ]
} ],
"x-contentType" : "application/json",
"x-accepts" : "application/json"
}
},
"/pet/findByStatus" : {
"get" : {
"tags" : [ "pet" ],
"summary" : "Finds Pets by status",
"description" : "Multiple status values can be provided with comma separated strings",
"operationId" : "findPetsByStatus",
"produces" : [ "application/xml", "application/json" ],
"parameters" : [ {
"name" : "status",
"in" : "query",
"description" : "Status values that need to be considered for filter",
"required" : true,
"type" : "array",
"items" : {
"type" : "string",
"default" : "available",
"enum" : [ "available", "pending", "sold" ]
},
"collectionFormat" : "csv"
} ],
"responses" : {
"200" : {
"description" : "successful operation",
"schema" : {
"type" : "array",
"items" : {
"$ref" : "#/definitions/Pet"
}
}
},
"400" : {
"description" : "Invalid status value"
}
},
"security" : [ {
"petstore_auth" : [ "write:pets", "read:pets" ]
} ],
"x-accepts" : "application/json"
}
},
"/pet/findByTags" : {
"get" : {
"tags" : [ "pet" ],
"summary" : "Finds Pets by tags",
"description" : "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.",
"operationId" : "findPetsByTags",
"produces" : [ "application/xml", "application/json" ],
"parameters" : [ {
"name" : "tags",
"in" : "query",
"description" : "Tags to filter by",
"required" : true,
"type" : "array",
"items" : {
"type" : "string"
},
"collectionFormat" : "csv"
} ],
"responses" : {
"200" : {
"description" : "successful operation",
"schema" : {
"type" : "array",
"items" : {
"$ref" : "#/definitions/Pet"
}
}
},
"400" : {
"description" : "Invalid tag value"
}
},
"security" : [ {
"petstore_auth" : [ "write:pets", "read:pets" ]
} ],
"deprecated" : true,
"x-accepts" : "application/json"
}
},
"/pet/{petId}" : {
"get" : {
"tags" : [ "pet" ],
"summary" : "Find pet by ID",
"description" : "Returns a single pet",
"operationId" : "getPetById",
"produces" : [ "application/xml", "application/json" ],
"parameters" : [ {
"name" : "petId",
"in" : "path",
"description" : "ID of pet to return",
"required" : true,
"type" : "integer",
"format" : "int64"
} ],
"responses" : {
"200" : {
"description" : "successful operation",
"schema" : {
"$ref" : "#/definitions/Pet"
}
},
"400" : {
"description" : "Invalid ID supplied"
},
"404" : {
"description" : "Pet not found"
}
},
"security" : [ {
"api_key" : [ ]
} ],
"x-accepts" : "application/json"
},
"post" : {
"tags" : [ "pet" ],
"summary" : "Updates a pet in the store with form data",
"description" : "",
"operationId" : "updatePetWithForm",
"consumes" : [ "application/x-www-form-urlencoded" ],
"produces" : [ "application/xml", "application/json" ],
"parameters" : [ {
"name" : "petId",
"in" : "path",
"description" : "ID of pet that needs to be updated",
"required" : true,
"type" : "integer",
"format" : "int64"
}, {
"name" : "name",
"in" : "formData",
"description" : "Updated name of the pet",
"required" : false,
"type" : "string"
}, {
"name" : "status",
"in" : "formData",
"description" : "Updated status of the pet",
"required" : false,
"type" : "string"
} ],
"responses" : {
"405" : {
"description" : "Invalid input"
}
},
"security" : [ {
"petstore_auth" : [ "write:pets", "read:pets" ]
} ],
"x-contentType" : "application/x-www-form-urlencoded",
"x-accepts" : "application/json"
},
"delete" : {
"tags" : [ "pet" ],
"summary" : "Deletes a pet",
"description" : "",
"operationId" : "deletePet",
"produces" : [ "application/xml", "application/json" ],
"parameters" : [ {
"name" : "api_key",
"in" : "header",
"required" : false,
"type" : "string"
}, {
"name" : "petId",
"in" : "path",
"description" : "Pet id to delete",
"required" : true,
"type" : "integer",
"format" : "int64"
} ],
"responses" : {
"400" : {
"description" : "Invalid pet value"
}
},
"security" : [ {
"petstore_auth" : [ "write:pets", "read:pets" ]
} ],
"x-accepts" : "application/json"
}
},
"/pet/{petId}/uploadImage" : {
"post" : {
"tags" : [ "pet" ],
"summary" : "uploads an image",
"description" : "",
"operationId" : "uploadFile",
"consumes" : [ "multipart/form-data" ],
"produces" : [ "application/json" ],
"parameters" : [ {
"name" : "petId",
"in" : "path",
"description" : "ID of pet to update",
"required" : true,
"type" : "integer",
"format" : "int64"
}, {
"name" : "additionalMetadata",
"in" : "formData",
"description" : "Additional data to pass to server",
"required" : false,
"type" : "string"
}, {
"name" : "file",
"in" : "formData",
"description" : "file to upload",
"required" : false,
"type" : "file"
} ],
"responses" : {
"200" : {
"description" : "successful operation",
"schema" : {
"$ref" : "#/definitions/ApiResponse"
}
}
},
"security" : [ {
"petstore_auth" : [ "write:pets", "read:pets" ]
} ],
"x-contentType" : "multipart/form-data",
"x-accepts" : "application/json"
}
},
"/store/inventory" : {
"get" : {
"tags" : [ "store" ],
"summary" : "Returns pet inventories by status",
"description" : "Returns a map of status codes to quantities",
"operationId" : "getInventory",
"produces" : [ "application/json" ],
"parameters" : [ ],
"responses" : {
"200" : {
"description" : "successful operation",
"schema" : {
"type" : "object",
"additionalProperties" : {
"type" : "integer",
"format" : "int32"
}
}
}
},
"security" : [ {
"api_key" : [ ]
} ],
"x-accepts" : "application/json"
}
},
"/store/order" : {
"post" : {
"tags" : [ "store" ],
"summary" : "Place an order for a pet",
"description" : "",
"operationId" : "placeOrder",
"produces" : [ "application/xml", "application/json" ],
"parameters" : [ {
"in" : "body",
"name" : "body",
"description" : "order placed for purchasing the pet",
"required" : true,
"schema" : {
"$ref" : "#/definitions/Order"
}
} ],
"responses" : {
"200" : {
"description" : "successful operation",
"schema" : {
"$ref" : "#/definitions/Order"
}
},
"400" : {
"description" : "Invalid Order"
}
},
"x-contentType" : "application/json",
"x-accepts" : "application/json"
}
},
"/store/order/{orderId}" : {
"get" : {
"tags" : [ "store" ],
"summary" : "Find purchase order by ID",
"description" : "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions",
"operationId" : "getOrderById",
"produces" : [ "application/xml", "application/json" ],
"parameters" : [ {
"name" : "orderId",
"in" : "path",
"description" : "ID of pet that needs to be fetched",
"required" : true,
"type" : "integer",
"maximum" : 5,
"minimum" : 1,
"format" : "int64"
} ],
"responses" : {
"200" : {
"description" : "successful operation",
"schema" : {
"$ref" : "#/definitions/Order"
}
},
"400" : {
"description" : "Invalid ID supplied"
},
"404" : {
"description" : "Order not found"
}
},
"x-accepts" : "application/json"
},
"delete" : {
"tags" : [ "store" ],
"summary" : "Delete purchase order by ID",
"description" : "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors",
"operationId" : "deleteOrder",
"produces" : [ "application/xml", "application/json" ],
"parameters" : [ {
"name" : "orderId",
"in" : "path",
"description" : "ID of the order that needs to be deleted",
"required" : true,
"type" : "string"
} ],
"responses" : {
"400" : {
"description" : "Invalid ID supplied"
},
"404" : {
"description" : "Order not found"
}
},
"x-accepts" : "application/json"
}
},
"/user" : {
"post" : {
"tags" : [ "user" ],
"summary" : "Create user",
"description" : "This can only be done by the logged in user.",
"operationId" : "createUser",
"produces" : [ "application/xml", "application/json" ],
"parameters" : [ {
"in" : "body",
"name" : "body",
"description" : "Created user object",
"required" : true,
"schema" : {
"$ref" : "#/definitions/User"
}
} ],
"responses" : {
"default" : {
"description" : "successful operation"
}
},
"x-contentType" : "application/json",
"x-accepts" : "application/json"
}
},
"/user/createWithArray" : {
"post" : {
"tags" : [ "user" ],
"summary" : "Creates list of users with given input array",
"description" : "",
"operationId" : "createUsersWithArrayInput",
"produces" : [ "application/xml", "application/json" ],
"parameters" : [ {
"in" : "body",
"name" : "body",
"description" : "List of user object",
"required" : true,
"schema" : {
"type" : "array",
"items" : {
"$ref" : "#/definitions/User"
}
}
} ],
"responses" : {
"default" : {
"description" : "successful operation"
}
},
"x-contentType" : "application/json",
"x-accepts" : "application/json"
}
},
"/user/createWithList" : {
"post" : {
"tags" : [ "user" ],
"summary" : "Creates list of users with given input array",
"description" : "",
"operationId" : "createUsersWithListInput",
"produces" : [ "application/xml", "application/json" ],
"parameters" : [ {
"in" : "body",
"name" : "body",
"description" : "List of user object",
"required" : true,
"schema" : {
"type" : "array",
"items" : {
"$ref" : "#/definitions/User"
}
}
} ],
"responses" : {
"default" : {
"description" : "successful operation"
}
},
"x-contentType" : "application/json",
"x-accepts" : "application/json"
}
},
"/user/login" : {
"get" : {
"tags" : [ "user" ],
"summary" : "Logs user into the system",
"description" : "",
"operationId" : "loginUser",
"produces" : [ "application/xml", "application/json" ],
"parameters" : [ {
"name" : "username",
"in" : "query",
"description" : "The user name for login",
"required" : true,
"type" : "string"
}, {
"name" : "password",
"in" : "query",
"description" : "The password for login in clear text",
"required" : true,
"type" : "string"
} ],
"responses" : {
"200" : {
"description" : "successful operation",
"schema" : {
"type" : "string"
},
"headers" : {
"X-Rate-Limit" : {
"type" : "integer",
"format" : "int32",
"description" : "calls per hour allowed by the user"
},
"X-Expires-After" : {
"type" : "string",
"format" : "date-time",
"description" : "date in UTC when toekn expires"
}
}
},
"400" : {
"description" : "Invalid username/password supplied"
}
},
"x-accepts" : "application/json"
}
},
"/user/logout" : {
"get" : {
"tags" : [ "user" ],
"summary" : "Logs out current logged in user session",
"description" : "",
"operationId" : "logoutUser",
"produces" : [ "application/xml", "application/json" ],
"parameters" : [ ],
"responses" : {
"default" : {
"description" : "successful operation"
}
},
"x-accepts" : "application/json"
}
},
"/user/{username}" : {
"get" : {
"tags" : [ "user" ],
"summary" : "Get user by user name",
"description" : "",
"operationId" : "getUserByName",
"produces" : [ "application/xml", "application/json" ],
"parameters" : [ {
"name" : "username",
"in" : "path",
"description" : "The name that needs to be fetched. Use user1 for testing. ",
"required" : true,
"type" : "string"
} ],
"responses" : {
"200" : {
"description" : "successful operation",
"schema" : {
"$ref" : "#/definitions/User"
}
},
"400" : {
"description" : "Invalid username supplied"
},
"404" : {
"description" : "User not found"
}
},
"x-accepts" : "application/json"
},
"put" : {
"tags" : [ "user" ],
"summary" : "Updated user",
"description" : "This can only be done by the logged in user.",
"operationId" : "updateUser",
"produces" : [ "application/xml", "application/json" ],
"parameters" : [ {
"name" : "username",
"in" : "path",
"description" : "name that need to be deleted",
"required" : true,
"type" : "string"
}, {
"in" : "body",
"name" : "body",
"description" : "Updated user object",
"required" : true,
"schema" : {
"$ref" : "#/definitions/User"
}
} ],
"responses" : {
"400" : {
"description" : "Invalid user supplied"
},
"404" : {
"description" : "User not found"
}
},
"x-contentType" : "application/json",
"x-accepts" : "application/json"
},
"delete" : {
"tags" : [ "user" ],
"summary" : "Delete user",
"description" : "This can only be done by the logged in user.",
"operationId" : "deleteUser",
"produces" : [ "application/xml", "application/json" ],
"parameters" : [ {
"name" : "username",
"in" : "path",
"description" : "The name that needs to be deleted",
"required" : true,
"type" : "string"
} ],
"responses" : {
"400" : {
"description" : "Invalid username supplied"
},
"404" : {
"description" : "User not found"
}
},
"x-accepts" : "application/json"
}
}
},
"securityDefinitions" : {
"petstore_auth" : {
"type" : "oauth2",
"authorizationUrl" : "http://petstore.swagger.io/api/oauth/dialog",
"flow" : "implicit",
"scopes" : {
"write:pets" : "modify pets in your account",
"read:pets" : "read your pets"
}
},
"api_key" : {
"type" : "apiKey",
"name" : "api_key",
"in" : "header"
}
},
"definitions" : {
"Order" : {
"type" : "object",
"properties" : {
"id" : {
"type" : "integer",
"format" : "int64"
},
"petId" : {
"type" : "integer",
"format" : "int64"
},
"quantity" : {
"type" : "integer",
"format" : "int32"
},
"shipDate" : {
"type" : "string",
"format" : "date-time"
},
"status" : {
"type" : "string",
"description" : "Order Status",
"enum" : [ "placed", "approved", "delivered" ]
},
"complete" : {
"type" : "boolean",
"default" : false
}
},
"title" : "Pet Order",
"description" : "An order for a pets from the pet store",
"xml" : {
"name" : "Order"
}
},
"Category" : {
"type" : "object",
"properties" : {
"id" : {
"type" : "integer",
"format" : "int64"
},
"name" : {
"type" : "string"
}
},
"title" : "Pet category",
"description" : "A category for a pet",
"xml" : {
"name" : "Category"
}
},
"User" : {
"type" : "object",
"properties" : {
"id" : {
"type" : "integer",
"format" : "int64"
},
"username" : {
"type" : "string"
},
"firstName" : {
"type" : "string"
},
"lastName" : {
"type" : "string"
},
"email" : {
"type" : "string"
},
"password" : {
"type" : "string"
},
"phone" : {
"type" : "string"
},
"userStatus" : {
"type" : "integer",
"format" : "int32",
"description" : "User Status"
}
},
"title" : "a User",
"description" : "A User who is purchasing from the pet store",
"xml" : {
"name" : "User"
}
},
"Tag" : {
"type" : "object",
"properties" : {
"id" : {
"type" : "integer",
"format" : "int64"
},
"name" : {
"type" : "string"
}
},
"title" : "Pet Tag",
"description" : "A tag for a pet",
"xml" : {
"name" : "Tag"
}
},
"Pet" : {
"type" : "object",
"required" : [ "name", "photoUrls" ],
"properties" : {
"id" : {
"type" : "integer",
"format" : "int64"
},
"category" : {
"$ref" : "#/definitions/Category"
},
"name" : {
"type" : "string",
"example" : "doggie"
},
"photoUrls" : {
"type" : "array",
"xml" : {
"name" : "photoUrl",
"wrapped" : true
},
"items" : {
"type" : "string"
}
},
"tags" : {
"type" : "array",
"xml" : {
"name" : "tag",
"wrapped" : true
},
"items" : {
"$ref" : "#/definitions/Tag"
}
},
"status" : {
"type" : "string",
"description" : "pet status in the store",
"enum" : [ "available", "pending", "sold" ]
}
},
"title" : "a Pet",
"description" : "A pet for sale in the pet store",
"xml" : {
"name" : "Pet"
}
},
"ApiResponse" : {
"type" : "object",
"properties" : {
"code" : {
"type" : "integer",
"format" : "int32"
},
"type" : {
"type" : "string"
},
"message" : {
"type" : "string"
}
},
"title" : "An uploaded response",
"description" : "Describes the result of uploading an image resource"
}
},
"externalDocs" : {
"description" : "Find out more about Swagger",
"url" : "http://swagger.io"
}
}

View File

@@ -1,11 +1,11 @@
# Swagger Codegen Ignore
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.
# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs
# You can match any string of characters against a directory, file or extension with a single asterisk (*):

View File

@@ -1 +1 @@
2.4.0-SNAPSHOT
3.0.0-SNAPSHOT

View File

@@ -1 +0,0 @@
Project generated on : 2017-07-08T16:03:26.358+02:00

View File

@@ -2,7 +2,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>io.swagger</groupId>
<groupId>org.openapitools</groupId>
<artifactId>java-vertx-rx-server</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
@@ -28,24 +28,25 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-unit</artifactId>
<version>${vertx.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-unit</artifactId>
<version>${vertx.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.phiz71</groupId>
<artifactId>vertx-swagger-router</artifactId>
<version>${vertx-swagger-router.version}</version>
</dependency>
<groupId>com.github.phiz71</groupId>
<artifactId>vertx-swagger-router</artifactId>
<version>${vertx-swagger-router.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>${jackson-datatype-jsr310.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>${jackson-datatype-jsr310.version}</version>
</dependency>
</dependencies>
<build>
@@ -75,7 +76,7 @@
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<Main-Class>io.vertx.core.Starter</Main-Class>
<Main-Verticle>io.swagger.server.api.MainApiVerticle</Main-Verticle>
<Main-Verticle>org.openapitools.server.api.MainApiVerticle</Main-Verticle>
</manifestEntries>
</transformer>
</transformers>
@@ -87,4 +88,4 @@
</plugin>
</plugins>
</build>
</project>
</project>

View File

@@ -1,4 +1,4 @@
package io.swagger.server.api;
package org.openapitools.server.api;
public class MainApiException extends Exception {
private int statusCode;

View File

@@ -1,4 +1,4 @@
package io.swagger.server.api;
package org.openapitools.server.api;
import java.nio.charset.Charset;
@@ -42,7 +42,7 @@ public class MainApiVerticle extends AbstractVerticle {
public void start(Future<Void> startFuture) throws Exception {
Json.mapper.registerModule(new JavaTimeModule());
FileSystem vertxFileSystem = vertx.fileSystem();
vertxFileSystem.readFile("swagger.json", readFile -> {
vertxFileSystem.readFile("openapi.json", readFile -> {
if (readFile.succeeded()) {
Swagger swagger = new SwaggerParser().parse(readFile.result().toString(Charset.forName("utf-8")));
Router swaggerRouter = SwaggerRouter.swaggerRouter(router, swagger, vertx.eventBus(), new OperationIdServiceIdResolver());
@@ -66,7 +66,7 @@ public class MainApiVerticle extends AbstractVerticle {
public void deployVerticles(Future<Void> startFuture) {
vertx.deployVerticle("io.swagger.server.api.verticle.PetApiVerticle", res -> {
vertx.deployVerticle("org.openapitools.server.api.verticle.PetApiVerticle", res -> {
if (res.succeeded()) {
LOGGER.info("PetApiVerticle : Deployed");
} else {
@@ -75,7 +75,7 @@ public class MainApiVerticle extends AbstractVerticle {
}
});
vertx.deployVerticle("io.swagger.server.api.verticle.StoreApiVerticle", res -> {
vertx.deployVerticle("org.openapitools.server.api.verticle.StoreApiVerticle", res -> {
if (res.succeeded()) {
LOGGER.info("StoreApiVerticle : Deployed");
} else {
@@ -84,7 +84,7 @@ public class MainApiVerticle extends AbstractVerticle {
}
});
vertx.deployVerticle("io.swagger.server.api.verticle.UserApiVerticle", res -> {
vertx.deployVerticle("org.openapitools.server.api.verticle.UserApiVerticle", res -> {
if (res.succeeded()) {
LOGGER.info("UserApiVerticle : Deployed");
} else {

View File

@@ -1,4 +1,4 @@
package io.swagger.server.api.model;
package org.openapitools.server.api.model;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonInclude;

View File

@@ -1,4 +1,4 @@
package io.swagger.server.api.model;
package org.openapitools.server.api.model;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonInclude;

View File

@@ -1,4 +1,4 @@
package io.swagger.server.api.model;
package org.openapitools.server.api.model;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonInclude;

View File

@@ -1,13 +1,13 @@
package io.swagger.server.api.model;
package org.openapitools.server.api.model;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.server.api.model.Category;
import io.swagger.server.api.model.Tag;
import java.util.ArrayList;
import java.util.List;
import org.openapitools.server.api.model.Category;
import org.openapitools.server.api.model.Tag;
/**
* A pet for sale in the pet store

View File

@@ -1,4 +1,4 @@
package io.swagger.server.api.model;
package org.openapitools.server.api.model;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonInclude;

View File

@@ -1,4 +1,4 @@
package io.swagger.server.api.model;
package org.openapitools.server.api.model;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonInclude;

View File

@@ -1,9 +1,9 @@
package io.swagger.server.api.verticle;
package org.openapitools.server.api.verticle;
import java.io.File;
import io.swagger.server.api.MainApiException;
import io.swagger.server.api.model.ModelApiResponse;
import io.swagger.server.api.model.Pet;
import org.openapitools.server.api.MainApiException;
import org.openapitools.server.api.model.ModelApiResponse;
import org.openapitools.server.api.model.Pet;
import rx.Completable;
import rx.Single;
@@ -13,7 +13,7 @@ import java.util.Map;
public interface PetApi {
//addPet
public Completable addPet(Pet body);
public Completable addPet(Pet pet);
//deletePet
public Completable deletePet(Long petId,String apiKey);
@@ -28,7 +28,7 @@ public interface PetApi {
public Single<Pet> getPetById(Long petId);
//updatePet
public Completable updatePet(Pet body);
public Completable updatePet(Pet pet);
//updatePetWithForm
public Completable updatePetWithForm(Long petId,String name,String status);

View File

@@ -1,9 +1,9 @@
package io.swagger.server.api.verticle;
package org.openapitools.server.api.verticle;
import java.io.File;
import io.swagger.server.api.MainApiException;
import io.swagger.server.api.model.ModelApiResponse;
import io.swagger.server.api.model.Pet;
import org.openapitools.server.api.MainApiException;
import org.openapitools.server.api.model.ModelApiResponse;
import org.openapitools.server.api.model.Pet;
public final class PetApiException extends MainApiException {
public PetApiException(int statusCode, String statusMessage) {

View File

@@ -1,4 +1,4 @@
package io.swagger.server.api.verticle;
package org.openapitools.server.api.verticle;
import io.vertx.core.AbstractVerticle;
import io.vertx.core.eventbus.Message;
@@ -9,9 +9,9 @@ import io.vertx.core.logging.Logger;
import io.vertx.core.logging.LoggerFactory;
import java.io.File;
import io.swagger.server.api.MainApiException;
import io.swagger.server.api.model.ModelApiResponse;
import io.swagger.server.api.model.Pet;
import org.openapitools.server.api.MainApiException;
import org.openapitools.server.api.model.ModelApiResponse;
import org.openapitools.server.api.model.Pet;
import java.util.List;
import java.util.Map;
@@ -32,7 +32,7 @@ public class PetApiVerticle extends AbstractVerticle {
public PetApiVerticle() {
try {
Class serviceImplClass = getClass().getClassLoader().loadClass("io.swagger.server.api.verticle.PetApiImpl");
Class serviceImplClass = getClass().getClassLoader().loadClass("org.openapitools.server.api.verticle.PetApiImpl");
service = (PetApi)serviceImplClass.newInstance();
} catch (Exception e) {
logUnexpectedError("PetApiVerticle constructor", e);
@@ -48,13 +48,13 @@ public class PetApiVerticle extends AbstractVerticle {
try {
// 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);
JsonObject petParam = message.body().getJsonObject("Pet");
if (petParam == null) {
manageError(message, new MainApiException(400, "Pet is required"), serviceId);
return;
}
Pet body = Json.mapper.readValue(bodyParam.encode(), Pet.class);
service.addPet(body).subscribe(
Pet pet = Json.mapper.readValue(petParam.encode(), Pet.class);
service.addPet(pet).subscribe(
() -> {
message.reply(null);
},
@@ -172,13 +172,13 @@ public class PetApiVerticle extends AbstractVerticle {
try {
// 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);
JsonObject petParam = message.body().getJsonObject("Pet");
if (petParam == null) {
manageError(message, new MainApiException(400, "Pet is required"), serviceId);
return;
}
Pet body = Json.mapper.readValue(bodyParam.encode(), Pet.class);
service.updatePet(body).subscribe(
Pet pet = Json.mapper.readValue(petParam.encode(), Pet.class);
service.updatePet(pet).subscribe(
() -> {
message.reply(null);
},
@@ -232,12 +232,8 @@ public class PetApiVerticle extends AbstractVerticle {
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);
String fileParam = message.body().getString("file");
File file = (fileParam == null) ? null : Json.mapper.readValue(fileParam, File.class);
service.uploadFile(petId, additionalMetadata, file).subscribe(
result -> {
message.reply(new JsonObject(Json.encode(result)).encodePrettily());

View File

@@ -1,7 +1,7 @@
package io.swagger.server.api.verticle;
package org.openapitools.server.api.verticle;
import io.swagger.server.api.MainApiException;
import io.swagger.server.api.model.Order;
import org.openapitools.server.api.MainApiException;
import org.openapitools.server.api.model.Order;
import rx.Completable;
import rx.Single;
@@ -20,6 +20,6 @@ public interface StoreApi {
public Single<Order> getOrderById(Long orderId);
//placeOrder
public Single<Order> placeOrder(Order body);
public Single<Order> placeOrder(Order order);
}

View File

@@ -1,7 +1,7 @@
package io.swagger.server.api.verticle;
package org.openapitools.server.api.verticle;
import io.swagger.server.api.MainApiException;
import io.swagger.server.api.model.Order;
import org.openapitools.server.api.MainApiException;
import org.openapitools.server.api.model.Order;
public final class StoreApiException extends MainApiException {
public StoreApiException(int statusCode, String statusMessage) {

View File

@@ -1,4 +1,4 @@
package io.swagger.server.api.verticle;
package org.openapitools.server.api.verticle;
import io.vertx.core.AbstractVerticle;
import io.vertx.core.eventbus.Message;
@@ -8,8 +8,8 @@ import io.vertx.core.json.JsonObject;
import io.vertx.core.logging.Logger;
import io.vertx.core.logging.LoggerFactory;
import io.swagger.server.api.MainApiException;
import io.swagger.server.api.model.Order;
import org.openapitools.server.api.MainApiException;
import org.openapitools.server.api.model.Order;
import java.util.List;
import java.util.Map;
@@ -26,7 +26,7 @@ public class StoreApiVerticle extends AbstractVerticle {
public StoreApiVerticle() {
try {
Class serviceImplClass = getClass().getClassLoader().loadClass("io.swagger.server.api.verticle.StoreApiImpl");
Class serviceImplClass = getClass().getClassLoader().loadClass("org.openapitools.server.api.verticle.StoreApiImpl");
service = (StoreApi)serviceImplClass.newInstance();
} catch (Exception e) {
logUnexpectedError("StoreApiVerticle constructor", e);
@@ -108,13 +108,13 @@ public class StoreApiVerticle extends AbstractVerticle {
try {
// 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);
JsonObject orderParam = message.body().getJsonObject("Order");
if (orderParam == null) {
manageError(message, new MainApiException(400, "Order is required"), serviceId);
return;
}
Order body = Json.mapper.readValue(bodyParam.encode(), Order.class);
service.placeOrder(body).subscribe(
Order order = Json.mapper.readValue(orderParam.encode(), Order.class);
service.placeOrder(order).subscribe(
result -> {
message.reply(new JsonObject(Json.encode(result)).encodePrettily());
},

View File

@@ -1,7 +1,7 @@
package io.swagger.server.api.verticle;
package org.openapitools.server.api.verticle;
import io.swagger.server.api.MainApiException;
import io.swagger.server.api.model.User;
import org.openapitools.server.api.MainApiException;
import org.openapitools.server.api.model.User;
import rx.Completable;
import rx.Single;
@@ -11,13 +11,13 @@ import java.util.Map;
public interface UserApi {
//createUser
public Completable createUser(User body);
public Completable createUser(User user);
//createUsersWithArrayInput
public Completable createUsersWithArrayInput(List<User> body);
public Completable createUsersWithArrayInput(List<User> user);
//createUsersWithListInput
public Completable createUsersWithListInput(List<User> body);
public Completable createUsersWithListInput(List<User> user);
//deleteUser
public Completable deleteUser(String username);
@@ -32,6 +32,6 @@ public interface UserApi {
public Completable logoutUser();
//updateUser
public Completable updateUser(String username,User body);
public Completable updateUser(String username,User user);
}

View File

@@ -1,7 +1,7 @@
package io.swagger.server.api.verticle;
package org.openapitools.server.api.verticle;
import io.swagger.server.api.MainApiException;
import io.swagger.server.api.model.User;
import org.openapitools.server.api.MainApiException;
import org.openapitools.server.api.model.User;
public final class UserApiException extends MainApiException {
public UserApiException(int statusCode, String statusMessage) {

View File

@@ -1,4 +1,4 @@
package io.swagger.server.api.verticle;
package org.openapitools.server.api.verticle;
import io.vertx.core.AbstractVerticle;
import io.vertx.core.eventbus.Message;
@@ -8,8 +8,8 @@ import io.vertx.core.json.JsonObject;
import io.vertx.core.logging.Logger;
import io.vertx.core.logging.LoggerFactory;
import io.swagger.server.api.MainApiException;
import io.swagger.server.api.model.User;
import org.openapitools.server.api.MainApiException;
import org.openapitools.server.api.model.User;
import java.util.List;
import java.util.Map;
@@ -30,7 +30,7 @@ public class UserApiVerticle extends AbstractVerticle {
public UserApiVerticle() {
try {
Class serviceImplClass = getClass().getClassLoader().loadClass("io.swagger.server.api.verticle.UserApiImpl");
Class serviceImplClass = getClass().getClassLoader().loadClass("org.openapitools.server.api.verticle.UserApiImpl");
service = (UserApi)serviceImplClass.newInstance();
} catch (Exception e) {
logUnexpectedError("UserApiVerticle constructor", e);
@@ -46,13 +46,13 @@ public class UserApiVerticle extends AbstractVerticle {
try {
// 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);
JsonObject userParam = message.body().getJsonObject("User");
if (userParam == null) {
manageError(message, new MainApiException(400, "User is required"), serviceId);
return;
}
User body = Json.mapper.readValue(bodyParam.encode(), User.class);
service.createUser(body).subscribe(
User user = Json.mapper.readValue(userParam.encode(), User.class);
service.createUser(user).subscribe(
() -> {
message.reply(null);
},
@@ -70,14 +70,14 @@ public class UserApiVerticle extends AbstractVerticle {
try {
// 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);
JsonArray userParam = message.body().getJsonArray("User");
if(userParam == null) {
manageError(message, new MainApiException(400, "User is required"), serviceId);
return;
}
List<User> body = Json.mapper.readValue(bodyParam.encode(),
Json.mapper.getTypeFactory().constructCollectionType(List.class, User.class));
service.createUsersWithArrayInput(body).subscribe(
List<User> user = Json.mapper.readValue(userParam.encode(),
Json.mapper.getTypeFactory().constructCollectionType(List.class, List.class));
service.createUsersWithArrayInput(user).subscribe(
() -> {
message.reply(null);
},
@@ -95,14 +95,14 @@ public class UserApiVerticle extends AbstractVerticle {
try {
// 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);
JsonArray userParam = message.body().getJsonArray("User");
if(userParam == null) {
manageError(message, new MainApiException(400, "User is required"), serviceId);
return;
}
List<User> body = Json.mapper.readValue(bodyParam.encode(),
Json.mapper.getTypeFactory().constructCollectionType(List.class, User.class));
service.createUsersWithListInput(body).subscribe(
List<User> user = Json.mapper.readValue(userParam.encode(),
Json.mapper.getTypeFactory().constructCollectionType(List.class, List.class));
service.createUsersWithListInput(user).subscribe(
() -> {
message.reply(null);
},
@@ -222,13 +222,13 @@ public class UserApiVerticle extends AbstractVerticle {
return;
}
String username = usernameParam;
JsonObject bodyParam = message.body().getJsonObject("body");
if (bodyParam == null) {
manageError(message, new MainApiException(400, "body is required"), serviceId);
JsonObject userParam = message.body().getJsonObject("User");
if (userParam == null) {
manageError(message, new MainApiException(400, "User is required"), serviceId);
return;
}
User body = Json.mapper.readValue(bodyParam.encode(), User.class);
service.updateUser(username, body).subscribe(
User user = Json.mapper.readValue(userParam.encode(), User.class);
service.updateUser(username, user).subscribe(
() -> {
message.reply(null);
},

File diff suppressed because it is too large Load Diff

View File

@@ -1,860 +0,0 @@
{
"swagger" : "2.0",
"info" : {
"description" : "This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.",
"version" : "1.0.0",
"title" : "Swagger Petstore",
"termsOfService" : "http://swagger.io/terms/",
"contact" : {
"email" : "apiteam@swagger.io"
},
"license" : {
"name" : "Apache-2.0",
"url" : "http://www.apache.org/licenses/LICENSE-2.0.html"
}
},
"host" : "petstore.swagger.io",
"basePath" : "/v2",
"tags" : [ {
"name" : "pet",
"description" : "Everything about your Pets",
"externalDocs" : {
"description" : "Find out more",
"url" : "http://swagger.io"
}
}, {
"name" : "store",
"description" : "Access to Petstore orders"
}, {
"name" : "user",
"description" : "Operations about user",
"externalDocs" : {
"description" : "Find out more about our store",
"url" : "http://swagger.io"
}
} ],
"schemes" : [ "http" ],
"paths" : {
"/pet" : {
"post" : {
"tags" : [ "pet" ],
"summary" : "Add a new pet to the store",
"description" : "",
"operationId" : "addPet",
"consumes" : [ "application/json", "application/xml" ],
"produces" : [ "application/xml", "application/json" ],
"parameters" : [ {
"in" : "body",
"name" : "body",
"description" : "Pet object that needs to be added to the store",
"required" : true,
"schema" : {
"$ref" : "#/definitions/Pet"
}
} ],
"responses" : {
"405" : {
"description" : "Invalid input"
}
},
"security" : [ {
"petstore_auth" : [ "write:pets", "read:pets" ]
} ],
"x-contentType" : "application/json",
"x-accepts" : "application/json"
},
"put" : {
"tags" : [ "pet" ],
"summary" : "Update an existing pet",
"description" : "",
"operationId" : "updatePet",
"consumes" : [ "application/json", "application/xml" ],
"produces" : [ "application/xml", "application/json" ],
"parameters" : [ {
"in" : "body",
"name" : "body",
"description" : "Pet object that needs to be added to the store",
"required" : true,
"schema" : {
"$ref" : "#/definitions/Pet"
}
} ],
"responses" : {
"400" : {
"description" : "Invalid ID supplied"
},
"404" : {
"description" : "Pet not found"
},
"405" : {
"description" : "Validation exception"
}
},
"security" : [ {
"petstore_auth" : [ "write:pets", "read:pets" ]
} ],
"x-contentType" : "application/json",
"x-accepts" : "application/json"
}
},
"/pet/findByStatus" : {
"get" : {
"tags" : [ "pet" ],
"summary" : "Finds Pets by status",
"description" : "Multiple status values can be provided with comma separated strings",
"operationId" : "findPetsByStatus",
"produces" : [ "application/xml", "application/json" ],
"parameters" : [ {
"name" : "status",
"in" : "query",
"description" : "Status values that need to be considered for filter",
"required" : true,
"type" : "array",
"items" : {
"type" : "string",
"default" : "available",
"enum" : [ "available", "pending", "sold" ]
},
"collectionFormat" : "csv"
} ],
"responses" : {
"200" : {
"description" : "successful operation",
"schema" : {
"type" : "array",
"items" : {
"$ref" : "#/definitions/Pet"
}
}
},
"400" : {
"description" : "Invalid status value"
}
},
"security" : [ {
"petstore_auth" : [ "write:pets", "read:pets" ]
} ],
"x-accepts" : "application/json"
}
},
"/pet/findByTags" : {
"get" : {
"tags" : [ "pet" ],
"summary" : "Finds Pets by tags",
"description" : "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.",
"operationId" : "findPetsByTags",
"produces" : [ "application/xml", "application/json" ],
"parameters" : [ {
"name" : "tags",
"in" : "query",
"description" : "Tags to filter by",
"required" : true,
"type" : "array",
"items" : {
"type" : "string"
},
"collectionFormat" : "csv"
} ],
"responses" : {
"200" : {
"description" : "successful operation",
"schema" : {
"type" : "array",
"items" : {
"$ref" : "#/definitions/Pet"
}
}
},
"400" : {
"description" : "Invalid tag value"
}
},
"security" : [ {
"petstore_auth" : [ "write:pets", "read:pets" ]
} ],
"deprecated" : true,
"x-accepts" : "application/json"
}
},
"/pet/{petId}" : {
"get" : {
"tags" : [ "pet" ],
"summary" : "Find pet by ID",
"description" : "Returns a single pet",
"operationId" : "getPetById",
"produces" : [ "application/xml", "application/json" ],
"parameters" : [ {
"name" : "petId",
"in" : "path",
"description" : "ID of pet to return",
"required" : true,
"type" : "integer",
"format" : "int64"
} ],
"responses" : {
"200" : {
"description" : "successful operation",
"schema" : {
"$ref" : "#/definitions/Pet"
}
},
"400" : {
"description" : "Invalid ID supplied"
},
"404" : {
"description" : "Pet not found"
}
},
"security" : [ {
"api_key" : [ ]
} ],
"x-accepts" : "application/json"
},
"post" : {
"tags" : [ "pet" ],
"summary" : "Updates a pet in the store with form data",
"description" : "",
"operationId" : "updatePetWithForm",
"consumes" : [ "application/x-www-form-urlencoded" ],
"produces" : [ "application/xml", "application/json" ],
"parameters" : [ {
"name" : "petId",
"in" : "path",
"description" : "ID of pet that needs to be updated",
"required" : true,
"type" : "integer",
"format" : "int64"
}, {
"name" : "name",
"in" : "formData",
"description" : "Updated name of the pet",
"required" : false,
"type" : "string"
}, {
"name" : "status",
"in" : "formData",
"description" : "Updated status of the pet",
"required" : false,
"type" : "string"
} ],
"responses" : {
"405" : {
"description" : "Invalid input"
}
},
"security" : [ {
"petstore_auth" : [ "write:pets", "read:pets" ]
} ],
"x-contentType" : "application/x-www-form-urlencoded",
"x-accepts" : "application/json"
},
"delete" : {
"tags" : [ "pet" ],
"summary" : "Deletes a pet",
"description" : "",
"operationId" : "deletePet",
"produces" : [ "application/xml", "application/json" ],
"parameters" : [ {
"name" : "api_key",
"in" : "header",
"required" : false,
"type" : "string"
}, {
"name" : "petId",
"in" : "path",
"description" : "Pet id to delete",
"required" : true,
"type" : "integer",
"format" : "int64"
} ],
"responses" : {
"400" : {
"description" : "Invalid pet value"
}
},
"security" : [ {
"petstore_auth" : [ "write:pets", "read:pets" ]
} ],
"x-accepts" : "application/json"
}
},
"/pet/{petId}/uploadImage" : {
"post" : {
"tags" : [ "pet" ],
"summary" : "uploads an image",
"description" : "",
"operationId" : "uploadFile",
"consumes" : [ "multipart/form-data" ],
"produces" : [ "application/json" ],
"parameters" : [ {
"name" : "petId",
"in" : "path",
"description" : "ID of pet to update",
"required" : true,
"type" : "integer",
"format" : "int64"
}, {
"name" : "additionalMetadata",
"in" : "formData",
"description" : "Additional data to pass to server",
"required" : false,
"type" : "string"
}, {
"name" : "file",
"in" : "formData",
"description" : "file to upload",
"required" : false,
"type" : "file"
} ],
"responses" : {
"200" : {
"description" : "successful operation",
"schema" : {
"$ref" : "#/definitions/ApiResponse"
}
}
},
"security" : [ {
"petstore_auth" : [ "write:pets", "read:pets" ]
} ],
"x-contentType" : "multipart/form-data",
"x-accepts" : "application/json"
}
},
"/store/inventory" : {
"get" : {
"tags" : [ "store" ],
"summary" : "Returns pet inventories by status",
"description" : "Returns a map of status codes to quantities",
"operationId" : "getInventory",
"produces" : [ "application/json" ],
"parameters" : [ ],
"responses" : {
"200" : {
"description" : "successful operation",
"schema" : {
"type" : "object",
"additionalProperties" : {
"type" : "integer",
"format" : "int32"
}
}
}
},
"security" : [ {
"api_key" : [ ]
} ],
"x-accepts" : "application/json"
}
},
"/store/order" : {
"post" : {
"tags" : [ "store" ],
"summary" : "Place an order for a pet",
"description" : "",
"operationId" : "placeOrder",
"produces" : [ "application/xml", "application/json" ],
"parameters" : [ {
"in" : "body",
"name" : "body",
"description" : "order placed for purchasing the pet",
"required" : true,
"schema" : {
"$ref" : "#/definitions/Order"
}
} ],
"responses" : {
"200" : {
"description" : "successful operation",
"schema" : {
"$ref" : "#/definitions/Order"
}
},
"400" : {
"description" : "Invalid Order"
}
},
"x-contentType" : "application/json",
"x-accepts" : "application/json"
}
},
"/store/order/{orderId}" : {
"get" : {
"tags" : [ "store" ],
"summary" : "Find purchase order by ID",
"description" : "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions",
"operationId" : "getOrderById",
"produces" : [ "application/xml", "application/json" ],
"parameters" : [ {
"name" : "orderId",
"in" : "path",
"description" : "ID of pet that needs to be fetched",
"required" : true,
"type" : "integer",
"maximum" : 5,
"minimum" : 1,
"format" : "int64"
} ],
"responses" : {
"200" : {
"description" : "successful operation",
"schema" : {
"$ref" : "#/definitions/Order"
}
},
"400" : {
"description" : "Invalid ID supplied"
},
"404" : {
"description" : "Order not found"
}
},
"x-accepts" : "application/json"
},
"delete" : {
"tags" : [ "store" ],
"summary" : "Delete purchase order by ID",
"description" : "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors",
"operationId" : "deleteOrder",
"produces" : [ "application/xml", "application/json" ],
"parameters" : [ {
"name" : "orderId",
"in" : "path",
"description" : "ID of the order that needs to be deleted",
"required" : true,
"type" : "string"
} ],
"responses" : {
"400" : {
"description" : "Invalid ID supplied"
},
"404" : {
"description" : "Order not found"
}
},
"x-accepts" : "application/json"
}
},
"/user" : {
"post" : {
"tags" : [ "user" ],
"summary" : "Create user",
"description" : "This can only be done by the logged in user.",
"operationId" : "createUser",
"produces" : [ "application/xml", "application/json" ],
"parameters" : [ {
"in" : "body",
"name" : "body",
"description" : "Created user object",
"required" : true,
"schema" : {
"$ref" : "#/definitions/User"
}
} ],
"responses" : {
"default" : {
"description" : "successful operation"
}
},
"x-contentType" : "application/json",
"x-accepts" : "application/json"
}
},
"/user/createWithArray" : {
"post" : {
"tags" : [ "user" ],
"summary" : "Creates list of users with given input array",
"description" : "",
"operationId" : "createUsersWithArrayInput",
"produces" : [ "application/xml", "application/json" ],
"parameters" : [ {
"in" : "body",
"name" : "body",
"description" : "List of user object",
"required" : true,
"schema" : {
"type" : "array",
"items" : {
"$ref" : "#/definitions/User"
}
}
} ],
"responses" : {
"default" : {
"description" : "successful operation"
}
},
"x-contentType" : "application/json",
"x-accepts" : "application/json"
}
},
"/user/createWithList" : {
"post" : {
"tags" : [ "user" ],
"summary" : "Creates list of users with given input array",
"description" : "",
"operationId" : "createUsersWithListInput",
"produces" : [ "application/xml", "application/json" ],
"parameters" : [ {
"in" : "body",
"name" : "body",
"description" : "List of user object",
"required" : true,
"schema" : {
"type" : "array",
"items" : {
"$ref" : "#/definitions/User"
}
}
} ],
"responses" : {
"default" : {
"description" : "successful operation"
}
},
"x-contentType" : "application/json",
"x-accepts" : "application/json"
}
},
"/user/login" : {
"get" : {
"tags" : [ "user" ],
"summary" : "Logs user into the system",
"description" : "",
"operationId" : "loginUser",
"produces" : [ "application/xml", "application/json" ],
"parameters" : [ {
"name" : "username",
"in" : "query",
"description" : "The user name for login",
"required" : true,
"type" : "string"
}, {
"name" : "password",
"in" : "query",
"description" : "The password for login in clear text",
"required" : true,
"type" : "string"
} ],
"responses" : {
"200" : {
"description" : "successful operation",
"schema" : {
"type" : "string"
},
"headers" : {
"X-Rate-Limit" : {
"type" : "integer",
"format" : "int32",
"description" : "calls per hour allowed by the user"
},
"X-Expires-After" : {
"type" : "string",
"format" : "date-time",
"description" : "date in UTC when toekn expires"
}
}
},
"400" : {
"description" : "Invalid username/password supplied"
}
},
"x-accepts" : "application/json"
}
},
"/user/logout" : {
"get" : {
"tags" : [ "user" ],
"summary" : "Logs out current logged in user session",
"description" : "",
"operationId" : "logoutUser",
"produces" : [ "application/xml", "application/json" ],
"parameters" : [ ],
"responses" : {
"default" : {
"description" : "successful operation"
}
},
"x-accepts" : "application/json"
}
},
"/user/{username}" : {
"get" : {
"tags" : [ "user" ],
"summary" : "Get user by user name",
"description" : "",
"operationId" : "getUserByName",
"produces" : [ "application/xml", "application/json" ],
"parameters" : [ {
"name" : "username",
"in" : "path",
"description" : "The name that needs to be fetched. Use user1 for testing. ",
"required" : true,
"type" : "string"
} ],
"responses" : {
"200" : {
"description" : "successful operation",
"schema" : {
"$ref" : "#/definitions/User"
}
},
"400" : {
"description" : "Invalid username supplied"
},
"404" : {
"description" : "User not found"
}
},
"x-accepts" : "application/json"
},
"put" : {
"tags" : [ "user" ],
"summary" : "Updated user",
"description" : "This can only be done by the logged in user.",
"operationId" : "updateUser",
"produces" : [ "application/xml", "application/json" ],
"parameters" : [ {
"name" : "username",
"in" : "path",
"description" : "name that need to be deleted",
"required" : true,
"type" : "string"
}, {
"in" : "body",
"name" : "body",
"description" : "Updated user object",
"required" : true,
"schema" : {
"$ref" : "#/definitions/User"
}
} ],
"responses" : {
"400" : {
"description" : "Invalid user supplied"
},
"404" : {
"description" : "User not found"
}
},
"x-contentType" : "application/json",
"x-accepts" : "application/json"
},
"delete" : {
"tags" : [ "user" ],
"summary" : "Delete user",
"description" : "This can only be done by the logged in user.",
"operationId" : "deleteUser",
"produces" : [ "application/xml", "application/json" ],
"parameters" : [ {
"name" : "username",
"in" : "path",
"description" : "The name that needs to be deleted",
"required" : true,
"type" : "string"
} ],
"responses" : {
"400" : {
"description" : "Invalid username supplied"
},
"404" : {
"description" : "User not found"
}
},
"x-accepts" : "application/json"
}
}
},
"securityDefinitions" : {
"petstore_auth" : {
"type" : "oauth2",
"authorizationUrl" : "http://petstore.swagger.io/api/oauth/dialog",
"flow" : "implicit",
"scopes" : {
"write:pets" : "modify pets in your account",
"read:pets" : "read your pets"
}
},
"api_key" : {
"type" : "apiKey",
"name" : "api_key",
"in" : "header"
}
},
"definitions" : {
"Order" : {
"type" : "object",
"properties" : {
"id" : {
"type" : "integer",
"format" : "int64"
},
"petId" : {
"type" : "integer",
"format" : "int64"
},
"quantity" : {
"type" : "integer",
"format" : "int32"
},
"shipDate" : {
"type" : "string",
"format" : "date-time"
},
"status" : {
"type" : "string",
"description" : "Order Status",
"enum" : [ "placed", "approved", "delivered" ]
},
"complete" : {
"type" : "boolean",
"default" : false
}
},
"title" : "Pet Order",
"description" : "An order for a pets from the pet store",
"xml" : {
"name" : "Order"
}
},
"Category" : {
"type" : "object",
"properties" : {
"id" : {
"type" : "integer",
"format" : "int64"
},
"name" : {
"type" : "string"
}
},
"title" : "Pet category",
"description" : "A category for a pet",
"xml" : {
"name" : "Category"
}
},
"User" : {
"type" : "object",
"properties" : {
"id" : {
"type" : "integer",
"format" : "int64"
},
"username" : {
"type" : "string"
},
"firstName" : {
"type" : "string"
},
"lastName" : {
"type" : "string"
},
"email" : {
"type" : "string"
},
"password" : {
"type" : "string"
},
"phone" : {
"type" : "string"
},
"userStatus" : {
"type" : "integer",
"format" : "int32",
"description" : "User Status"
}
},
"title" : "a User",
"description" : "A User who is purchasing from the pet store",
"xml" : {
"name" : "User"
}
},
"Tag" : {
"type" : "object",
"properties" : {
"id" : {
"type" : "integer",
"format" : "int64"
},
"name" : {
"type" : "string"
}
},
"title" : "Pet Tag",
"description" : "A tag for a pet",
"xml" : {
"name" : "Tag"
}
},
"Pet" : {
"type" : "object",
"required" : [ "name", "photoUrls" ],
"properties" : {
"id" : {
"type" : "integer",
"format" : "int64"
},
"category" : {
"$ref" : "#/definitions/Category"
},
"name" : {
"type" : "string",
"example" : "doggie"
},
"photoUrls" : {
"type" : "array",
"xml" : {
"name" : "photoUrl",
"wrapped" : true
},
"items" : {
"type" : "string"
}
},
"tags" : {
"type" : "array",
"xml" : {
"name" : "tag",
"wrapped" : true
},
"items" : {
"$ref" : "#/definitions/Tag"
}
},
"status" : {
"type" : "string",
"description" : "pet status in the store",
"enum" : [ "available", "pending", "sold" ]
}
},
"title" : "a Pet",
"description" : "A pet for sale in the pet store",
"xml" : {
"name" : "Pet"
}
},
"ApiResponse" : {
"type" : "object",
"properties" : {
"code" : {
"type" : "integer",
"format" : "int32"
},
"type" : {
"type" : "string"
},
"message" : {
"type" : "string"
}
},
"title" : "An uploaded response",
"description" : "Describes the result of uploading an image resource"
}
},
"externalDocs" : {
"description" : "Find out more about Swagger",
"url" : "http://swagger.io"
}
}