mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-11 06:42:45 +00:00
* InlineResolver to flatten callback operations Signed-off-by: lwlee2608 <lwlee2608@gmail.com> * clone from VertxServerCodegen, to new VertxWebServerCodegen * fix compilation error in VertxWebCodegn * Start working on VertxWebServerCodegen, adding support files * add server api handler * add server api and fix yaml spec file generation * link api to apiHandler * convert vertx parameters into API model * add support to multipart/form-data upload files * ability to set http status code from ApiImpl * replace rootPackage with invokerPackage * add readme and sample * fix circleCi error * override file to FileUpload in typeMapping, no need to override from fromOperation(). Also remove unused annotation import from model * remove smartBear software copyright * use {{artifactVersion}} instead of hardcode version in readme * add -t flag in generation script * add generated vertx-web server to master pom for testing
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
# 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 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 (*):
|
||||
#foo/*/qux
|
||||
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
|
||||
|
||||
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
|
||||
#foo/**/qux
|
||||
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
|
||||
|
||||
# You can also negate patterns with an exclamation (!).
|
||||
# For example, you can ignore all files in a docs folder with the file extension .md:
|
||||
#docs/*.md
|
||||
# Then explicitly reverse the ignore rule for a single file:
|
||||
#!docs/README.md
|
||||
@@ -0,0 +1 @@
|
||||
4.2.0-SNAPSHOT
|
||||
11
samples/server/petstore/java-vertx-web/rx/README.md
Normal file
11
samples/server/petstore/java-vertx-web/rx/README.md
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
## Getting Started
|
||||
|
||||
This document assumes you have maven available.
|
||||
|
||||
To build the project using maven, run:
|
||||
```bash
|
||||
mvn package && java -jar target/target/java-vertx-web-rx-server-1.0.0-SNAPSHOT-fat.jar
|
||||
```
|
||||
|
||||
If all builds successfully, the server should run on [http://localhost:8080/](http://localhost:8080/)
|
||||
102
samples/server/petstore/java-vertx-web/rx/pom.xml
Normal file
102
samples/server/petstore/java-vertx-web/rx/pom.xml
Normal file
@@ -0,0 +1,102 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
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>org.openapitools</groupId>
|
||||
<artifactId>java-vertx-web-rx-server</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>OpenAPI Petstore</name>
|
||||
|
||||
<properties>
|
||||
<vertx.version>3.6.3</vertx.version>
|
||||
<slf4j.version>1.7.26</slf4j.version>
|
||||
<junit.version>4.12</junit.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-simple</artifactId>
|
||||
<version>${slf4j.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.vertx</groupId>
|
||||
<artifactId>vertx-core</artifactId>
|
||||
<version>${vertx.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.vertx</groupId>
|
||||
<artifactId>vertx-web</artifactId>
|
||||
<version>${vertx.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.vertx</groupId>
|
||||
<artifactId>vertx-web-api-contract</artifactId>
|
||||
<version>${vertx.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.vertx</groupId>
|
||||
<artifactId>vertx-rx-java2</artifactId>
|
||||
<version>${vertx.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.reactivex.rxjava2</groupId>
|
||||
<artifactId>rxjava</artifactId>
|
||||
<version>2.2.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>${junit.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.vertx</groupId>
|
||||
<artifactId>vertx-unit</artifactId>
|
||||
<version>${vertx.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.3</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>2.3</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<transformers>
|
||||
<transformer
|
||||
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
|
||||
<manifestEntries>
|
||||
<Main-Class>io.vertx.core.Starter</Main-Class>
|
||||
<Main-Verticle>org.openapitools.vertxweb.server.MainVerticle</Main-Verticle>
|
||||
</manifestEntries>
|
||||
</transformer>
|
||||
</transformers>
|
||||
<artifactSet/>
|
||||
<outputFile>${project.build.directory}/${project.artifactId}-${project.version}-fat.jar</outputFile>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.openapitools.vertxweb.server;
|
||||
|
||||
public class ApiException extends RuntimeException {
|
||||
private final String message;
|
||||
private Integer statusCode;
|
||||
|
||||
public ApiException(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public ApiException setStatusCode(Integer statusCode) {
|
||||
this.statusCode = statusCode;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getStatusCode() {
|
||||
return statusCode;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package org.openapitools.vertxweb.server;
|
||||
|
||||
public class ApiResponse<T> {
|
||||
private final T data;
|
||||
private Integer statusCode;
|
||||
|
||||
public ApiResponse(T data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public ApiResponse() {
|
||||
this.data = null;
|
||||
}
|
||||
|
||||
public T getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public ApiResponse<T> setStatusCode(Integer statusCode) {
|
||||
this.statusCode = statusCode;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getStatusCode() {
|
||||
return statusCode;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
package org.openapitools.vertxweb.server;
|
||||
|
||||
import io.vertx.core.Future;
|
||||
import io.vertx.core.Handler;
|
||||
import io.vertx.core.http.HttpServerOptions;
|
||||
import io.vertx.ext.web.RoutingContext;
|
||||
import io.vertx.ext.web.api.contract.RouterFactoryOptions;
|
||||
import io.vertx.reactivex.core.AbstractVerticle;
|
||||
import io.vertx.reactivex.ext.web.api.contract.openapi3.OpenAPI3RouterFactory;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.openapitools.vertxweb.server.api.PetApiHandler;
|
||||
import org.openapitools.vertxweb.server.api.StoreApiHandler;
|
||||
import org.openapitools.vertxweb.server.api.UserApiHandler;
|
||||
|
||||
public class HttpServerVerticle extends AbstractVerticle {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(HttpServerVerticle.class);
|
||||
|
||||
private static String specFile = "src/main/resources/openapi.yaml";
|
||||
|
||||
private Map<String, Handler<RoutingContext>> operationHandlers = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void start(Future<Void> fut) {
|
||||
|
||||
new PetApiHandler(operationHandlers);
|
||||
new StoreApiHandler(operationHandlers);
|
||||
new UserApiHandler(operationHandlers);
|
||||
|
||||
OpenAPI3RouterFactory.rxCreate(vertx, specFile)
|
||||
.doOnSuccess(factory -> {
|
||||
factory.setOptions(new RouterFactoryOptions()
|
||||
.setRequireSecurityHandlers(false)
|
||||
.setMountNotImplementedHandler(false));
|
||||
factory.setValidationFailureHandler(this::validationFailureHandler);
|
||||
operationHandlers.forEach(factory.getDelegate()::addHandlerByOperationId);
|
||||
})
|
||||
.map(OpenAPI3RouterFactory::getRouter)
|
||||
.doOnSuccess(router -> router.route().last().handler(this::methodNotFoundHandler))
|
||||
.map(router ->
|
||||
vertx.createHttpServer(new HttpServerOptions()
|
||||
.setPort(8080)
|
||||
.setHost("localhost"))
|
||||
.requestHandler(router)
|
||||
.listen()
|
||||
)
|
||||
.subscribe( httpServer -> {
|
||||
logger.info("Http verticle deployed successful");
|
||||
fut.complete();
|
||||
}, error -> {
|
||||
logger.info("Http verticle failed to deployed", error);
|
||||
fut.fail(error.getCause());
|
||||
});
|
||||
}
|
||||
|
||||
private void validationFailureHandler(io.vertx.reactivex.ext.web.RoutingContext rc) {
|
||||
rc.response().setStatusCode(400)
|
||||
.end("Bad Request : " + rc.failure().getMessage());
|
||||
}
|
||||
|
||||
private void methodNotFoundHandler(io.vertx.reactivex.ext.web.RoutingContext rc) {
|
||||
rc.response().setStatusCode(404)
|
||||
.end("Method '" + rc.request().path() + "' Not Found");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package org.openapitools.vertxweb.server;
|
||||
|
||||
import io.vertx.core.DeploymentOptions;
|
||||
import io.vertx.core.Future;
|
||||
import io.vertx.reactivex.core.AbstractVerticle;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class MainVerticle extends AbstractVerticle {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(MainVerticle.class);
|
||||
|
||||
@Override
|
||||
public void start(Future<Void> future) {
|
||||
|
||||
DeploymentOptions options = new DeploymentOptions();
|
||||
options.setInstances(Runtime.getRuntime().availableProcessors());
|
||||
|
||||
vertx.deployVerticle(HttpServerVerticle.class.getName(), options, res -> {
|
||||
if (!res.succeeded()) {
|
||||
logger.error("Deployment fail reason: ", res.cause());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
package org.openapitools.vertxweb.server;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import io.vertx.core.json.Json;
|
||||
|
||||
import java.util.UUID;
|
||||
import java.time.OffsetDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
public class ParameterCast {
|
||||
|
||||
public static Boolean toBoolean(String str) {
|
||||
if (str != null) {
|
||||
return Boolean.parseBoolean(str);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static UUID toUUID(String str) {
|
||||
if (str != null) {
|
||||
return UUID.fromString(str);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static Integer toInteger(String str) {
|
||||
if (str != null) {
|
||||
return Integer.parseInt(str);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static Long toLong(String str) {
|
||||
if (str != null) {
|
||||
return Long.parseLong(str);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static Double toDouble(String str) {
|
||||
if (str != null){
|
||||
return Double.parseDouble(str);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static Float toFloat(String str) {
|
||||
if (str != null){
|
||||
return Float.parseFloat(str);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static OffsetDateTime toOffsetDateTime(String str) {
|
||||
if (str != null) {
|
||||
return OffsetDateTime.parse(str,
|
||||
DateTimeFormatter.ISO_OFFSET_DATE_TIME);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static String toString(String str) {
|
||||
return str;
|
||||
}
|
||||
|
||||
public static <T> T toObject(String str) {
|
||||
if (str != null) {
|
||||
return Json.decodeValue(str, new TypeReference<T>(){});
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static <T> T toObject(String str, Class<T> classz) {
|
||||
if (str != null) {
|
||||
return Json.decodeValue(str, classz);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package org.openapitools.vertxweb.server.api;
|
||||
|
||||
import io.vertx.ext.web.FileUpload;
|
||||
import org.openapitools.vertxweb.server.model.ModelApiResponse;
|
||||
import org.openapitools.vertxweb.server.model.Pet;
|
||||
|
||||
import org.openapitools.vertxweb.server.ApiResponse;
|
||||
|
||||
import io.reactivex.Single;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface PetApi {
|
||||
Single<ApiResponse<Void>> addPet(Pet pet);
|
||||
Single<ApiResponse<Void>> deletePet(Long petId,String apiKey);
|
||||
Single<ApiResponse<List<Pet>>> findPetsByStatus(List<String> status);
|
||||
Single<ApiResponse<List<Pet>>> findPetsByTags(List<String> tags);
|
||||
Single<ApiResponse<Pet>> getPetById(Long petId);
|
||||
Single<ApiResponse<Void>> updatePet(Pet pet);
|
||||
Single<ApiResponse<Void>> updatePetWithForm(Long petId,String name,String status);
|
||||
Single<ApiResponse<ModelApiResponse>> uploadFile(Long petId,String additionalMetadata,FileUpload file);
|
||||
}
|
||||
@@ -0,0 +1,242 @@
|
||||
package org.openapitools.vertxweb.server.api;
|
||||
|
||||
import io.vertx.ext.web.FileUpload;
|
||||
import org.openapitools.vertxweb.server.model.ModelApiResponse;
|
||||
import org.openapitools.vertxweb.server.model.Pet;
|
||||
|
||||
import org.openapitools.vertxweb.server.ParameterCast;
|
||||
import org.openapitools.vertxweb.server.ApiException;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import io.vertx.core.json.Json;
|
||||
import io.vertx.core.Handler;
|
||||
import io.vertx.core.http.HttpServerResponse;
|
||||
import io.vertx.ext.web.RoutingContext;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import io.reactivex.Single;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class PetApiHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(PetApiHandler.class);
|
||||
private PetApi apiImpl = new PetApiImpl();
|
||||
|
||||
public PetApiHandler(Map<String, Handler<RoutingContext>> operationHandlers) {
|
||||
operationHandlers.put("addPet", this::addPet);
|
||||
operationHandlers.put("deletePet", this::deletePet);
|
||||
operationHandlers.put("findPetsByStatus", this::findPetsByStatus);
|
||||
operationHandlers.put("findPetsByTags", this::findPetsByTags);
|
||||
operationHandlers.put("getPetById", this::getPetById);
|
||||
operationHandlers.put("updatePet", this::updatePet);
|
||||
operationHandlers.put("updatePetWithForm", this::updatePetWithForm);
|
||||
operationHandlers.put("uploadFile", this::uploadFile);
|
||||
}
|
||||
|
||||
private void addPet(RoutingContext routingContext) {
|
||||
logger.info("addPet()");
|
||||
HttpServerResponse response = routingContext.response();
|
||||
|
||||
Single.defer( () -> {
|
||||
String jsonString = routingContext.getBodyAsString();
|
||||
Pet pet = jsonString == null ? null : Json.decodeValue(jsonString, new TypeReference<Pet>(){});
|
||||
logger.info("Parameter pet is {}", pet);
|
||||
return apiImpl.addPet(pet);
|
||||
})
|
||||
.subscribe(
|
||||
apiResponse -> {
|
||||
response.setStatusCode(apiResponse.getStatusCode())
|
||||
.end(Json.encodePrettily(apiResponse.getData()));
|
||||
}, error -> {
|
||||
if (error instanceof ApiException) {
|
||||
ApiException apiException = (ApiException) error;
|
||||
response.setStatusCode(apiException.getStatusCode()).end(apiException.getMessage());
|
||||
} else {
|
||||
response.setStatusCode(500).end(error.getMessage());
|
||||
}
|
||||
}).dispose();
|
||||
}
|
||||
|
||||
|
||||
private void deletePet(RoutingContext routingContext) {
|
||||
logger.info("deletePet()");
|
||||
HttpServerResponse response = routingContext.response();
|
||||
|
||||
Single.defer( () -> {
|
||||
Long petId = ParameterCast.toLong(routingContext.pathParams().get("petId"));
|
||||
String apiKey = ParameterCast.toString(routingContext.request().getHeader("api_key"));
|
||||
logger.info("Parameter petId is {}", petId);
|
||||
logger.info("Parameter apiKey is {}", apiKey);
|
||||
return apiImpl.deletePet(petId, apiKey);
|
||||
})
|
||||
.subscribe(
|
||||
apiResponse -> {
|
||||
response.setStatusCode(apiResponse.getStatusCode())
|
||||
.end(Json.encodePrettily(apiResponse.getData()));
|
||||
}, error -> {
|
||||
if (error instanceof ApiException) {
|
||||
ApiException apiException = (ApiException) error;
|
||||
response.setStatusCode(apiException.getStatusCode()).end(apiException.getMessage());
|
||||
} else {
|
||||
response.setStatusCode(500).end(error.getMessage());
|
||||
}
|
||||
}).dispose();
|
||||
}
|
||||
|
||||
|
||||
private void findPetsByStatus(RoutingContext routingContext) {
|
||||
logger.info("findPetsByStatus()");
|
||||
HttpServerResponse response = routingContext.response();
|
||||
|
||||
Single.defer( () -> {
|
||||
List<String> status = routingContext.request().params().getAll("status");
|
||||
logger.info("Parameter status is {}", status);
|
||||
return apiImpl.findPetsByStatus(status);
|
||||
})
|
||||
.subscribe(
|
||||
apiResponse -> {
|
||||
response.setStatusCode(apiResponse.getStatusCode())
|
||||
.end(Json.encodePrettily(apiResponse.getData()));
|
||||
}, error -> {
|
||||
if (error instanceof ApiException) {
|
||||
ApiException apiException = (ApiException) error;
|
||||
response.setStatusCode(apiException.getStatusCode()).end(apiException.getMessage());
|
||||
} else {
|
||||
response.setStatusCode(500).end(error.getMessage());
|
||||
}
|
||||
}).dispose();
|
||||
}
|
||||
|
||||
|
||||
private void findPetsByTags(RoutingContext routingContext) {
|
||||
logger.info("findPetsByTags()");
|
||||
HttpServerResponse response = routingContext.response();
|
||||
|
||||
Single.defer( () -> {
|
||||
List<String> tags = routingContext.request().params().getAll("tags");
|
||||
logger.info("Parameter tags is {}", tags);
|
||||
return apiImpl.findPetsByTags(tags);
|
||||
})
|
||||
.subscribe(
|
||||
apiResponse -> {
|
||||
response.setStatusCode(apiResponse.getStatusCode())
|
||||
.end(Json.encodePrettily(apiResponse.getData()));
|
||||
}, error -> {
|
||||
if (error instanceof ApiException) {
|
||||
ApiException apiException = (ApiException) error;
|
||||
response.setStatusCode(apiException.getStatusCode()).end(apiException.getMessage());
|
||||
} else {
|
||||
response.setStatusCode(500).end(error.getMessage());
|
||||
}
|
||||
}).dispose();
|
||||
}
|
||||
|
||||
|
||||
private void getPetById(RoutingContext routingContext) {
|
||||
logger.info("getPetById()");
|
||||
HttpServerResponse response = routingContext.response();
|
||||
|
||||
Single.defer( () -> {
|
||||
Long petId = ParameterCast.toLong(routingContext.pathParams().get("petId"));
|
||||
logger.info("Parameter petId is {}", petId);
|
||||
return apiImpl.getPetById(petId);
|
||||
})
|
||||
.subscribe(
|
||||
apiResponse -> {
|
||||
response.setStatusCode(apiResponse.getStatusCode())
|
||||
.end(Json.encodePrettily(apiResponse.getData()));
|
||||
}, error -> {
|
||||
if (error instanceof ApiException) {
|
||||
ApiException apiException = (ApiException) error;
|
||||
response.setStatusCode(apiException.getStatusCode()).end(apiException.getMessage());
|
||||
} else {
|
||||
response.setStatusCode(500).end(error.getMessage());
|
||||
}
|
||||
}).dispose();
|
||||
}
|
||||
|
||||
|
||||
private void updatePet(RoutingContext routingContext) {
|
||||
logger.info("updatePet()");
|
||||
HttpServerResponse response = routingContext.response();
|
||||
|
||||
Single.defer( () -> {
|
||||
String jsonString = routingContext.getBodyAsString();
|
||||
Pet pet = jsonString == null ? null : Json.decodeValue(jsonString, new TypeReference<Pet>(){});
|
||||
logger.info("Parameter pet is {}", pet);
|
||||
return apiImpl.updatePet(pet);
|
||||
})
|
||||
.subscribe(
|
||||
apiResponse -> {
|
||||
response.setStatusCode(apiResponse.getStatusCode())
|
||||
.end(Json.encodePrettily(apiResponse.getData()));
|
||||
}, error -> {
|
||||
if (error instanceof ApiException) {
|
||||
ApiException apiException = (ApiException) error;
|
||||
response.setStatusCode(apiException.getStatusCode()).end(apiException.getMessage());
|
||||
} else {
|
||||
response.setStatusCode(500).end(error.getMessage());
|
||||
}
|
||||
}).dispose();
|
||||
}
|
||||
|
||||
|
||||
private void updatePetWithForm(RoutingContext routingContext) {
|
||||
logger.info("updatePetWithForm()");
|
||||
HttpServerResponse response = routingContext.response();
|
||||
|
||||
Single.defer( () -> {
|
||||
Long petId = ParameterCast.toLong(routingContext.pathParams().get("petId"));
|
||||
String name = ParameterCast.toString(routingContext.request().getFormAttribute("name"));
|
||||
String status = ParameterCast.toString(routingContext.request().getFormAttribute("status"));
|
||||
logger.info("Parameter petId is {}", petId);
|
||||
logger.info("Parameter name is {}", name);
|
||||
logger.info("Parameter status is {}", status);
|
||||
return apiImpl.updatePetWithForm(petId, name, status);
|
||||
})
|
||||
.subscribe(
|
||||
apiResponse -> {
|
||||
response.setStatusCode(apiResponse.getStatusCode())
|
||||
.end(Json.encodePrettily(apiResponse.getData()));
|
||||
}, error -> {
|
||||
if (error instanceof ApiException) {
|
||||
ApiException apiException = (ApiException) error;
|
||||
response.setStatusCode(apiException.getStatusCode()).end(apiException.getMessage());
|
||||
} else {
|
||||
response.setStatusCode(500).end(error.getMessage());
|
||||
}
|
||||
}).dispose();
|
||||
}
|
||||
|
||||
|
||||
private void uploadFile(RoutingContext routingContext) {
|
||||
logger.info("uploadFile()");
|
||||
HttpServerResponse response = routingContext.response();
|
||||
|
||||
Single.defer( () -> {
|
||||
Long petId = ParameterCast.toLong(routingContext.pathParams().get("petId"));
|
||||
String additionalMetadata = ParameterCast.toString(routingContext.request().getFormAttribute("additionalMetadata"));
|
||||
FileUpload file = routingContext.fileUploads().iterator().next();
|
||||
logger.info("Parameter petId is {}", petId);
|
||||
logger.info("Parameter additionalMetadata is {}", additionalMetadata);
|
||||
logger.info("Parameter file is {}", file);
|
||||
return apiImpl.uploadFile(petId, additionalMetadata, file);
|
||||
})
|
||||
.subscribe(
|
||||
apiResponse -> {
|
||||
response.setStatusCode(apiResponse.getStatusCode())
|
||||
.end(Json.encodePrettily(apiResponse.getData()));
|
||||
}, error -> {
|
||||
if (error instanceof ApiException) {
|
||||
ApiException apiException = (ApiException) error;
|
||||
response.setStatusCode(apiException.getStatusCode()).end(apiException.getMessage());
|
||||
} else {
|
||||
response.setStatusCode(500).end(error.getMessage());
|
||||
}
|
||||
}).dispose();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package org.openapitools.vertxweb.server.api;
|
||||
|
||||
import io.vertx.ext.web.FileUpload;
|
||||
import org.openapitools.vertxweb.server.model.ModelApiResponse;
|
||||
import org.openapitools.vertxweb.server.model.Pet;
|
||||
|
||||
import org.openapitools.vertxweb.server.ApiResponse;
|
||||
import org.openapitools.vertxweb.server.ApiException;
|
||||
|
||||
import io.reactivex.Single;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
// Implement this class
|
||||
|
||||
public class PetApiImpl implements PetApi {
|
||||
public Single<ApiResponse<Void>> addPet(Pet pet) {
|
||||
return Single.error(new ApiException("Not Implemented").setStatusCode(501));
|
||||
}
|
||||
|
||||
public Single<ApiResponse<Void>> deletePet(Long petId,String apiKey) {
|
||||
return Single.error(new ApiException("Not Implemented").setStatusCode(501));
|
||||
}
|
||||
|
||||
public Single<ApiResponse<List<Pet>>> findPetsByStatus(List<String> status) {
|
||||
return Single.error(new ApiException("Not Implemented").setStatusCode(501));
|
||||
}
|
||||
|
||||
public Single<ApiResponse<List<Pet>>> findPetsByTags(List<String> tags) {
|
||||
return Single.error(new ApiException("Not Implemented").setStatusCode(501));
|
||||
}
|
||||
|
||||
public Single<ApiResponse<Pet>> getPetById(Long petId) {
|
||||
return Single.error(new ApiException("Not Implemented").setStatusCode(501));
|
||||
}
|
||||
|
||||
public Single<ApiResponse<Void>> updatePet(Pet pet) {
|
||||
return Single.error(new ApiException("Not Implemented").setStatusCode(501));
|
||||
}
|
||||
|
||||
public Single<ApiResponse<Void>> updatePetWithForm(Long petId,String name,String status) {
|
||||
return Single.error(new ApiException("Not Implemented").setStatusCode(501));
|
||||
}
|
||||
|
||||
public Single<ApiResponse<ModelApiResponse>> uploadFile(Long petId,String additionalMetadata,FileUpload file) {
|
||||
return Single.error(new ApiException("Not Implemented").setStatusCode(501));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package org.openapitools.vertxweb.server.api;
|
||||
|
||||
import org.openapitools.vertxweb.server.model.Order;
|
||||
|
||||
import org.openapitools.vertxweb.server.ApiResponse;
|
||||
|
||||
import io.reactivex.Single;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface StoreApi {
|
||||
Single<ApiResponse<Void>> deleteOrder(String orderId);
|
||||
Single<ApiResponse<Map<String, Integer>>> getInventory();
|
||||
Single<ApiResponse<Order>> getOrderById(Long orderId);
|
||||
Single<ApiResponse<Order>> placeOrder(Order order);
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
package org.openapitools.vertxweb.server.api;
|
||||
|
||||
import org.openapitools.vertxweb.server.model.Order;
|
||||
|
||||
import org.openapitools.vertxweb.server.ParameterCast;
|
||||
import org.openapitools.vertxweb.server.ApiException;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import io.vertx.core.json.Json;
|
||||
import io.vertx.core.Handler;
|
||||
import io.vertx.core.http.HttpServerResponse;
|
||||
import io.vertx.ext.web.RoutingContext;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import io.reactivex.Single;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class StoreApiHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(StoreApiHandler.class);
|
||||
private StoreApi apiImpl = new StoreApiImpl();
|
||||
|
||||
public StoreApiHandler(Map<String, Handler<RoutingContext>> operationHandlers) {
|
||||
operationHandlers.put("deleteOrder", this::deleteOrder);
|
||||
operationHandlers.put("getInventory", this::getInventory);
|
||||
operationHandlers.put("getOrderById", this::getOrderById);
|
||||
operationHandlers.put("placeOrder", this::placeOrder);
|
||||
}
|
||||
|
||||
private void deleteOrder(RoutingContext routingContext) {
|
||||
logger.info("deleteOrder()");
|
||||
HttpServerResponse response = routingContext.response();
|
||||
|
||||
Single.defer( () -> {
|
||||
String orderId = ParameterCast.toString(routingContext.pathParams().get("orderId"));
|
||||
logger.info("Parameter orderId is {}", orderId);
|
||||
return apiImpl.deleteOrder(orderId);
|
||||
})
|
||||
.subscribe(
|
||||
apiResponse -> {
|
||||
response.setStatusCode(apiResponse.getStatusCode())
|
||||
.end(Json.encodePrettily(apiResponse.getData()));
|
||||
}, error -> {
|
||||
if (error instanceof ApiException) {
|
||||
ApiException apiException = (ApiException) error;
|
||||
response.setStatusCode(apiException.getStatusCode()).end(apiException.getMessage());
|
||||
} else {
|
||||
response.setStatusCode(500).end(error.getMessage());
|
||||
}
|
||||
}).dispose();
|
||||
}
|
||||
|
||||
|
||||
private void getInventory(RoutingContext routingContext) {
|
||||
logger.info("getInventory()");
|
||||
HttpServerResponse response = routingContext.response();
|
||||
|
||||
Single.defer( () -> {
|
||||
return apiImpl.getInventory();
|
||||
})
|
||||
.subscribe(
|
||||
apiResponse -> {
|
||||
response.setStatusCode(apiResponse.getStatusCode())
|
||||
.end(Json.encodePrettily(apiResponse.getData()));
|
||||
}, error -> {
|
||||
if (error instanceof ApiException) {
|
||||
ApiException apiException = (ApiException) error;
|
||||
response.setStatusCode(apiException.getStatusCode()).end(apiException.getMessage());
|
||||
} else {
|
||||
response.setStatusCode(500).end(error.getMessage());
|
||||
}
|
||||
}).dispose();
|
||||
}
|
||||
|
||||
|
||||
private void getOrderById(RoutingContext routingContext) {
|
||||
logger.info("getOrderById()");
|
||||
HttpServerResponse response = routingContext.response();
|
||||
|
||||
Single.defer( () -> {
|
||||
Long orderId = ParameterCast.toLong(routingContext.pathParams().get("orderId"));
|
||||
logger.info("Parameter orderId is {}", orderId);
|
||||
return apiImpl.getOrderById(orderId);
|
||||
})
|
||||
.subscribe(
|
||||
apiResponse -> {
|
||||
response.setStatusCode(apiResponse.getStatusCode())
|
||||
.end(Json.encodePrettily(apiResponse.getData()));
|
||||
}, error -> {
|
||||
if (error instanceof ApiException) {
|
||||
ApiException apiException = (ApiException) error;
|
||||
response.setStatusCode(apiException.getStatusCode()).end(apiException.getMessage());
|
||||
} else {
|
||||
response.setStatusCode(500).end(error.getMessage());
|
||||
}
|
||||
}).dispose();
|
||||
}
|
||||
|
||||
|
||||
private void placeOrder(RoutingContext routingContext) {
|
||||
logger.info("placeOrder()");
|
||||
HttpServerResponse response = routingContext.response();
|
||||
|
||||
Single.defer( () -> {
|
||||
String jsonString = routingContext.getBodyAsString();
|
||||
Order order = jsonString == null ? null : Json.decodeValue(jsonString, new TypeReference<Order>(){});
|
||||
logger.info("Parameter order is {}", order);
|
||||
return apiImpl.placeOrder(order);
|
||||
})
|
||||
.subscribe(
|
||||
apiResponse -> {
|
||||
response.setStatusCode(apiResponse.getStatusCode())
|
||||
.end(Json.encodePrettily(apiResponse.getData()));
|
||||
}, error -> {
|
||||
if (error instanceof ApiException) {
|
||||
ApiException apiException = (ApiException) error;
|
||||
response.setStatusCode(apiException.getStatusCode()).end(apiException.getMessage());
|
||||
} else {
|
||||
response.setStatusCode(500).end(error.getMessage());
|
||||
}
|
||||
}).dispose();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package org.openapitools.vertxweb.server.api;
|
||||
|
||||
import org.openapitools.vertxweb.server.model.Order;
|
||||
|
||||
import org.openapitools.vertxweb.server.ApiResponse;
|
||||
import org.openapitools.vertxweb.server.ApiException;
|
||||
|
||||
import io.reactivex.Single;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
// Implement this class
|
||||
|
||||
public class StoreApiImpl implements StoreApi {
|
||||
public Single<ApiResponse<Void>> deleteOrder(String orderId) {
|
||||
return Single.error(new ApiException("Not Implemented").setStatusCode(501));
|
||||
}
|
||||
|
||||
public Single<ApiResponse<Map<String, Integer>>> getInventory() {
|
||||
return Single.error(new ApiException("Not Implemented").setStatusCode(501));
|
||||
}
|
||||
|
||||
public Single<ApiResponse<Order>> getOrderById(Long orderId) {
|
||||
return Single.error(new ApiException("Not Implemented").setStatusCode(501));
|
||||
}
|
||||
|
||||
public Single<ApiResponse<Order>> placeOrder(Order order) {
|
||||
return Single.error(new ApiException("Not Implemented").setStatusCode(501));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package org.openapitools.vertxweb.server.api;
|
||||
|
||||
import org.openapitools.vertxweb.server.model.User;
|
||||
|
||||
import org.openapitools.vertxweb.server.ApiResponse;
|
||||
|
||||
import io.reactivex.Single;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface UserApi {
|
||||
Single<ApiResponse<Void>> createUser(User user);
|
||||
Single<ApiResponse<Void>> createUsersWithArrayInput(List<User> user);
|
||||
Single<ApiResponse<Void>> createUsersWithListInput(List<User> user);
|
||||
Single<ApiResponse<Void>> deleteUser(String username);
|
||||
Single<ApiResponse<User>> getUserByName(String username);
|
||||
Single<ApiResponse<String>> loginUser(String username,String password);
|
||||
Single<ApiResponse<Void>> logoutUser();
|
||||
Single<ApiResponse<Void>> updateUser(String username,User user);
|
||||
}
|
||||
@@ -0,0 +1,234 @@
|
||||
package org.openapitools.vertxweb.server.api;
|
||||
|
||||
import org.openapitools.vertxweb.server.model.User;
|
||||
|
||||
import org.openapitools.vertxweb.server.ParameterCast;
|
||||
import org.openapitools.vertxweb.server.ApiException;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import io.vertx.core.json.Json;
|
||||
import io.vertx.core.Handler;
|
||||
import io.vertx.core.http.HttpServerResponse;
|
||||
import io.vertx.ext.web.RoutingContext;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import io.reactivex.Single;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class UserApiHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(UserApiHandler.class);
|
||||
private UserApi apiImpl = new UserApiImpl();
|
||||
|
||||
public UserApiHandler(Map<String, Handler<RoutingContext>> operationHandlers) {
|
||||
operationHandlers.put("createUser", this::createUser);
|
||||
operationHandlers.put("createUsersWithArrayInput", this::createUsersWithArrayInput);
|
||||
operationHandlers.put("createUsersWithListInput", this::createUsersWithListInput);
|
||||
operationHandlers.put("deleteUser", this::deleteUser);
|
||||
operationHandlers.put("getUserByName", this::getUserByName);
|
||||
operationHandlers.put("loginUser", this::loginUser);
|
||||
operationHandlers.put("logoutUser", this::logoutUser);
|
||||
operationHandlers.put("updateUser", this::updateUser);
|
||||
}
|
||||
|
||||
private void createUser(RoutingContext routingContext) {
|
||||
logger.info("createUser()");
|
||||
HttpServerResponse response = routingContext.response();
|
||||
|
||||
Single.defer( () -> {
|
||||
String jsonString = routingContext.getBodyAsString();
|
||||
User user = jsonString == null ? null : Json.decodeValue(jsonString, new TypeReference<User>(){});
|
||||
logger.info("Parameter user is {}", user);
|
||||
return apiImpl.createUser(user);
|
||||
})
|
||||
.subscribe(
|
||||
apiResponse -> {
|
||||
response.setStatusCode(apiResponse.getStatusCode())
|
||||
.end(Json.encodePrettily(apiResponse.getData()));
|
||||
}, error -> {
|
||||
if (error instanceof ApiException) {
|
||||
ApiException apiException = (ApiException) error;
|
||||
response.setStatusCode(apiException.getStatusCode()).end(apiException.getMessage());
|
||||
} else {
|
||||
response.setStatusCode(500).end(error.getMessage());
|
||||
}
|
||||
}).dispose();
|
||||
}
|
||||
|
||||
|
||||
private void createUsersWithArrayInput(RoutingContext routingContext) {
|
||||
logger.info("createUsersWithArrayInput()");
|
||||
HttpServerResponse response = routingContext.response();
|
||||
|
||||
Single.defer( () -> {
|
||||
String jsonString = routingContext.getBodyAsString();
|
||||
List<User> user = jsonString == null ? null : Json.decodeValue(jsonString, new TypeReference<List<User>>(){});
|
||||
logger.info("Parameter user is {}", user);
|
||||
return apiImpl.createUsersWithArrayInput(user);
|
||||
})
|
||||
.subscribe(
|
||||
apiResponse -> {
|
||||
response.setStatusCode(apiResponse.getStatusCode())
|
||||
.end(Json.encodePrettily(apiResponse.getData()));
|
||||
}, error -> {
|
||||
if (error instanceof ApiException) {
|
||||
ApiException apiException = (ApiException) error;
|
||||
response.setStatusCode(apiException.getStatusCode()).end(apiException.getMessage());
|
||||
} else {
|
||||
response.setStatusCode(500).end(error.getMessage());
|
||||
}
|
||||
}).dispose();
|
||||
}
|
||||
|
||||
|
||||
private void createUsersWithListInput(RoutingContext routingContext) {
|
||||
logger.info("createUsersWithListInput()");
|
||||
HttpServerResponse response = routingContext.response();
|
||||
|
||||
Single.defer( () -> {
|
||||
String jsonString = routingContext.getBodyAsString();
|
||||
List<User> user = jsonString == null ? null : Json.decodeValue(jsonString, new TypeReference<List<User>>(){});
|
||||
logger.info("Parameter user is {}", user);
|
||||
return apiImpl.createUsersWithListInput(user);
|
||||
})
|
||||
.subscribe(
|
||||
apiResponse -> {
|
||||
response.setStatusCode(apiResponse.getStatusCode())
|
||||
.end(Json.encodePrettily(apiResponse.getData()));
|
||||
}, error -> {
|
||||
if (error instanceof ApiException) {
|
||||
ApiException apiException = (ApiException) error;
|
||||
response.setStatusCode(apiException.getStatusCode()).end(apiException.getMessage());
|
||||
} else {
|
||||
response.setStatusCode(500).end(error.getMessage());
|
||||
}
|
||||
}).dispose();
|
||||
}
|
||||
|
||||
|
||||
private void deleteUser(RoutingContext routingContext) {
|
||||
logger.info("deleteUser()");
|
||||
HttpServerResponse response = routingContext.response();
|
||||
|
||||
Single.defer( () -> {
|
||||
String username = ParameterCast.toString(routingContext.pathParams().get("username"));
|
||||
logger.info("Parameter username is {}", username);
|
||||
return apiImpl.deleteUser(username);
|
||||
})
|
||||
.subscribe(
|
||||
apiResponse -> {
|
||||
response.setStatusCode(apiResponse.getStatusCode())
|
||||
.end(Json.encodePrettily(apiResponse.getData()));
|
||||
}, error -> {
|
||||
if (error instanceof ApiException) {
|
||||
ApiException apiException = (ApiException) error;
|
||||
response.setStatusCode(apiException.getStatusCode()).end(apiException.getMessage());
|
||||
} else {
|
||||
response.setStatusCode(500).end(error.getMessage());
|
||||
}
|
||||
}).dispose();
|
||||
}
|
||||
|
||||
|
||||
private void getUserByName(RoutingContext routingContext) {
|
||||
logger.info("getUserByName()");
|
||||
HttpServerResponse response = routingContext.response();
|
||||
|
||||
Single.defer( () -> {
|
||||
String username = ParameterCast.toString(routingContext.pathParams().get("username"));
|
||||
logger.info("Parameter username is {}", username);
|
||||
return apiImpl.getUserByName(username);
|
||||
})
|
||||
.subscribe(
|
||||
apiResponse -> {
|
||||
response.setStatusCode(apiResponse.getStatusCode())
|
||||
.end(Json.encodePrettily(apiResponse.getData()));
|
||||
}, error -> {
|
||||
if (error instanceof ApiException) {
|
||||
ApiException apiException = (ApiException) error;
|
||||
response.setStatusCode(apiException.getStatusCode()).end(apiException.getMessage());
|
||||
} else {
|
||||
response.setStatusCode(500).end(error.getMessage());
|
||||
}
|
||||
}).dispose();
|
||||
}
|
||||
|
||||
|
||||
private void loginUser(RoutingContext routingContext) {
|
||||
logger.info("loginUser()");
|
||||
HttpServerResponse response = routingContext.response();
|
||||
|
||||
Single.defer( () -> {
|
||||
String username = ParameterCast.toString(routingContext.queryParams().get("username"));
|
||||
String password = ParameterCast.toString(routingContext.queryParams().get("password"));
|
||||
logger.info("Parameter username is {}", username);
|
||||
logger.info("Parameter password is {}", password);
|
||||
return apiImpl.loginUser(username, password);
|
||||
})
|
||||
.subscribe(
|
||||
apiResponse -> {
|
||||
response.setStatusCode(apiResponse.getStatusCode())
|
||||
.end(Json.encodePrettily(apiResponse.getData()));
|
||||
}, error -> {
|
||||
if (error instanceof ApiException) {
|
||||
ApiException apiException = (ApiException) error;
|
||||
response.setStatusCode(apiException.getStatusCode()).end(apiException.getMessage());
|
||||
} else {
|
||||
response.setStatusCode(500).end(error.getMessage());
|
||||
}
|
||||
}).dispose();
|
||||
}
|
||||
|
||||
|
||||
private void logoutUser(RoutingContext routingContext) {
|
||||
logger.info("logoutUser()");
|
||||
HttpServerResponse response = routingContext.response();
|
||||
|
||||
Single.defer( () -> {
|
||||
return apiImpl.logoutUser();
|
||||
})
|
||||
.subscribe(
|
||||
apiResponse -> {
|
||||
response.setStatusCode(apiResponse.getStatusCode())
|
||||
.end(Json.encodePrettily(apiResponse.getData()));
|
||||
}, error -> {
|
||||
if (error instanceof ApiException) {
|
||||
ApiException apiException = (ApiException) error;
|
||||
response.setStatusCode(apiException.getStatusCode()).end(apiException.getMessage());
|
||||
} else {
|
||||
response.setStatusCode(500).end(error.getMessage());
|
||||
}
|
||||
}).dispose();
|
||||
}
|
||||
|
||||
|
||||
private void updateUser(RoutingContext routingContext) {
|
||||
logger.info("updateUser()");
|
||||
HttpServerResponse response = routingContext.response();
|
||||
|
||||
Single.defer( () -> {
|
||||
String username = ParameterCast.toString(routingContext.pathParams().get("username"));
|
||||
String jsonString = routingContext.getBodyAsString();
|
||||
User user = jsonString == null ? null : Json.decodeValue(jsonString, new TypeReference<User>(){});
|
||||
logger.info("Parameter username is {}", username);
|
||||
logger.info("Parameter user is {}", user);
|
||||
return apiImpl.updateUser(username, user);
|
||||
})
|
||||
.subscribe(
|
||||
apiResponse -> {
|
||||
response.setStatusCode(apiResponse.getStatusCode())
|
||||
.end(Json.encodePrettily(apiResponse.getData()));
|
||||
}, error -> {
|
||||
if (error instanceof ApiException) {
|
||||
ApiException apiException = (ApiException) error;
|
||||
response.setStatusCode(apiException.getStatusCode()).end(apiException.getMessage());
|
||||
} else {
|
||||
response.setStatusCode(500).end(error.getMessage());
|
||||
}
|
||||
}).dispose();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package org.openapitools.vertxweb.server.api;
|
||||
|
||||
import org.openapitools.vertxweb.server.model.User;
|
||||
|
||||
import org.openapitools.vertxweb.server.ApiResponse;
|
||||
import org.openapitools.vertxweb.server.ApiException;
|
||||
|
||||
import io.reactivex.Single;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
// Implement this class
|
||||
|
||||
public class UserApiImpl implements UserApi {
|
||||
public Single<ApiResponse<Void>> createUser(User user) {
|
||||
return Single.error(new ApiException("Not Implemented").setStatusCode(501));
|
||||
}
|
||||
|
||||
public Single<ApiResponse<Void>> createUsersWithArrayInput(List<User> user) {
|
||||
return Single.error(new ApiException("Not Implemented").setStatusCode(501));
|
||||
}
|
||||
|
||||
public Single<ApiResponse<Void>> createUsersWithListInput(List<User> user) {
|
||||
return Single.error(new ApiException("Not Implemented").setStatusCode(501));
|
||||
}
|
||||
|
||||
public Single<ApiResponse<Void>> deleteUser(String username) {
|
||||
return Single.error(new ApiException("Not Implemented").setStatusCode(501));
|
||||
}
|
||||
|
||||
public Single<ApiResponse<User>> getUserByName(String username) {
|
||||
return Single.error(new ApiException("Not Implemented").setStatusCode(501));
|
||||
}
|
||||
|
||||
public Single<ApiResponse<String>> loginUser(String username,String password) {
|
||||
return Single.error(new ApiException("Not Implemented").setStatusCode(501));
|
||||
}
|
||||
|
||||
public Single<ApiResponse<Void>> logoutUser() {
|
||||
return Single.error(new ApiException("Not Implemented").setStatusCode(501));
|
||||
}
|
||||
|
||||
public Single<ApiResponse<Void>> updateUser(String username,User user) {
|
||||
return Single.error(new ApiException("Not Implemented").setStatusCode(501));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package org.openapitools.vertxweb.server.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
/**
|
||||
* A category for a pet
|
||||
**/
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class Category {
|
||||
|
||||
private Long id;
|
||||
private String name;
|
||||
|
||||
public Category () {
|
||||
|
||||
}
|
||||
|
||||
public Category (Long id, String name) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty("id")
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty("name")
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Category category = (Category) o;
|
||||
return Objects.equals(id, category.id) &&
|
||||
Objects.equals(name, category.name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Category {\n");
|
||||
|
||||
sb.append(" id: ").append(toIndentedString(id)).append("\n");
|
||||
sb.append(" name: ").append(toIndentedString(name)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given object to string with each line indented by 4 spaces
|
||||
* (except the first line).
|
||||
*/
|
||||
private String toIndentedString(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package org.openapitools.vertxweb.server.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class InlineObject {
|
||||
|
||||
private String name;
|
||||
private String status;
|
||||
|
||||
public InlineObject () {
|
||||
|
||||
}
|
||||
|
||||
public InlineObject (String name, String status) {
|
||||
this.name = name;
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty("name")
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty("status")
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
InlineObject inlineObject = (InlineObject) o;
|
||||
return Objects.equals(name, inlineObject.name) &&
|
||||
Objects.equals(status, inlineObject.status);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(name, status);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class InlineObject {\n");
|
||||
|
||||
sb.append(" name: ").append(toIndentedString(name)).append("\n");
|
||||
sb.append(" status: ").append(toIndentedString(status)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given object to string with each line indented by 4 spaces
|
||||
* (except the first line).
|
||||
*/
|
||||
private String toIndentedString(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package org.openapitools.vertxweb.server.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.vertx.ext.web.FileUpload;
|
||||
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class InlineObject1 {
|
||||
|
||||
private String additionalMetadata;
|
||||
private FileUpload file;
|
||||
|
||||
public InlineObject1 () {
|
||||
|
||||
}
|
||||
|
||||
public InlineObject1 (String additionalMetadata, FileUpload file) {
|
||||
this.additionalMetadata = additionalMetadata;
|
||||
this.file = file;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty("additionalMetadata")
|
||||
public String getAdditionalMetadata() {
|
||||
return additionalMetadata;
|
||||
}
|
||||
public void setAdditionalMetadata(String additionalMetadata) {
|
||||
this.additionalMetadata = additionalMetadata;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty("file")
|
||||
public FileUpload getFile() {
|
||||
return file;
|
||||
}
|
||||
public void setFile(FileUpload file) {
|
||||
this.file = file;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
InlineObject1 inlineObject1 = (InlineObject1) o;
|
||||
return Objects.equals(additionalMetadata, inlineObject1.additionalMetadata) &&
|
||||
Objects.equals(file, inlineObject1.file);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(additionalMetadata, file);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class InlineObject1 {\n");
|
||||
|
||||
sb.append(" additionalMetadata: ").append(toIndentedString(additionalMetadata)).append("\n");
|
||||
sb.append(" file: ").append(toIndentedString(file)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given object to string with each line indented by 4 spaces
|
||||
* (except the first line).
|
||||
*/
|
||||
private String toIndentedString(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package org.openapitools.vertxweb.server.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
/**
|
||||
* Describes the result of uploading an image resource
|
||||
**/
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class ModelApiResponse {
|
||||
|
||||
private Integer code;
|
||||
private String type;
|
||||
private String message;
|
||||
|
||||
public ModelApiResponse () {
|
||||
|
||||
}
|
||||
|
||||
public ModelApiResponse (Integer code, String type, String message) {
|
||||
this.code = code;
|
||||
this.type = type;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty("code")
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
public void setCode(Integer code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty("type")
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty("message")
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
ModelApiResponse _apiResponse = (ModelApiResponse) o;
|
||||
return Objects.equals(code, _apiResponse.code) &&
|
||||
Objects.equals(type, _apiResponse.type) &&
|
||||
Objects.equals(message, _apiResponse.message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(code, type, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class ModelApiResponse {\n");
|
||||
|
||||
sb.append(" code: ").append(toIndentedString(code)).append("\n");
|
||||
sb.append(" type: ").append(toIndentedString(type)).append("\n");
|
||||
sb.append(" message: ").append(toIndentedString(message)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given object to string with each line indented by 4 spaces
|
||||
* (except the first line).
|
||||
*/
|
||||
private String toIndentedString(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
package org.openapitools.vertxweb.server.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import java.time.OffsetDateTime;
|
||||
|
||||
/**
|
||||
* An order for a pets from the pet store
|
||||
**/
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class Order {
|
||||
|
||||
private Long id;
|
||||
private Long petId;
|
||||
private Integer quantity;
|
||||
private OffsetDateTime shipDate;
|
||||
|
||||
|
||||
public enum StatusEnum {
|
||||
PLACED("placed"),
|
||||
APPROVED("approved"),
|
||||
DELIVERED("delivered");
|
||||
|
||||
private String value;
|
||||
|
||||
StatusEnum(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
private StatusEnum status;
|
||||
private Boolean complete = false;
|
||||
|
||||
public Order () {
|
||||
|
||||
}
|
||||
|
||||
public Order (Long id, Long petId, Integer quantity, OffsetDateTime shipDate, StatusEnum status, Boolean complete) {
|
||||
this.id = id;
|
||||
this.petId = petId;
|
||||
this.quantity = quantity;
|
||||
this.shipDate = shipDate;
|
||||
this.status = status;
|
||||
this.complete = complete;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty("id")
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty("petId")
|
||||
public Long getPetId() {
|
||||
return petId;
|
||||
}
|
||||
public void setPetId(Long petId) {
|
||||
this.petId = petId;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty("quantity")
|
||||
public Integer getQuantity() {
|
||||
return quantity;
|
||||
}
|
||||
public void setQuantity(Integer quantity) {
|
||||
this.quantity = quantity;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty("shipDate")
|
||||
public OffsetDateTime getShipDate() {
|
||||
return shipDate;
|
||||
}
|
||||
public void setShipDate(OffsetDateTime shipDate) {
|
||||
this.shipDate = shipDate;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty("status")
|
||||
public StatusEnum getStatus() {
|
||||
return status;
|
||||
}
|
||||
public void setStatus(StatusEnum status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty("complete")
|
||||
public Boolean getComplete() {
|
||||
return complete;
|
||||
}
|
||||
public void setComplete(Boolean complete) {
|
||||
this.complete = complete;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Order order = (Order) o;
|
||||
return Objects.equals(id, order.id) &&
|
||||
Objects.equals(petId, order.petId) &&
|
||||
Objects.equals(quantity, order.quantity) &&
|
||||
Objects.equals(shipDate, order.shipDate) &&
|
||||
Objects.equals(status, order.status) &&
|
||||
Objects.equals(complete, order.complete);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, petId, quantity, shipDate, status, complete);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Order {\n");
|
||||
|
||||
sb.append(" id: ").append(toIndentedString(id)).append("\n");
|
||||
sb.append(" petId: ").append(toIndentedString(petId)).append("\n");
|
||||
sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n");
|
||||
sb.append(" shipDate: ").append(toIndentedString(shipDate)).append("\n");
|
||||
sb.append(" status: ").append(toIndentedString(status)).append("\n");
|
||||
sb.append(" complete: ").append(toIndentedString(complete)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given object to string with each line indented by 4 spaces
|
||||
* (except the first line).
|
||||
*/
|
||||
private String toIndentedString(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
package org.openapitools.vertxweb.server.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.openapitools.vertxweb.server.model.Category;
|
||||
import org.openapitools.vertxweb.server.model.Tag;
|
||||
|
||||
/**
|
||||
* A pet for sale in the pet store
|
||||
**/
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class Pet {
|
||||
|
||||
private Long id;
|
||||
private Category category;
|
||||
private String name;
|
||||
private List<String> photoUrls = new ArrayList<>();
|
||||
private List<Tag> tags = new ArrayList<>();
|
||||
|
||||
|
||||
public enum StatusEnum {
|
||||
AVAILABLE("available"),
|
||||
PENDING("pending"),
|
||||
SOLD("sold");
|
||||
|
||||
private String value;
|
||||
|
||||
StatusEnum(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
private StatusEnum status;
|
||||
|
||||
public Pet () {
|
||||
|
||||
}
|
||||
|
||||
public Pet (Long id, Category category, String name, List<String> photoUrls, List<Tag> tags, StatusEnum status) {
|
||||
this.id = id;
|
||||
this.category = category;
|
||||
this.name = name;
|
||||
this.photoUrls = photoUrls;
|
||||
this.tags = tags;
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty("id")
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty("category")
|
||||
public Category getCategory() {
|
||||
return category;
|
||||
}
|
||||
public void setCategory(Category category) {
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty("name")
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty("photoUrls")
|
||||
public List<String> getPhotoUrls() {
|
||||
return photoUrls;
|
||||
}
|
||||
public void setPhotoUrls(List<String> photoUrls) {
|
||||
this.photoUrls = photoUrls;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty("tags")
|
||||
public List<Tag> getTags() {
|
||||
return tags;
|
||||
}
|
||||
public void setTags(List<Tag> tags) {
|
||||
this.tags = tags;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty("status")
|
||||
public StatusEnum getStatus() {
|
||||
return status;
|
||||
}
|
||||
public void setStatus(StatusEnum status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Pet pet = (Pet) o;
|
||||
return Objects.equals(id, pet.id) &&
|
||||
Objects.equals(category, pet.category) &&
|
||||
Objects.equals(name, pet.name) &&
|
||||
Objects.equals(photoUrls, pet.photoUrls) &&
|
||||
Objects.equals(tags, pet.tags) &&
|
||||
Objects.equals(status, pet.status);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, category, name, photoUrls, tags, status);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Pet {\n");
|
||||
|
||||
sb.append(" id: ").append(toIndentedString(id)).append("\n");
|
||||
sb.append(" category: ").append(toIndentedString(category)).append("\n");
|
||||
sb.append(" name: ").append(toIndentedString(name)).append("\n");
|
||||
sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n");
|
||||
sb.append(" tags: ").append(toIndentedString(tags)).append("\n");
|
||||
sb.append(" status: ").append(toIndentedString(status)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given object to string with each line indented by 4 spaces
|
||||
* (except the first line).
|
||||
*/
|
||||
private String toIndentedString(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package org.openapitools.vertxweb.server.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
/**
|
||||
* A tag for a pet
|
||||
**/
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class Tag {
|
||||
|
||||
private Long id;
|
||||
private String name;
|
||||
|
||||
public Tag () {
|
||||
|
||||
}
|
||||
|
||||
public Tag (Long id, String name) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty("id")
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty("name")
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Tag tag = (Tag) o;
|
||||
return Objects.equals(id, tag.id) &&
|
||||
Objects.equals(name, tag.name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Tag {\n");
|
||||
|
||||
sb.append(" id: ").append(toIndentedString(id)).append("\n");
|
||||
sb.append(" name: ").append(toIndentedString(name)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given object to string with each line indented by 4 spaces
|
||||
* (except the first line).
|
||||
*/
|
||||
private String toIndentedString(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,161 @@
|
||||
package org.openapitools.vertxweb.server.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
/**
|
||||
* A User who is purchasing from the pet store
|
||||
**/
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class User {
|
||||
|
||||
private Long id;
|
||||
private String username;
|
||||
private String firstName;
|
||||
private String lastName;
|
||||
private String email;
|
||||
private String password;
|
||||
private String phone;
|
||||
private Integer userStatus;
|
||||
|
||||
public User () {
|
||||
|
||||
}
|
||||
|
||||
public User (Long id, String username, String firstName, String lastName, String email, String password, String phone, Integer userStatus) {
|
||||
this.id = id;
|
||||
this.username = username;
|
||||
this.firstName = firstName;
|
||||
this.lastName = lastName;
|
||||
this.email = email;
|
||||
this.password = password;
|
||||
this.phone = phone;
|
||||
this.userStatus = userStatus;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty("id")
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty("username")
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty("firstName")
|
||||
public String getFirstName() {
|
||||
return firstName;
|
||||
}
|
||||
public void setFirstName(String firstName) {
|
||||
this.firstName = firstName;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty("lastName")
|
||||
public String getLastName() {
|
||||
return lastName;
|
||||
}
|
||||
public void setLastName(String lastName) {
|
||||
this.lastName = lastName;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty("email")
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty("password")
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty("phone")
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty("userStatus")
|
||||
public Integer getUserStatus() {
|
||||
return userStatus;
|
||||
}
|
||||
public void setUserStatus(Integer userStatus) {
|
||||
this.userStatus = userStatus;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
User user = (User) o;
|
||||
return Objects.equals(id, user.id) &&
|
||||
Objects.equals(username, user.username) &&
|
||||
Objects.equals(firstName, user.firstName) &&
|
||||
Objects.equals(lastName, user.lastName) &&
|
||||
Objects.equals(email, user.email) &&
|
||||
Objects.equals(password, user.password) &&
|
||||
Objects.equals(phone, user.phone) &&
|
||||
Objects.equals(userStatus, user.userStatus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class User {\n");
|
||||
|
||||
sb.append(" id: ").append(toIndentedString(id)).append("\n");
|
||||
sb.append(" username: ").append(toIndentedString(username)).append("\n");
|
||||
sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n");
|
||||
sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n");
|
||||
sb.append(" email: ").append(toIndentedString(email)).append("\n");
|
||||
sb.append(" password: ").append(toIndentedString(password)).append("\n");
|
||||
sb.append(" phone: ").append(toIndentedString(phone)).append("\n");
|
||||
sb.append(" userStatus: ").append(toIndentedString(userStatus)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given object to string with each line indented by 4 spaces
|
||||
* (except the first line).
|
||||
*/
|
||||
private String toIndentedString(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,837 @@
|
||||
openapi: 3.0.0
|
||||
info:
|
||||
description: This is a sample server Petstore server. For this sample, you can use
|
||||
the api key `special-key` to test the authorization filters.
|
||||
license:
|
||||
name: Apache-2.0
|
||||
url: http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
title: OpenAPI Petstore
|
||||
version: 1.0.0
|
||||
externalDocs:
|
||||
description: Find out more about Swagger
|
||||
url: http://swagger.io
|
||||
servers:
|
||||
- url: http://petstore.swagger.io/v2
|
||||
tags:
|
||||
- description: Everything about your Pets
|
||||
name: pet
|
||||
- description: Access to Petstore orders
|
||||
name: store
|
||||
- description: Operations about user
|
||||
name: user
|
||||
paths:
|
||||
/pet:
|
||||
post:
|
||||
operationId: addPet
|
||||
requestBody:
|
||||
$ref: '#/components/requestBodies/Pet'
|
||||
responses:
|
||||
405:
|
||||
description: Invalid input
|
||||
security:
|
||||
- petstore_auth:
|
||||
- write:pets
|
||||
- read:pets
|
||||
summary: Add a new pet to the store
|
||||
tags:
|
||||
- pet
|
||||
x-contentType: application/json
|
||||
x-accepts: application/json
|
||||
put:
|
||||
operationId: updatePet
|
||||
requestBody:
|
||||
$ref: '#/components/requestBodies/Pet'
|
||||
responses:
|
||||
400:
|
||||
description: Invalid ID supplied
|
||||
404:
|
||||
description: Pet not found
|
||||
405:
|
||||
description: Validation exception
|
||||
security:
|
||||
- petstore_auth:
|
||||
- write:pets
|
||||
- read:pets
|
||||
summary: Update an existing pet
|
||||
tags:
|
||||
- pet
|
||||
x-contentType: application/json
|
||||
x-accepts: application/json
|
||||
/pet/findByStatus:
|
||||
get:
|
||||
description: Multiple status values can be provided with comma separated strings
|
||||
operationId: findPetsByStatus
|
||||
parameters:
|
||||
- description: Status values that need to be considered for filter
|
||||
explode: false
|
||||
in: query
|
||||
name: status
|
||||
required: true
|
||||
schema:
|
||||
items:
|
||||
default: available
|
||||
enum:
|
||||
- available
|
||||
- pending
|
||||
- sold
|
||||
type: string
|
||||
type: array
|
||||
style: form
|
||||
responses:
|
||||
200:
|
||||
content:
|
||||
application/xml:
|
||||
schema:
|
||||
items:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
type: array
|
||||
application/json:
|
||||
schema:
|
||||
items:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
type: array
|
||||
description: successful operation
|
||||
400:
|
||||
description: Invalid status value
|
||||
security:
|
||||
- petstore_auth:
|
||||
- read:pets
|
||||
summary: Finds Pets by status
|
||||
tags:
|
||||
- pet
|
||||
x-accepts: application/json
|
||||
/pet/findByTags:
|
||||
get:
|
||||
deprecated: true
|
||||
description: Multiple tags can be provided with comma separated strings. Use
|
||||
tag1, tag2, tag3 for testing.
|
||||
operationId: findPetsByTags
|
||||
parameters:
|
||||
- description: Tags to filter by
|
||||
explode: false
|
||||
in: query
|
||||
name: tags
|
||||
required: true
|
||||
schema:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
style: form
|
||||
responses:
|
||||
200:
|
||||
content:
|
||||
application/xml:
|
||||
schema:
|
||||
items:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
type: array
|
||||
application/json:
|
||||
schema:
|
||||
items:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
type: array
|
||||
description: successful operation
|
||||
400:
|
||||
description: Invalid tag value
|
||||
security:
|
||||
- petstore_auth:
|
||||
- read:pets
|
||||
summary: Finds Pets by tags
|
||||
tags:
|
||||
- pet
|
||||
x-accepts: application/json
|
||||
/pet/{petId}:
|
||||
delete:
|
||||
operationId: deletePet
|
||||
parameters:
|
||||
- explode: false
|
||||
in: header
|
||||
name: api_key
|
||||
required: false
|
||||
schema:
|
||||
type: string
|
||||
style: simple
|
||||
- description: Pet id to delete
|
||||
explode: false
|
||||
in: path
|
||||
name: petId
|
||||
required: true
|
||||
schema:
|
||||
format: int64
|
||||
type: integer
|
||||
style: simple
|
||||
responses:
|
||||
400:
|
||||
description: Invalid pet value
|
||||
security:
|
||||
- petstore_auth:
|
||||
- write:pets
|
||||
- read:pets
|
||||
summary: Deletes a pet
|
||||
tags:
|
||||
- pet
|
||||
x-accepts: application/json
|
||||
get:
|
||||
description: Returns a single pet
|
||||
operationId: getPetById
|
||||
parameters:
|
||||
- description: ID of pet to return
|
||||
explode: false
|
||||
in: path
|
||||
name: petId
|
||||
required: true
|
||||
schema:
|
||||
format: int64
|
||||
type: integer
|
||||
style: simple
|
||||
responses:
|
||||
200:
|
||||
content:
|
||||
application/xml:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
description: successful operation
|
||||
400:
|
||||
description: Invalid ID supplied
|
||||
404:
|
||||
description: Pet not found
|
||||
security:
|
||||
- api_key: []
|
||||
summary: Find pet by ID
|
||||
tags:
|
||||
- pet
|
||||
x-accepts: application/json
|
||||
post:
|
||||
operationId: updatePetWithForm
|
||||
parameters:
|
||||
- description: ID of pet that needs to be updated
|
||||
explode: false
|
||||
in: path
|
||||
name: petId
|
||||
required: true
|
||||
schema:
|
||||
format: int64
|
||||
type: integer
|
||||
style: simple
|
||||
requestBody:
|
||||
$ref: '#/components/requestBodies/inline_object'
|
||||
content:
|
||||
application/x-www-form-urlencoded:
|
||||
schema:
|
||||
properties:
|
||||
name:
|
||||
description: Updated name of the pet
|
||||
type: string
|
||||
status:
|
||||
description: Updated status of the pet
|
||||
type: string
|
||||
type: object
|
||||
responses:
|
||||
405:
|
||||
description: Invalid input
|
||||
security:
|
||||
- petstore_auth:
|
||||
- write:pets
|
||||
- read:pets
|
||||
summary: Updates a pet in the store with form data
|
||||
tags:
|
||||
- pet
|
||||
x-contentType: application/x-www-form-urlencoded
|
||||
x-accepts: application/json
|
||||
/pet/{petId}/uploadImage:
|
||||
post:
|
||||
operationId: uploadFile
|
||||
parameters:
|
||||
- description: ID of pet to update
|
||||
explode: false
|
||||
in: path
|
||||
name: petId
|
||||
required: true
|
||||
schema:
|
||||
format: int64
|
||||
type: integer
|
||||
style: simple
|
||||
requestBody:
|
||||
$ref: '#/components/requestBodies/inline_object_1'
|
||||
content:
|
||||
multipart/form-data:
|
||||
schema:
|
||||
properties:
|
||||
additionalMetadata:
|
||||
description: Additional data to pass to server
|
||||
type: string
|
||||
file:
|
||||
description: file to upload
|
||||
format: binary
|
||||
type: string
|
||||
type: object
|
||||
responses:
|
||||
200:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ApiResponse'
|
||||
description: successful operation
|
||||
security:
|
||||
- petstore_auth:
|
||||
- write:pets
|
||||
- read:pets
|
||||
summary: uploads an image
|
||||
tags:
|
||||
- pet
|
||||
x-contentType: multipart/form-data
|
||||
x-accepts: application/json
|
||||
/store/inventory:
|
||||
get:
|
||||
description: Returns a map of status codes to quantities
|
||||
operationId: getInventory
|
||||
responses:
|
||||
200:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
additionalProperties:
|
||||
format: int32
|
||||
type: integer
|
||||
type: object
|
||||
description: successful operation
|
||||
security:
|
||||
- api_key: []
|
||||
summary: Returns pet inventories by status
|
||||
tags:
|
||||
- store
|
||||
x-accepts: application/json
|
||||
/store/order:
|
||||
post:
|
||||
operationId: placeOrder
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Order'
|
||||
description: order placed for purchasing the pet
|
||||
required: true
|
||||
responses:
|
||||
200:
|
||||
content:
|
||||
application/xml:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Order'
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Order'
|
||||
description: successful operation
|
||||
400:
|
||||
description: Invalid Order
|
||||
summary: Place an order for a pet
|
||||
tags:
|
||||
- store
|
||||
x-contentType: application/json
|
||||
x-accepts: application/json
|
||||
/store/order/{orderId}:
|
||||
delete:
|
||||
description: For valid response try integer IDs with value < 1000. Anything
|
||||
above 1000 or nonintegers will generate API errors
|
||||
operationId: deleteOrder
|
||||
parameters:
|
||||
- description: ID of the order that needs to be deleted
|
||||
explode: false
|
||||
in: path
|
||||
name: orderId
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
style: simple
|
||||
responses:
|
||||
400:
|
||||
description: Invalid ID supplied
|
||||
404:
|
||||
description: Order not found
|
||||
summary: Delete purchase order by ID
|
||||
tags:
|
||||
- store
|
||||
x-accepts: application/json
|
||||
get:
|
||||
description: For valid response try integer IDs with value <= 5 or > 10. Other
|
||||
values will generated exceptions
|
||||
operationId: getOrderById
|
||||
parameters:
|
||||
- description: ID of pet that needs to be fetched
|
||||
explode: false
|
||||
in: path
|
||||
name: orderId
|
||||
required: true
|
||||
schema:
|
||||
format: int64
|
||||
maximum: 5
|
||||
minimum: 1
|
||||
type: integer
|
||||
style: simple
|
||||
responses:
|
||||
200:
|
||||
content:
|
||||
application/xml:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Order'
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Order'
|
||||
description: successful operation
|
||||
400:
|
||||
description: Invalid ID supplied
|
||||
404:
|
||||
description: Order not found
|
||||
summary: Find purchase order by ID
|
||||
tags:
|
||||
- store
|
||||
x-accepts: application/json
|
||||
/user:
|
||||
post:
|
||||
description: This can only be done by the logged in user.
|
||||
operationId: createUser
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/User'
|
||||
description: Created user object
|
||||
required: true
|
||||
responses:
|
||||
default:
|
||||
description: successful operation
|
||||
security:
|
||||
- auth_cookie: []
|
||||
summary: Create user
|
||||
tags:
|
||||
- user
|
||||
x-contentType: application/json
|
||||
x-accepts: application/json
|
||||
/user/createWithArray:
|
||||
post:
|
||||
operationId: createUsersWithArrayInput
|
||||
requestBody:
|
||||
$ref: '#/components/requestBodies/UserArray'
|
||||
responses:
|
||||
default:
|
||||
description: successful operation
|
||||
security:
|
||||
- auth_cookie: []
|
||||
summary: Creates list of users with given input array
|
||||
tags:
|
||||
- user
|
||||
x-contentType: application/json
|
||||
x-accepts: application/json
|
||||
/user/createWithList:
|
||||
post:
|
||||
operationId: createUsersWithListInput
|
||||
requestBody:
|
||||
$ref: '#/components/requestBodies/UserArray'
|
||||
responses:
|
||||
default:
|
||||
description: successful operation
|
||||
security:
|
||||
- auth_cookie: []
|
||||
summary: Creates list of users with given input array
|
||||
tags:
|
||||
- user
|
||||
x-contentType: application/json
|
||||
x-accepts: application/json
|
||||
/user/login:
|
||||
get:
|
||||
operationId: loginUser
|
||||
parameters:
|
||||
- description: The user name for login
|
||||
explode: true
|
||||
in: query
|
||||
name: username
|
||||
required: true
|
||||
schema:
|
||||
pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$
|
||||
type: string
|
||||
style: form
|
||||
- description: The password for login in clear text
|
||||
explode: true
|
||||
in: query
|
||||
name: password
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
style: form
|
||||
responses:
|
||||
200:
|
||||
content:
|
||||
application/xml:
|
||||
schema:
|
||||
type: string
|
||||
application/json:
|
||||
schema:
|
||||
type: string
|
||||
description: successful operation
|
||||
headers:
|
||||
Set-Cookie:
|
||||
description: Cookie authentication key for use with the `auth_cookie`
|
||||
apiKey authentication.
|
||||
explode: false
|
||||
schema:
|
||||
example: AUTH_KEY=abcde12345; Path=/; HttpOnly
|
||||
type: string
|
||||
style: simple
|
||||
X-Rate-Limit:
|
||||
description: calls per hour allowed by the user
|
||||
explode: false
|
||||
schema:
|
||||
format: int32
|
||||
type: integer
|
||||
style: simple
|
||||
X-Expires-After:
|
||||
description: date in UTC when toekn expires
|
||||
explode: false
|
||||
schema:
|
||||
format: date-time
|
||||
type: string
|
||||
style: simple
|
||||
400:
|
||||
description: Invalid username/password supplied
|
||||
summary: Logs user into the system
|
||||
tags:
|
||||
- user
|
||||
x-accepts: application/json
|
||||
/user/logout:
|
||||
get:
|
||||
operationId: logoutUser
|
||||
responses:
|
||||
default:
|
||||
description: successful operation
|
||||
security:
|
||||
- auth_cookie: []
|
||||
summary: Logs out current logged in user session
|
||||
tags:
|
||||
- user
|
||||
x-accepts: application/json
|
||||
/user/{username}:
|
||||
delete:
|
||||
description: This can only be done by the logged in user.
|
||||
operationId: deleteUser
|
||||
parameters:
|
||||
- description: The name that needs to be deleted
|
||||
explode: false
|
||||
in: path
|
||||
name: username
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
style: simple
|
||||
responses:
|
||||
400:
|
||||
description: Invalid username supplied
|
||||
404:
|
||||
description: User not found
|
||||
security:
|
||||
- auth_cookie: []
|
||||
summary: Delete user
|
||||
tags:
|
||||
- user
|
||||
x-accepts: application/json
|
||||
get:
|
||||
operationId: getUserByName
|
||||
parameters:
|
||||
- description: The name that needs to be fetched. Use user1 for testing.
|
||||
explode: false
|
||||
in: path
|
||||
name: username
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
style: simple
|
||||
responses:
|
||||
200:
|
||||
content:
|
||||
application/xml:
|
||||
schema:
|
||||
$ref: '#/components/schemas/User'
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/User'
|
||||
description: successful operation
|
||||
400:
|
||||
description: Invalid username supplied
|
||||
404:
|
||||
description: User not found
|
||||
summary: Get user by user name
|
||||
tags:
|
||||
- user
|
||||
x-accepts: application/json
|
||||
put:
|
||||
description: This can only be done by the logged in user.
|
||||
operationId: updateUser
|
||||
parameters:
|
||||
- description: name that need to be deleted
|
||||
explode: false
|
||||
in: path
|
||||
name: username
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
style: simple
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/User'
|
||||
description: Updated user object
|
||||
required: true
|
||||
responses:
|
||||
400:
|
||||
description: Invalid user supplied
|
||||
404:
|
||||
description: User not found
|
||||
security:
|
||||
- auth_cookie: []
|
||||
summary: Updated user
|
||||
tags:
|
||||
- user
|
||||
x-contentType: application/json
|
||||
x-accepts: application/json
|
||||
components:
|
||||
requestBodies:
|
||||
UserArray:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
items:
|
||||
$ref: '#/components/schemas/User'
|
||||
type: array
|
||||
description: List of user object
|
||||
required: true
|
||||
Pet:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
application/xml:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
description: Pet object that needs to be added to the store
|
||||
required: true
|
||||
inline_object:
|
||||
content:
|
||||
application/x-www-form-urlencoded:
|
||||
schema:
|
||||
$ref: '#/components/schemas/inline_object'
|
||||
inline_object_1:
|
||||
content:
|
||||
multipart/form-data:
|
||||
schema:
|
||||
$ref: '#/components/schemas/inline_object_1'
|
||||
schemas:
|
||||
Order:
|
||||
description: An order for a pets from the pet store
|
||||
example:
|
||||
petId: 6
|
||||
quantity: 1
|
||||
id: 0
|
||||
shipDate: 2000-01-23T04:56:07.000+00:00
|
||||
complete: false
|
||||
status: placed
|
||||
properties:
|
||||
id:
|
||||
format: int64
|
||||
type: integer
|
||||
petId:
|
||||
format: int64
|
||||
type: integer
|
||||
quantity:
|
||||
format: int32
|
||||
type: integer
|
||||
shipDate:
|
||||
format: date-time
|
||||
type: string
|
||||
status:
|
||||
description: Order Status
|
||||
enum:
|
||||
- placed
|
||||
- approved
|
||||
- delivered
|
||||
type: string
|
||||
complete:
|
||||
default: false
|
||||
type: boolean
|
||||
title: Pet Order
|
||||
type: object
|
||||
xml:
|
||||
name: Order
|
||||
Category:
|
||||
description: A category for a pet
|
||||
example:
|
||||
name: name
|
||||
id: 6
|
||||
properties:
|
||||
id:
|
||||
format: int64
|
||||
type: integer
|
||||
name:
|
||||
pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$
|
||||
type: string
|
||||
title: Pet category
|
||||
type: object
|
||||
xml:
|
||||
name: Category
|
||||
User:
|
||||
description: A User who is purchasing from the pet store
|
||||
example:
|
||||
firstName: firstName
|
||||
lastName: lastName
|
||||
password: password
|
||||
userStatus: 6
|
||||
phone: phone
|
||||
id: 0
|
||||
email: email
|
||||
username: username
|
||||
properties:
|
||||
id:
|
||||
format: int64
|
||||
type: integer
|
||||
username:
|
||||
type: string
|
||||
firstName:
|
||||
type: string
|
||||
lastName:
|
||||
type: string
|
||||
email:
|
||||
type: string
|
||||
password:
|
||||
type: string
|
||||
phone:
|
||||
type: string
|
||||
userStatus:
|
||||
description: User Status
|
||||
format: int32
|
||||
type: integer
|
||||
title: a User
|
||||
type: object
|
||||
xml:
|
||||
name: User
|
||||
Tag:
|
||||
description: A tag for a pet
|
||||
example:
|
||||
name: name
|
||||
id: 1
|
||||
properties:
|
||||
id:
|
||||
format: int64
|
||||
type: integer
|
||||
name:
|
||||
type: string
|
||||
title: Pet Tag
|
||||
type: object
|
||||
xml:
|
||||
name: Tag
|
||||
Pet:
|
||||
description: A pet for sale in the pet store
|
||||
example:
|
||||
photoUrls:
|
||||
- photoUrls
|
||||
- photoUrls
|
||||
name: doggie
|
||||
id: 0
|
||||
category:
|
||||
name: name
|
||||
id: 6
|
||||
tags:
|
||||
- name: name
|
||||
id: 1
|
||||
- name: name
|
||||
id: 1
|
||||
status: available
|
||||
properties:
|
||||
id:
|
||||
format: int64
|
||||
type: integer
|
||||
category:
|
||||
$ref: '#/components/schemas/Category'
|
||||
name:
|
||||
example: doggie
|
||||
type: string
|
||||
photoUrls:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
xml:
|
||||
name: photoUrl
|
||||
wrapped: true
|
||||
tags:
|
||||
items:
|
||||
$ref: '#/components/schemas/Tag'
|
||||
type: array
|
||||
xml:
|
||||
name: tag
|
||||
wrapped: true
|
||||
status:
|
||||
description: pet status in the store
|
||||
enum:
|
||||
- available
|
||||
- pending
|
||||
- sold
|
||||
type: string
|
||||
required:
|
||||
- name
|
||||
- photoUrls
|
||||
title: a Pet
|
||||
type: object
|
||||
xml:
|
||||
name: Pet
|
||||
ApiResponse:
|
||||
description: Describes the result of uploading an image resource
|
||||
example:
|
||||
code: 0
|
||||
type: type
|
||||
message: message
|
||||
properties:
|
||||
code:
|
||||
format: int32
|
||||
type: integer
|
||||
type:
|
||||
type: string
|
||||
message:
|
||||
type: string
|
||||
title: An uploaded response
|
||||
type: object
|
||||
inline_object:
|
||||
properties:
|
||||
name:
|
||||
description: Updated name of the pet
|
||||
type: string
|
||||
status:
|
||||
description: Updated status of the pet
|
||||
type: string
|
||||
type: object
|
||||
inline_object_1:
|
||||
properties:
|
||||
additionalMetadata:
|
||||
description: Additional data to pass to server
|
||||
type: string
|
||||
file:
|
||||
description: file to upload
|
||||
format: binary
|
||||
type: string
|
||||
type: object
|
||||
securitySchemes:
|
||||
petstore_auth:
|
||||
flows:
|
||||
implicit:
|
||||
authorizationUrl: http://petstore.swagger.io/api/oauth/dialog
|
||||
scopes:
|
||||
write:pets: modify pets in your account
|
||||
read:pets: read your pets
|
||||
type: oauth2
|
||||
api_key:
|
||||
in: header
|
||||
name: api_key
|
||||
type: apiKey
|
||||
auth_cookie:
|
||||
in: cookie
|
||||
name: AUTH_KEY
|
||||
type: apiKey
|
||||
Reference in New Issue
Block a user