Javadoc + operations interface + provider for state(ful/less) handlers (#8346)

* Added Javadoc + meta-data about request/response + abstract class.

* Added one more method to set base path.

* Updated Javadoc for each endpoint.

* Shorten the method name displayed in Javadoc.

* Fix README grammar.

* Separate imports based on type.

* Put operations into their own interface class.

* Update Javadoc.

* Adjust Mustache template to support Java 1.5.

* Add import for HttpServerExchange, suppress warning about using a Lambda.

* Remove @Override from a mgetStatefulHandler().

* Regenrate the samples.
This commit is contained in:
Noor Dawod 2021-01-19 06:16:20 +01:00 committed by GitHub
parent ede2a2316c
commit f5c49609d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
28 changed files with 1239 additions and 233 deletions

View File

@ -106,6 +106,7 @@ public class JavaUndertowServerCodegen extends AbstractJavaCodegen {
// keep the yaml in config folder for framework validation.
supportingFiles.add(new SupportingFile("openapi.mustache", ("src.main.resources.config").replace(".", java.io.File.separator), "openapi.json"));
supportingFiles.add(new SupportingFile("interface.mustache", (String.format(Locale.ROOT, "src.main.java.%s", apiPackage)).replace(".", java.io.File.separator), "PathHandlerInterface.java"));
supportingFiles.add(new SupportingFile("handler.mustache", (String.format(Locale.ROOT, "src.main.java.%s", apiPackage)).replace(".", java.io.File.separator), "PathHandlerProvider.java"));
supportingFiles.add(new SupportingFile("service.mustache", ("src.main.resources.META-INF.services").replace(".", java.io.File.separator), "com.networknt.server.HandlerProvider"));

View File

@ -10,15 +10,13 @@ mvn package exec:exec
## Test
By default, all endpoints are protected by OAuth jwt token verifier. It can be turned off with config change through for development.
By default, all endpoints are protected by the OAuth JWT token verifier. It can be turned off with a config change, when required.
In order to access the server, there is a long lived token below issued by my
oauth2 server [undertow-server-oauth2](https://github.com/networknt/undertow-server-oauth2)
OAuth2 server [undertow-server-oauth2](https://github.com/networknt/undertow-server-oauth2).
```
Bearer eyJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJ1cm46Y29tOm5ldHdvcmtudDpvYXV0aDI6djEiLCJhdWQiOiJ1cm46Y29tLm5ldHdvcmtudCIsImV4cCI6MTc4ODEzMjczNSwianRpIjoiNWtyM2ZWOHJaelBZNEJrSnNYZzFpQSIsImlhdCI6MTQ3Mjc3MjczNSwibmJmIjoxNDcyNzcyNjE1LCJ2ZXJzaW9uIjoiMS4wIiwidXNlcl9pZCI6InN0ZXZlIiwidXNlcl90eXBlIjoiRU1QTE9ZRUUiLCJjbGllbnRfaWQiOiJkZGNhZjBiYS0xMTMxLTIyMzItMzMxMy1kNmYyNzUzZjI1ZGMiLCJzY29wZSI6WyJhcGkuciIsImFwaS53Il19.gteJiy1uao8HLeWRljpZxHWUgQfofwmnFP-zv3EPUyXjyCOy3xclnfeTnTE39j8PgBwdFASPcDLLk1YfZJbsU6pLlmYXLtdpHDBsVmIRuch6LFPCVQ3JdqSQVci59OhSK0bBThGWqCD3UzDI_OnX4IVCAahcT9Bu94m5u_H_JNmwDf1XaP3Lt4I34buYMuRD9stchsnZi-tuIRkL13FARm1XA9aPZUMUXFdedBWDXo1zMREQ_qCJXOpaZDJM9Im0rIkq9wTEVU00pbRp_Vcdya3dfkFteBMHiwFVt6VNQaco5BXURDAIzXidwQxNEbX1ek03wra8AIani65ZK7fy_w
```
Add "Authorization" header with value as above token and a dummy message will return from the generated stub.

View File

@ -1 +1 @@
{{#isBodyParam}}{{{dataType}}} {{paramName}}{{/isBodyParam}}
{{#isBodyParam}}{{{dataType}}} {{{paramName}}}{{/isBodyParam}}

View File

@ -1 +1 @@
@javax.annotation.Generated(value = "{{generatorClass}}"{{^hideGenerationTimestamp}}, date = "{{generatedDate}}"{{/hideGenerationTimestamp}})
@javax.annotation.Generated(value = "{{{generatorClass}}}"{{^hideGenerationTimestamp}}, date = "{{{generatedDate}}}"{{/hideGenerationTimestamp}})

View File

@ -1,34 +1,161 @@
{{>licenseInfo}}
package org.openapitools.handler;
import com.networknt.config.Config;
import com.networknt.server.HandlerProvider;
import io.undertow.Handlers;
import io.undertow.server.HttpHandler;
import io.undertow.server.HttpServerExchange;
import io.undertow.server.RoutingHandler;
import io.undertow.server.handlers.PathHandler;
import io.undertow.util.Methods;
public class PathHandlerProvider implements HandlerProvider {
/**
* The default implementation for {@link HandlerProvider} and {@link PathHandlerInterface}.
*
* <p>There are two flavors of {@link HttpHandler}s to choose from, depending on your needs:</p>
*
* <ul>
* <li>
* <b>Stateless</b>: if a specific endpoint is called more than once from multiple sessions,
* its state is not retained a different {@link HttpHandler} is instantiated for every new
* session. This is the default behavior.
* </li>
* <li>
* <b>Stateful</b>: if a specific endpoint is called more than once from multiple sessions,
* its state is retained properly. For example, if you want to keep a class property that counts
* the number of requests or the last time a request was received.
* </li>
* </ul>
* <p>Note: <b>Stateful</b> flavor is more performant than <b>Stateless</b>.</p>
*/
@SuppressWarnings("TooManyFunctions")
abstract public class PathHandlerProvider implements HandlerProvider, PathHandlerInterface {
/**
* Returns the default base path to access this server.
*/
@javax.annotation.Nonnull
public String getBasePath() {
return "{{{basePathWithoutHost}}}";
}
/**
* Returns a stateless {@link HttpHandler} that configures all endpoints in this server.
*
* <p>Endpoints bound in this method do NOT start with "{{{basePathWithoutHost}}}", and
* it's your responsibility to configure a {@link PathHandler} with a prefix path
* by calling {@link PathHandler#addPrefixPath} like so:</p>
*
* <code>pathHandler.addPrefixPath("{{{basePathWithoutHost}}}", handler)</code>
*
* <p>Note: the endpoints bound to the returned {@link HttpHandler} are stateless and won't
* retain any state between multiple sessions.</p>
*
* @return an {@link HttpHandler} of type {@link RoutingHandler}
*/
@javax.annotation.Nonnull
@Override
public HttpHandler getHandler() {
HttpHandler handler = Handlers.routing()
return getHandler(false);
}
/**
* Returns a stateless {@link HttpHandler} that configures all endpoints in this server.
*
* <p>Note: the endpoints bound to the returned {@link HttpHandler} are stateless and won't
* retain any state between multiple sessions.</p>
*
* @param withBasePath if true, all endpoints would start with "{{{basePathWithoutHost}}}"
* @return an {@link HttpHandler} of type {@link RoutingHandler}
*/
@javax.annotation.Nonnull
public HttpHandler getHandler(final boolean withBasePath) {
return getHandler(withBasePath ? getBasePath() : "");
}
/**
* Returns a stateless {@link HttpHandler} that configures all endpoints in this server.
*
* <p>Note: the endpoints bound to the returned {@link HttpHandler} are stateless and won't
* retain any state between multiple sessions.</p>
*
* @param basePath base path to set for all endpoints
* @return an {@link HttpHandler} of type {@link RoutingHandler}
*/
@SuppressWarnings("Convert2Lambda")
@javax.annotation.Nonnull
public HttpHandler getHandler(final String basePath) {
return Handlers.routing()
{{#apiInfo}}
{{#apis}}
{{#operations}}
{{#operation}}
.add(Methods.{{httpMethod}}, "{{{basePathWithoutHost}}}{{{path}}}", new HttpHandler() {
.add(Methods.{{{httpMethod}}}, basePath + "{{{path}}}", new HttpHandler() {
@Override
public void handleRequest(HttpServerExchange exchange) throws Exception {
exchange.getResponseSender().send("{{operationId}}");
{{{operationId}}}().handleRequest(exchange);
}
})
{{/operation}}
{{/operations}}
{{/apis}}
{{/apiInfo}}
;
return handler;
}
{{/apiInfo}}
}
/**
* Returns a stateful {@link HttpHandler} that configures all endpoints in this server.
*
* <p>Endpoints bound in this method do NOT start with "{{{basePathWithoutHost}}}", and
* it's your responsibility to configure a {@link PathHandler} with a prefix path
* by calling {@link PathHandler#addPrefixPath} like so:</p>
*
* <code>pathHandler.addPrefixPath("{{{basePathWithoutHost}}}", handler)</code>
*
* <p>Note: the endpoints bound to the returned {@link HttpHandler} are stateful and will
* retain any state between multiple sessions.</p>
*
* @return an {@link HttpHandler} of type {@link RoutingHandler}
*/
@javax.annotation.Nonnull
public HttpHandler getStatefulHandler() {
return getStatefulHandler(false);
}
/**
* Returns a stateful {@link HttpHandler} that configures all endpoints in this server.
*
* <p>Note: the endpoints bound to the returned {@link HttpHandler} are stateful and will
* retain any state between multiple sessions.</p>
*
* @param withBasePath if true, all endpoints would start with "{{{basePathWithoutHost}}}"
* @return an {@link HttpHandler} of type {@link RoutingHandler}
*/
@javax.annotation.Nonnull
public HttpHandler getStatefulHandler(final boolean withBasePath) {
return getStatefulHandler(withBasePath ? getBasePath() : "");
}
/**
* Returns a stateful {@link HttpHandler} that configures all endpoints in this server.
*
* <p>Note: the endpoints bound to the returned {@link HttpHandler} are stateful and will
* retain any state between multiple sessions.</p>
*
* @param basePath base path to set for all endpoints
* @return an {@link HttpHandler} of type {@link RoutingHandler}
*/
@javax.annotation.Nonnull
public HttpHandler getStatefulHandler(final String basePath) {
return Handlers.routing()
{{#apiInfo}}
{{#apis}}
{{#operations}}
{{#operation}}
.add(Methods.{{{httpMethod}}}, basePath + "{{{path}}}", {{{operationId}}}())
{{/operation}}
{{/operations}}
{{/apis}}
;
{{/apiInfo}}
}
}

View File

@ -1,10 +1,10 @@
controllerPackage: {{invokerPackage}}
modelPackage: {{modelPackage}}
controllerPackage: {{{invokerPackage}}}
modelPackage: {{{modelPackage}}}
swaggerUrl: ./src/main/swagger/swagger.yaml
modelMappings:
# to enable explicit mappings, use this syntax:
DefinitionFromSwaggerSpecification: fully.qualified.path.to.Model
{{#models}}{{#model}}{{classname}} : {{modelPackage}}.{{classname}}{{/model}}
{{#models}}{{#model}}{{{classname}}} : {{{modelPackage}}}.{{{classname}}}{{/model}}
{{/models}}
entityProcessors:

View File

@ -0,0 +1,76 @@
{{>licenseInfo}}
package org.openapitools.handler;
import io.undertow.server.*;
import io.undertow.util.*;
import {{modelPackage}}.*;
@SuppressWarnings("TooManyFunctions")
public interface PathHandlerInterface {
{{#apiInfo}}
{{#apis}}
{{#operations}}
{{#operation}}
/**
{{#summary}} * <p>{{{summary}}}</p>
*
{{/summary}}
{{#notes}} * <p>{{{notes}}}</p>
*
{{/notes}}
* <p><b>Endpoint</b>: {@link Methods#{{{httpMethod}}} {{{httpMethod}}}} "{{{basePathWithoutHost}}}{{{path}}}" (<i>privileged: {{{hasAuthMethods}}}</i>)</p>
{{#hasParams}}
*
* <p><b>Request parameters</b>:</p>
* <ul>
{{#allParams}}
{{^isBodyParam}}
* <li>
* <p>"<b>{{{baseName}}}</b>"
{{#description}} * <p>{{{description}}}</p>
{{/description}}
* <p>
* - Parameter type: <b>{{>isContainerDoc}}{{#isModel}}{@link {{{dataType}}}}{{/isModel}}{{^isModel}}{{#isFile}}{{#isBinary}}Binary{{/isBinary}}File{{/isFile}}{{^isFile}}{@link {{dataType}}}{{/isFile}}{{/isModel}}</b><br/>
* - Appears in: <b>{{#isFormParam}}{@link io.undertow.server.handlers.form.FormDataParser Form}{{/isFormParam}}{{#isQueryParam}}{@link HttpServerExchange#getQueryParameters Query}{{/isQueryParam}}{{#isPathParam}}{@link HttpServerExchange#getPathParameters Path}{{/isPathParam}}{{#isHeaderParam}}{@link Headers Header}{{/isHeaderParam}}{{#isCookieParam}}{@link HttpServerExchange#getRequestCookie Cookie}{{/isCookieParam}}{{#isBodyParam}}{@link HttpServerExchange#getRequestChannel Body}{{/isBodyParam}}</b><br/>
{{#defaultValue}} * - Default value: <b>{{{defaultValue}}}</b><br/>
{{/defaultValue}}
* - Required: <b>{{{required}}}</b>
* </p>
* </li>
{{/isBodyParam}}
{{/allParams}}
* </ul>
{{/hasParams}}
{{#hasResponseHeaders}}
* <p><b>Response headers</b>: [{{#responseHeaders}}{{{.}}}{{^-last}}, {{/-last}}{{/responseHeaders}}]</p>
{{/hasResponseHeaders}}
{{#hasConsumes}}
*
* <p><b>Consumes</b>: {{{consumes}}}</p>
{{#hasBodyParam}}{{#bodyParam}} * <p><b>Payload</b>: {{>isContainerDoc}}{{#isModel}}{@link {{{dataType}}}}{{/isModel}}{{^isModel}}{{#isFile}}{{#isBinary}}Binary {{/isBinary}}File{{/isFile}}{{^isFile}}{@link {{baseType}}}{{/isFile}}{{/isModel}} (<i>required: {{{required}}}</i>{{/bodyParam}})</p>
{{/hasBodyParam}}
{{/hasConsumes}}
*
{{#hasProduces}} * <p><b>Produces</b>: {{{produces}}}</p>
{{/hasProduces}}
{{#returnBaseType}} * <p><b>Returns</b>: {{>isContainerDoc}}{@link {{{returnBaseType}}}}</p>
{{/returnBaseType}}
*
* <p><b>Responses</b>:</p>
* <ul>
{{#responses}}
* <li><b>{{#isDefault}}Default{{/isDefault}}{{^isDefault}}{{{code}}} ({{#is1xx}}informative{{/is1xx}}{{#is2xx}}success{{/is2xx}}{{#is3xx}}redirection{{/is3xx}}{{#is4xx}}client error{{/is4xx}}{{#is5xx}}server error{{/is5xx}}){{/isDefault}}</b>{{#message}}: {{{message}}}{{/message}}</li>
{{/responses}}
* </ul>
*/
@javax.annotation.Nonnull
{{#isDeprecated}} @Deprecated
{{/isDeprecated}}
HttpHandler {{{operationId}}}();
{{/operation}}
{{/operations}}
{{/apis}}
{{/apiInfo}}
}

View File

@ -0,0 +1 @@
{{#isArray}}{@link java.util.List List} of {{/isArray}}{{#isMap}}{@link java.util.Map Map} of {{/isMap}}

View File

@ -0,0 +1,10 @@
/*
* {{{appName}}}
*
* {{{appDescription}}}
*
* {{#version}}OpenAPI document version: {{{version}}}{{/version}}
* {{#infoEmail}}Maintained by: {{{infoEmail}}}{{/infoEmail}}
*
* AUTO-GENERATED FILE, DO NOT MODIFY!
*/

View File

@ -1,15 +1,16 @@
{{>licenseInfo}}
package {{package}};
import java.util.Objects;
{{#imports}}import {{import}};
{{#imports}}import {{{import}}};
{{/imports}}
{{#serializableModel}}import java.io.Serializable;{{/serializableModel}}
{{#models}}
{{#model}}{{#description}}
/**
* {{description}}
**/{{/description}}
* {{{description}}}
*/{{/description}}
{{#isEnum}}{{>enumOuterClass}}{{/isEnum}}
{{^isEnum}}{{>pojo}}{{/isEnum}}
{{/model}}

View File

@ -1 +1 @@
{{#isPathParam}}{{{dataType}}} {{paramName}}{{/isPathParam}}
{{#isPathParam}}{{{dataType}}} {{{paramName}}}{{/isPathParam}}

View File

@ -6,21 +6,21 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali
{{>enumClass}}{{/isContainer}}{{#isContainer}}{{#mostInnerItems}}
{{>enumClass}}{{/mostInnerItems}}{{/isContainer}}{{/isEnum}}
private {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};{{/vars}}
private {{{datatypeWithEnum}}} {{{name}}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};{{/vars}}
{{#vars}}
/**{{#description}}
* {{{description}}}{{/description}}{{#minimum}}
* minimum: {{minimum}}{{/minimum}}{{#maximum}}
* maximum: {{maximum}}{{/maximum}}
**/
public {{classname}} {{name}}({{{datatypeWithEnum}}} {{name}}) {
this.{{name}} = {{name}};
* minimum: {{{minimum}}}{{/minimum}}{{#maximum}}
* maximum: {{{maximum}}}{{/maximum}}
*/
public {{{classname}}} {{{name}}}({{{datatypeWithEnum}}} {{{name}}}) {
this.{{{name}}} = {{{name}}};
return this;
}
{{#vendorExtensions.x-extra-annotation}}{{{vendorExtensions.x-extra-annotation}}}{{/vendorExtensions.x-extra-annotation}}
@ApiModelProperty({{#example}}example = "{{{example}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}")
@ApiModelProperty({{#example}}example = "{{{example}}}", {{/example}}{{#required}}required = {{{required}}}, {{/required}}value = "{{{description}}}")
@JsonProperty("{{baseName}}")
public {{{datatypeWithEnum}}} {{getter}}() {
return {{name}};
@ -39,23 +39,23 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali
if (o == null || getClass() != o.getClass()) {
return false;
}
{{classname}} {{classVarName}} = ({{classname}}) o;{{#hasVars}}
return {{#vars}}Objects.equals({{name}}, {{classVarName}}.{{name}}){{^-last}} &&
{{{classname}}} {{{classVarName}}} = ({{{classname}}}) o;{{#hasVars}}
return {{#vars}}Objects.equals({{{name}}}, {{{classVarName}}}.{{{name}}}){{^-last}} &&
{{/-last}}{{#-last}};{{/-last}}{{/vars}}{{/hasVars}}{{^hasVars}}
return true;{{/hasVars}}
}
@Override
public int hashCode() {
return Objects.hash({{#vars}}{{name}}{{^-last}}, {{/-last}}{{/vars}});
return Objects.hash({{#vars}}{{{name}}}{{^-last}}, {{/-last}}{{/vars}});
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class {{classname}} {\n");
sb.append("class {{{classname}}} {\n");
{{#parent}}sb.append(" ").append(toIndentedString(super.toString())).append("\n");{{/parent}}
{{#vars}}sb.append(" {{name}}: ").append(toIndentedString({{name}})).append("\n");
{{#vars}}sb.append(" {{{name}}}: ").append(toIndentedString({{{name}}})).append("\n");
{{/vars}}sb.append("}");
return sb.toString();
}

View File

@ -6,11 +6,11 @@
<version>5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>{{groupId}}</groupId>
<artifactId>{{artifactId}}</artifactId>
<groupId>{{{groupId}}}</groupId>
<artifactId>{{{artifactId}}}</artifactId>
<packaging>jar</packaging>
<name>{{artifactId}}</name>
<version>{{artifactVersion}}</version>
<name>{{{artifactId}}}</name>
<version>{{{artifactVersion}}}</version>
<properties>
<java.version>1.8</java.version>

View File

@ -1 +1 @@
{{#isQueryParam}}{{{dataType}}} {{paramName}}{{/isQueryParam}}
{{#isQueryParam}}{{{dataType}}} {{{paramName}}}{{/isQueryParam}}

View File

@ -1,5 +1,6 @@
README.md
pom.xml
src/main/java/org/openapitools/handler/PathHandlerInterface.java
src/main/java/org/openapitools/handler/PathHandlerProvider.java
src/main/java/org/openapitools/model/Category.java
src/main/java/org/openapitools/model/ModelApiResponse.java

View File

@ -1 +1 @@
5.0.0-SNAPSHOT
5.0.1-SNAPSHOT

View File

@ -10,15 +10,13 @@ mvn package exec:exec
## Test
By default, all endpoints are protected by OAuth jwt token verifier. It can be turned off with config change through for development.
By default, all endpoints are protected by the OAuth JWT token verifier. It can be turned off with a config change, when required.
In order to access the server, there is a long lived token below issued by my
oauth2 server [undertow-server-oauth2](https://github.com/networknt/undertow-server-oauth2)
OAuth2 server [undertow-server-oauth2](https://github.com/networknt/undertow-server-oauth2).
```
Bearer eyJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJ1cm46Y29tOm5ldHdvcmtudDpvYXV0aDI6djEiLCJhdWQiOiJ1cm46Y29tLm5ldHdvcmtudCIsImV4cCI6MTc4ODEzMjczNSwianRpIjoiNWtyM2ZWOHJaelBZNEJrSnNYZzFpQSIsImlhdCI6MTQ3Mjc3MjczNSwibmJmIjoxNDcyNzcyNjE1LCJ2ZXJzaW9uIjoiMS4wIiwidXNlcl9pZCI6InN0ZXZlIiwidXNlcl90eXBlIjoiRU1QTE9ZRUUiLCJjbGllbnRfaWQiOiJkZGNhZjBiYS0xMTMxLTIyMzItMzMxMy1kNmYyNzUzZjI1ZGMiLCJzY29wZSI6WyJhcGkuciIsImFwaS53Il19.gteJiy1uao8HLeWRljpZxHWUgQfofwmnFP-zv3EPUyXjyCOy3xclnfeTnTE39j8PgBwdFASPcDLLk1YfZJbsU6pLlmYXLtdpHDBsVmIRuch6LFPCVQ3JdqSQVci59OhSK0bBThGWqCD3UzDI_OnX4IVCAahcT9Bu94m5u_H_JNmwDf1XaP3Lt4I34buYMuRD9stchsnZi-tuIRkL13FARm1XA9aPZUMUXFdedBWDXo1zMREQ_qCJXOpaZDJM9Im0rIkq9wTEVU00pbRp_Vcdya3dfkFteBMHiwFVt6VNQaco5BXURDAIzXidwQxNEbX1ek03wra8AIani65ZK7fy_w
```
Add "Authorization" header with value as above token and a dummy message will return from the generated stub.

View File

@ -0,0 +1,604 @@
/*
* OpenAPI Petstore
*
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI document version: 1.0.0
*
*
* AUTO-GENERATED FILE, DO NOT MODIFY!
*/
package org.openapitools.handler;
import io.undertow.server.*;
import io.undertow.util.*;
import org.openapitools.model.*;
@SuppressWarnings("TooManyFunctions")
public interface PathHandlerInterface {
/**
* <p>Add a new pet to the store</p>
*
* <p><b>Endpoint</b>: {@link Methods#POST POST} "/v2/pet" (<i>privileged: true</i>)</p>
*
* <p><b>Request parameters</b>:</p>
* <ul>
* </ul>
*
* <p><b>Consumes</b>: [{mediaType=application/json}, {mediaType=application/xml}]</p>
* <p><b>Payload</b>: {@link Pet} (<i>required: true</i>)</p>
*
*
* <p><b>Responses</b>:</p>
* <ul>
* <li><b>405 (client error)</b>: Invalid input</li>
* </ul>
*/
@javax.annotation.Nonnull
HttpHandler addPet();
/**
* <p>Deletes a pet</p>
*
* <p><b>Endpoint</b>: {@link Methods#DELETE DELETE} "/v2/pet/{petId}" (<i>privileged: true</i>)</p>
*
* <p><b>Request parameters</b>:</p>
* <ul>
* <li>
* <p>"<b>petId</b>"
* <p>Pet id to delete</p>
* <p>
* - Parameter type: <b>{@link Long}</b><br/>
* - Appears in: <b>{@link HttpServerExchange#getPathParameters Path}</b><br/>
* - Required: <b>true</b>
* </p>
* </li>
* <li>
* <p>"<b>api_key</b>"
* <p>
* - Parameter type: <b>{@link String}</b><br/>
* - Appears in: <b>{@link Headers Header}</b><br/>
* - Required: <b>false</b>
* </p>
* </li>
* </ul>
*
*
* <p><b>Responses</b>:</p>
* <ul>
* <li><b>400 (client error)</b>: Invalid pet value</li>
* </ul>
*/
@javax.annotation.Nonnull
HttpHandler deletePet();
/**
* <p>Finds Pets by status</p>
*
* <p>Multiple status values can be provided with comma separated strings</p>
*
* <p><b>Endpoint</b>: {@link Methods#GET GET} "/v2/pet/findByStatus" (<i>privileged: true</i>)</p>
*
* <p><b>Request parameters</b>:</p>
* <ul>
* <li>
* <p>"<b>status</b>"
* <p>Status values that need to be considered for filter</p>
* <p>
* - Parameter type: <b>{@link java.util.List List} of {@link List&lt;String&gt;}</b><br/>
* - Appears in: <b>{@link HttpServerExchange#getQueryParameters Query}</b><br/>
* - Default value: <b>new ArrayList<String>()</b><br/>
* - Required: <b>true</b>
* </p>
* </li>
* </ul>
*
* <p><b>Produces</b>: [{mediaType=application/xml}, {mediaType=application/json}]</p>
* <p><b>Returns</b>: {@link java.util.List List} of {@link Pet}</p>
*
* <p><b>Responses</b>:</p>
* <ul>
* <li><b>200 (success)</b>: successful operation</li>
* <li><b>400 (client error)</b>: Invalid status value</li>
* </ul>
*/
@javax.annotation.Nonnull
HttpHandler findPetsByStatus();
/**
* <p>Finds Pets by tags</p>
*
* <p>Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.</p>
*
* <p><b>Endpoint</b>: {@link Methods#GET GET} "/v2/pet/findByTags" (<i>privileged: true</i>)</p>
*
* <p><b>Request parameters</b>:</p>
* <ul>
* <li>
* <p>"<b>tags</b>"
* <p>Tags to filter by</p>
* <p>
* - Parameter type: <b>{@link java.util.List List} of {@link List&lt;String&gt;}</b><br/>
* - Appears in: <b>{@link HttpServerExchange#getQueryParameters Query}</b><br/>
* - Default value: <b>new ArrayList<String>()</b><br/>
* - Required: <b>true</b>
* </p>
* </li>
* </ul>
*
* <p><b>Produces</b>: [{mediaType=application/xml}, {mediaType=application/json}]</p>
* <p><b>Returns</b>: {@link java.util.List List} of {@link Pet}</p>
*
* <p><b>Responses</b>:</p>
* <ul>
* <li><b>200 (success)</b>: successful operation</li>
* <li><b>400 (client error)</b>: Invalid tag value</li>
* </ul>
*/
@javax.annotation.Nonnull
@Deprecated
HttpHandler findPetsByTags();
/**
* <p>Find pet by ID</p>
*
* <p>Returns a single pet</p>
*
* <p><b>Endpoint</b>: {@link Methods#GET GET} "/v2/pet/{petId}" (<i>privileged: true</i>)</p>
*
* <p><b>Request parameters</b>:</p>
* <ul>
* <li>
* <p>"<b>petId</b>"
* <p>ID of pet to return</p>
* <p>
* - Parameter type: <b>{@link Long}</b><br/>
* - Appears in: <b>{@link HttpServerExchange#getPathParameters Path}</b><br/>
* - Required: <b>true</b>
* </p>
* </li>
* </ul>
*
* <p><b>Produces</b>: [{mediaType=application/xml}, {mediaType=application/json}]</p>
* <p><b>Returns</b>: {@link Pet}</p>
*
* <p><b>Responses</b>:</p>
* <ul>
* <li><b>200 (success)</b>: successful operation</li>
* <li><b>400 (client error)</b>: Invalid ID supplied</li>
* <li><b>404 (client error)</b>: Pet not found</li>
* </ul>
*/
@javax.annotation.Nonnull
HttpHandler getPetById();
/**
* <p>Update an existing pet</p>
*
* <p><b>Endpoint</b>: {@link Methods#PUT PUT} "/v2/pet" (<i>privileged: true</i>)</p>
*
* <p><b>Request parameters</b>:</p>
* <ul>
* </ul>
*
* <p><b>Consumes</b>: [{mediaType=application/json}, {mediaType=application/xml}]</p>
* <p><b>Payload</b>: {@link Pet} (<i>required: true</i>)</p>
*
*
* <p><b>Responses</b>:</p>
* <ul>
* <li><b>400 (client error)</b>: Invalid ID supplied</li>
* <li><b>404 (client error)</b>: Pet not found</li>
* <li><b>405 (client error)</b>: Validation exception</li>
* </ul>
*/
@javax.annotation.Nonnull
HttpHandler updatePet();
/**
* <p>Updates a pet in the store with form data</p>
*
* <p><b>Endpoint</b>: {@link Methods#POST POST} "/v2/pet/{petId}" (<i>privileged: true</i>)</p>
*
* <p><b>Request parameters</b>:</p>
* <ul>
* <li>
* <p>"<b>petId</b>"
* <p>ID of pet that needs to be updated</p>
* <p>
* - Parameter type: <b>{@link Long}</b><br/>
* - Appears in: <b>{@link HttpServerExchange#getPathParameters Path}</b><br/>
* - Required: <b>true</b>
* </p>
* </li>
* <li>
* <p>"<b>name</b>"
* <p>Updated name of the pet</p>
* <p>
* - Parameter type: <b>{@link String}</b><br/>
* - Appears in: <b>{@link io.undertow.server.handlers.form.FormDataParser Form}</b><br/>
* - Required: <b>false</b>
* </p>
* </li>
* <li>
* <p>"<b>status</b>"
* <p>Updated status of the pet</p>
* <p>
* - Parameter type: <b>{@link String}</b><br/>
* - Appears in: <b>{@link io.undertow.server.handlers.form.FormDataParser Form}</b><br/>
* - Required: <b>false</b>
* </p>
* </li>
* </ul>
*
* <p><b>Consumes</b>: [{mediaType=application/x-www-form-urlencoded}]</p>
*
*
* <p><b>Responses</b>:</p>
* <ul>
* <li><b>405 (client error)</b>: Invalid input</li>
* </ul>
*/
@javax.annotation.Nonnull
HttpHandler updatePetWithForm();
/**
* <p>uploads an image</p>
*
* <p><b>Endpoint</b>: {@link Methods#POST POST} "/v2/pet/{petId}/uploadImage" (<i>privileged: true</i>)</p>
*
* <p><b>Request parameters</b>:</p>
* <ul>
* <li>
* <p>"<b>petId</b>"
* <p>ID of pet to update</p>
* <p>
* - Parameter type: <b>{@link Long}</b><br/>
* - Appears in: <b>{@link HttpServerExchange#getPathParameters Path}</b><br/>
* - Required: <b>true</b>
* </p>
* </li>
* <li>
* <p>"<b>additionalMetadata</b>"
* <p>Additional data to pass to server</p>
* <p>
* - Parameter type: <b>{@link String}</b><br/>
* - Appears in: <b>{@link io.undertow.server.handlers.form.FormDataParser Form}</b><br/>
* - Required: <b>false</b>
* </p>
* </li>
* <li>
* <p>"<b>file</b>"
* <p>file to upload</p>
* <p>
* - Parameter type: <b>BinaryFile</b><br/>
* - Appears in: <b>{@link io.undertow.server.handlers.form.FormDataParser Form}</b><br/>
* - Required: <b>false</b>
* </p>
* </li>
* </ul>
*
* <p><b>Consumes</b>: [{mediaType=multipart/form-data}]</p>
*
* <p><b>Produces</b>: [{mediaType=application/json}]</p>
* <p><b>Returns</b>: {@link ModelApiResponse}</p>
*
* <p><b>Responses</b>:</p>
* <ul>
* <li><b>200 (success)</b>: successful operation</li>
* </ul>
*/
@javax.annotation.Nonnull
HttpHandler uploadFile();
/**
* <p>Delete purchase order by ID</p>
*
* <p>For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors</p>
*
* <p><b>Endpoint</b>: {@link Methods#DELETE DELETE} "/v2/store/order/{orderId}" (<i>privileged: false</i>)</p>
*
* <p><b>Request parameters</b>:</p>
* <ul>
* <li>
* <p>"<b>orderId</b>"
* <p>ID of the order that needs to be deleted</p>
* <p>
* - Parameter type: <b>{@link String}</b><br/>
* - Appears in: <b>{@link HttpServerExchange#getPathParameters Path}</b><br/>
* - Required: <b>true</b>
* </p>
* </li>
* </ul>
*
*
* <p><b>Responses</b>:</p>
* <ul>
* <li><b>400 (client error)</b>: Invalid ID supplied</li>
* <li><b>404 (client error)</b>: Order not found</li>
* </ul>
*/
@javax.annotation.Nonnull
HttpHandler deleteOrder();
/**
* <p>Returns pet inventories by status</p>
*
* <p>Returns a map of status codes to quantities</p>
*
* <p><b>Endpoint</b>: {@link Methods#GET GET} "/v2/store/inventory" (<i>privileged: true</i>)</p>
*
* <p><b>Produces</b>: [{mediaType=application/json}]</p>
* <p><b>Returns</b>: {@link java.util.Map Map} of {@link Integer}</p>
*
* <p><b>Responses</b>:</p>
* <ul>
* <li><b>200 (success)</b>: successful operation</li>
* </ul>
*/
@javax.annotation.Nonnull
HttpHandler getInventory();
/**
* <p>Find purchase order by ID</p>
*
* <p>For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions</p>
*
* <p><b>Endpoint</b>: {@link Methods#GET GET} "/v2/store/order/{orderId}" (<i>privileged: false</i>)</p>
*
* <p><b>Request parameters</b>:</p>
* <ul>
* <li>
* <p>"<b>orderId</b>"
* <p>ID of pet that needs to be fetched</p>
* <p>
* - Parameter type: <b>{@link Long}</b><br/>
* - Appears in: <b>{@link HttpServerExchange#getPathParameters Path}</b><br/>
* - Required: <b>true</b>
* </p>
* </li>
* </ul>
*
* <p><b>Produces</b>: [{mediaType=application/xml}, {mediaType=application/json}]</p>
* <p><b>Returns</b>: {@link Order}</p>
*
* <p><b>Responses</b>:</p>
* <ul>
* <li><b>200 (success)</b>: successful operation</li>
* <li><b>400 (client error)</b>: Invalid ID supplied</li>
* <li><b>404 (client error)</b>: Order not found</li>
* </ul>
*/
@javax.annotation.Nonnull
HttpHandler getOrderById();
/**
* <p>Place an order for a pet</p>
*
* <p><b>Endpoint</b>: {@link Methods#POST POST} "/v2/store/order" (<i>privileged: false</i>)</p>
*
* <p><b>Request parameters</b>:</p>
* <ul>
* </ul>
*
* <p><b>Produces</b>: [{mediaType=application/xml}, {mediaType=application/json}]</p>
* <p><b>Returns</b>: {@link Order}</p>
*
* <p><b>Responses</b>:</p>
* <ul>
* <li><b>200 (success)</b>: successful operation</li>
* <li><b>400 (client error)</b>: Invalid Order</li>
* </ul>
*/
@javax.annotation.Nonnull
HttpHandler placeOrder();
/**
* <p>Create user</p>
*
* <p>This can only be done by the logged in user.</p>
*
* <p><b>Endpoint</b>: {@link Methods#POST POST} "/v2/user" (<i>privileged: false</i>)</p>
*
* <p><b>Request parameters</b>:</p>
* <ul>
* </ul>
*
*
* <p><b>Responses</b>:</p>
* <ul>
* <li><b>Default</b>: successful operation</li>
* </ul>
*/
@javax.annotation.Nonnull
HttpHandler createUser();
/**
* <p>Creates list of users with given input array</p>
*
* <p><b>Endpoint</b>: {@link Methods#POST POST} "/v2/user/createWithArray" (<i>privileged: false</i>)</p>
*
* <p><b>Request parameters</b>:</p>
* <ul>
* </ul>
*
*
* <p><b>Responses</b>:</p>
* <ul>
* <li><b>Default</b>: successful operation</li>
* </ul>
*/
@javax.annotation.Nonnull
HttpHandler createUsersWithArrayInput();
/**
* <p>Creates list of users with given input array</p>
*
* <p><b>Endpoint</b>: {@link Methods#POST POST} "/v2/user/createWithList" (<i>privileged: false</i>)</p>
*
* <p><b>Request parameters</b>:</p>
* <ul>
* </ul>
*
*
* <p><b>Responses</b>:</p>
* <ul>
* <li><b>Default</b>: successful operation</li>
* </ul>
*/
@javax.annotation.Nonnull
HttpHandler createUsersWithListInput();
/**
* <p>Delete user</p>
*
* <p>This can only be done by the logged in user.</p>
*
* <p><b>Endpoint</b>: {@link Methods#DELETE DELETE} "/v2/user/{username}" (<i>privileged: false</i>)</p>
*
* <p><b>Request parameters</b>:</p>
* <ul>
* <li>
* <p>"<b>username</b>"
* <p>The name that needs to be deleted</p>
* <p>
* - Parameter type: <b>{@link String}</b><br/>
* - Appears in: <b>{@link HttpServerExchange#getPathParameters Path}</b><br/>
* - Required: <b>true</b>
* </p>
* </li>
* </ul>
*
*
* <p><b>Responses</b>:</p>
* <ul>
* <li><b>400 (client error)</b>: Invalid username supplied</li>
* <li><b>404 (client error)</b>: User not found</li>
* </ul>
*/
@javax.annotation.Nonnull
HttpHandler deleteUser();
/**
* <p>Get user by user name</p>
*
* <p><b>Endpoint</b>: {@link Methods#GET GET} "/v2/user/{username}" (<i>privileged: false</i>)</p>
*
* <p><b>Request parameters</b>:</p>
* <ul>
* <li>
* <p>"<b>username</b>"
* <p>The name that needs to be fetched. Use user1 for testing.</p>
* <p>
* - Parameter type: <b>{@link String}</b><br/>
* - Appears in: <b>{@link HttpServerExchange#getPathParameters Path}</b><br/>
* - Required: <b>true</b>
* </p>
* </li>
* </ul>
*
* <p><b>Produces</b>: [{mediaType=application/xml}, {mediaType=application/json}]</p>
* <p><b>Returns</b>: {@link User}</p>
*
* <p><b>Responses</b>:</p>
* <ul>
* <li><b>200 (success)</b>: successful operation</li>
* <li><b>400 (client error)</b>: Invalid username supplied</li>
* <li><b>404 (client error)</b>: User not found</li>
* </ul>
*/
@javax.annotation.Nonnull
HttpHandler getUserByName();
/**
* <p>Logs user into the system</p>
*
* <p><b>Endpoint</b>: {@link Methods#GET GET} "/v2/user/login" (<i>privileged: false</i>)</p>
*
* <p><b>Request parameters</b>:</p>
* <ul>
* <li>
* <p>"<b>username</b>"
* <p>The user name for login</p>
* <p>
* - Parameter type: <b>{@link String}</b><br/>
* - Appears in: <b>{@link HttpServerExchange#getQueryParameters Query}</b><br/>
* - Required: <b>true</b>
* </p>
* </li>
* <li>
* <p>"<b>password</b>"
* <p>The password for login in clear text</p>
* <p>
* - Parameter type: <b>{@link String}</b><br/>
* - Appears in: <b>{@link HttpServerExchange#getQueryParameters Query}</b><br/>
* - Required: <b>true</b>
* </p>
* </li>
* </ul>
* <p><b>Response headers</b>: [CodegenProperty{openApiType='integer', baseName='X-Rate-Limit', complexType='null', getter='getxRateLimit', setter='setxRateLimit', description='calls per hour allowed by the user', dataType='Integer', datatypeWithEnum='Integer', dataFormat='int32', name='xRateLimit', min='null', max='null', defaultValue='null', defaultValueWithParam=' = data.X-Rate-Limit;', baseType='Integer', containerType='null', title='null', unescapedDescription='calls per hour allowed by the user', maxLength=null, minLength=null, pattern='null', example='null', jsonSchema='{
"type" : "integer",
"format" : "int32"
}', minimum='null', maximum='null', exclusiveMinimum=false, exclusiveMaximum=false, required=false, deprecated=false, hasMoreNonReadOnly=false, isPrimitiveType=true, isModel=false, isContainer=false, isString=false, isNumeric=true, isInteger=true, isLong=false, isNumber=false, isFloat=false, isDouble=false, isDecimal=false, isByteArray=false, isBinary=false, isFile=false, isBoolean=false, isDate=false, isDateTime=false, isUuid=false, isUri=false, isEmail=false, isFreeFormObject=false, isArray=false, isMap=false, isEnum=false, isReadOnly=false, isWriteOnly=false, isNullable=false, isSelfReference=false, isCircularReference=false, isDiscriminator=false, _enum=null, allowableValues=null, items=null, additionalProperties=null, vars=[], requiredVars=[], mostInnerItems=null, vendorExtensions={}, hasValidation=false, isInherited=false, discriminatorValue='null', nameInCamelCase='XRateLimit', nameInSnakeCase='X_RATE_LIMIT', enumName='null', maxItems=null, minItems=null, maxProperties=null, minProperties=null, uniqueItems=false, multipleOf=null, isXmlAttribute=false, xmlPrefix='null', xmlName='null', xmlNamespace='null', isXmlWrapped=false, isNull=false}, CodegenProperty{openApiType='string', baseName='X-Expires-After', complexType='Date', getter='getxExpiresAfter', setter='setxExpiresAfter', description='date in UTC when toekn expires', dataType='Date', datatypeWithEnum='Date', dataFormat='date-time', name='xExpiresAfter', min='null', max='null', defaultValue='null', defaultValueWithParam=' = data.X-Expires-After;', baseType='Date', containerType='null', title='null', unescapedDescription='date in UTC when toekn expires', maxLength=null, minLength=null, pattern='null', example='null', jsonSchema='{
"type" : "string",
"format" : "date-time"
}', minimum='null', maximum='null', exclusiveMinimum=false, exclusiveMaximum=false, required=false, deprecated=false, hasMoreNonReadOnly=false, isPrimitiveType=false, isModel=false, isContainer=false, isString=false, isNumeric=false, isInteger=false, isLong=false, isNumber=false, isFloat=false, isDouble=false, isDecimal=false, isByteArray=false, isBinary=false, isFile=false, isBoolean=false, isDate=false, isDateTime=true, isUuid=false, isUri=false, isEmail=false, isFreeFormObject=false, isArray=false, isMap=false, isEnum=false, isReadOnly=false, isWriteOnly=false, isNullable=false, isSelfReference=false, isCircularReference=false, isDiscriminator=false, _enum=null, allowableValues=null, items=null, additionalProperties=null, vars=[], requiredVars=[], mostInnerItems=null, vendorExtensions={}, hasValidation=false, isInherited=false, discriminatorValue='null', nameInCamelCase='XExpiresAfter', nameInSnakeCase='X_EXPIRES_AFTER', enumName='null', maxItems=null, minItems=null, maxProperties=null, minProperties=null, uniqueItems=false, multipleOf=null, isXmlAttribute=false, xmlPrefix='null', xmlName='null', xmlNamespace='null', isXmlWrapped=false, isNull=false}]</p>
*
* <p><b>Produces</b>: [{mediaType=application/xml}, {mediaType=application/json}]</p>
* <p><b>Returns</b>: {@link String}</p>
*
* <p><b>Responses</b>:</p>
* <ul>
* <li><b>200 (success)</b>: successful operation</li>
* <li><b>400 (client error)</b>: Invalid username/password supplied</li>
* </ul>
*/
@javax.annotation.Nonnull
HttpHandler loginUser();
/**
* <p>Logs out current logged in user session</p>
*
* <p><b>Endpoint</b>: {@link Methods#GET GET} "/v2/user/logout" (<i>privileged: false</i>)</p>
*
*
* <p><b>Responses</b>:</p>
* <ul>
* <li><b>Default</b>: successful operation</li>
* </ul>
*/
@javax.annotation.Nonnull
HttpHandler logoutUser();
/**
* <p>Updated user</p>
*
* <p>This can only be done by the logged in user.</p>
*
* <p><b>Endpoint</b>: {@link Methods#PUT PUT} "/v2/user/{username}" (<i>privileged: false</i>)</p>
*
* <p><b>Request parameters</b>:</p>
* <ul>
* <li>
* <p>"<b>username</b>"
* <p>name that need to be deleted</p>
* <p>
* - Parameter type: <b>{@link String}</b><br/>
* - Appears in: <b>{@link HttpServerExchange#getPathParameters Path}</b><br/>
* - Required: <b>true</b>
* </p>
* </li>
* </ul>
*
*
* <p><b>Responses</b>:</p>
* <ul>
* <li><b>400 (client error)</b>: Invalid user supplied</li>
* <li><b>404 (client error)</b>: User not found</li>
* </ul>
*/
@javax.annotation.Nonnull
HttpHandler updateUser();
}

View File

@ -1,159 +1,287 @@
/*
* OpenAPI Petstore
*
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI document version: 1.0.0
*
*
* AUTO-GENERATED FILE, DO NOT MODIFY!
*/
package org.openapitools.handler;
import com.networknt.config.Config;
import com.networknt.server.HandlerProvider;
import io.undertow.Handlers;
import io.undertow.server.HttpHandler;
import io.undertow.server.HttpServerExchange;
import io.undertow.server.RoutingHandler;
import io.undertow.server.handlers.PathHandler;
import io.undertow.util.Methods;
public class PathHandlerProvider implements HandlerProvider {
/**
* The default implementation for {@link HandlerProvider} and {@link PathHandlerInterface}.
*
* <p>There are two flavors of {@link HttpHandler}s to choose from, depending on your needs:</p>
*
* <ul>
* <li>
* <b>Stateless</b>: if a specific endpoint is called more than once from multiple sessions,
* its state is not retained a different {@link HttpHandler} is instantiated for every new
* session. This is the default behavior.
* </li>
* <li>
* <b>Stateful</b>: if a specific endpoint is called more than once from multiple sessions,
* its state is retained properly. For example, if you want to keep a class property that counts
* the number of requests or the last time a request was received.
* </li>
* </ul>
* <p>Note: <b>Stateful</b> flavor is more performant than <b>Stateless</b>.</p>
*/
@SuppressWarnings("TooManyFunctions")
abstract public class PathHandlerProvider implements HandlerProvider, PathHandlerInterface {
/**
* Returns the default base path to access this server.
*/
@javax.annotation.Nonnull
public String getBasePath() {
return "/v2";
}
/**
* Returns a stateless {@link HttpHandler} that configures all endpoints in this server.
*
* <p>Endpoints bound in this method do NOT start with "/v2", and
* it's your responsibility to configure a {@link PathHandler} with a prefix path
* by calling {@link PathHandler#addPrefixPath} like so:</p>
*
* <code>pathHandler.addPrefixPath("/v2", handler)</code>
*
* <p>Note: the endpoints bound to the returned {@link HttpHandler} are stateless and won't
* retain any state between multiple sessions.</p>
*
* @return an {@link HttpHandler} of type {@link RoutingHandler}
*/
@javax.annotation.Nonnull
@Override
public HttpHandler getHandler() {
HttpHandler handler = Handlers.routing()
return getHandler(false);
}
/**
* Returns a stateless {@link HttpHandler} that configures all endpoints in this server.
*
* <p>Note: the endpoints bound to the returned {@link HttpHandler} are stateless and won't
* retain any state between multiple sessions.</p>
*
* @param withBasePath if true, all endpoints would start with "/v2"
* @return an {@link HttpHandler} of type {@link RoutingHandler}
*/
@javax.annotation.Nonnull
public HttpHandler getHandler(final boolean withBasePath) {
return getHandler(withBasePath ? getBasePath() : "");
}
.add(Methods.POST, "/v2/pet", new HttpHandler() {
/**
* Returns a stateless {@link HttpHandler} that configures all endpoints in this server.
*
* <p>Note: the endpoints bound to the returned {@link HttpHandler} are stateless and won't
* retain any state between multiple sessions.</p>
*
* @param basePath base path to set for all endpoints
* @return an {@link HttpHandler} of type {@link RoutingHandler}
*/
@SuppressWarnings("Convert2Lambda")
@javax.annotation.Nonnull
public HttpHandler getHandler(final String basePath) {
return Handlers.routing()
.add(Methods.POST, basePath + "/pet", new HttpHandler() {
@Override
public void handleRequest(HttpServerExchange exchange) throws Exception {
exchange.getResponseSender().send("addPet");
addPet().handleRequest(exchange);
}
})
.add(Methods.DELETE, "/v2/pet/{petId}", new HttpHandler() {
.add(Methods.DELETE, basePath + "/pet/{petId}", new HttpHandler() {
@Override
public void handleRequest(HttpServerExchange exchange) throws Exception {
exchange.getResponseSender().send("deletePet");
deletePet().handleRequest(exchange);
}
})
.add(Methods.GET, "/v2/pet/findByStatus", new HttpHandler() {
.add(Methods.GET, basePath + "/pet/findByStatus", new HttpHandler() {
@Override
public void handleRequest(HttpServerExchange exchange) throws Exception {
exchange.getResponseSender().send("findPetsByStatus");
findPetsByStatus().handleRequest(exchange);
}
})
.add(Methods.GET, "/v2/pet/findByTags", new HttpHandler() {
.add(Methods.GET, basePath + "/pet/findByTags", new HttpHandler() {
@Override
public void handleRequest(HttpServerExchange exchange) throws Exception {
exchange.getResponseSender().send("findPetsByTags");
findPetsByTags().handleRequest(exchange);
}
})
.add(Methods.GET, "/v2/pet/{petId}", new HttpHandler() {
.add(Methods.GET, basePath + "/pet/{petId}", new HttpHandler() {
@Override
public void handleRequest(HttpServerExchange exchange) throws Exception {
exchange.getResponseSender().send("getPetById");
getPetById().handleRequest(exchange);
}
})
.add(Methods.PUT, "/v2/pet", new HttpHandler() {
.add(Methods.PUT, basePath + "/pet", new HttpHandler() {
@Override
public void handleRequest(HttpServerExchange exchange) throws Exception {
exchange.getResponseSender().send("updatePet");
updatePet().handleRequest(exchange);
}
})
.add(Methods.POST, "/v2/pet/{petId}", new HttpHandler() {
.add(Methods.POST, basePath + "/pet/{petId}", new HttpHandler() {
@Override
public void handleRequest(HttpServerExchange exchange) throws Exception {
exchange.getResponseSender().send("updatePetWithForm");
updatePetWithForm().handleRequest(exchange);
}
})
.add(Methods.POST, "/v2/pet/{petId}/uploadImage", new HttpHandler() {
.add(Methods.POST, basePath + "/pet/{petId}/uploadImage", new HttpHandler() {
@Override
public void handleRequest(HttpServerExchange exchange) throws Exception {
exchange.getResponseSender().send("uploadFile");
uploadFile().handleRequest(exchange);
}
})
.add(Methods.DELETE, "/v2/store/order/{orderId}", new HttpHandler() {
.add(Methods.DELETE, basePath + "/store/order/{orderId}", new HttpHandler() {
@Override
public void handleRequest(HttpServerExchange exchange) throws Exception {
exchange.getResponseSender().send("deleteOrder");
deleteOrder().handleRequest(exchange);
}
})
.add(Methods.GET, "/v2/store/inventory", new HttpHandler() {
.add(Methods.GET, basePath + "/store/inventory", new HttpHandler() {
@Override
public void handleRequest(HttpServerExchange exchange) throws Exception {
exchange.getResponseSender().send("getInventory");
getInventory().handleRequest(exchange);
}
})
.add(Methods.GET, "/v2/store/order/{orderId}", new HttpHandler() {
.add(Methods.GET, basePath + "/store/order/{orderId}", new HttpHandler() {
@Override
public void handleRequest(HttpServerExchange exchange) throws Exception {
exchange.getResponseSender().send("getOrderById");
getOrderById().handleRequest(exchange);
}
})
.add(Methods.POST, "/v2/store/order", new HttpHandler() {
.add(Methods.POST, basePath + "/store/order", new HttpHandler() {
@Override
public void handleRequest(HttpServerExchange exchange) throws Exception {
exchange.getResponseSender().send("placeOrder");
placeOrder().handleRequest(exchange);
}
})
.add(Methods.POST, "/v2/user", new HttpHandler() {
.add(Methods.POST, basePath + "/user", new HttpHandler() {
@Override
public void handleRequest(HttpServerExchange exchange) throws Exception {
exchange.getResponseSender().send("createUser");
createUser().handleRequest(exchange);
}
})
.add(Methods.POST, "/v2/user/createWithArray", new HttpHandler() {
.add(Methods.POST, basePath + "/user/createWithArray", new HttpHandler() {
@Override
public void handleRequest(HttpServerExchange exchange) throws Exception {
exchange.getResponseSender().send("createUsersWithArrayInput");
createUsersWithArrayInput().handleRequest(exchange);
}
})
.add(Methods.POST, "/v2/user/createWithList", new HttpHandler() {
.add(Methods.POST, basePath + "/user/createWithList", new HttpHandler() {
@Override
public void handleRequest(HttpServerExchange exchange) throws Exception {
exchange.getResponseSender().send("createUsersWithListInput");
createUsersWithListInput().handleRequest(exchange);
}
})
.add(Methods.DELETE, "/v2/user/{username}", new HttpHandler() {
.add(Methods.DELETE, basePath + "/user/{username}", new HttpHandler() {
@Override
public void handleRequest(HttpServerExchange exchange) throws Exception {
exchange.getResponseSender().send("deleteUser");
deleteUser().handleRequest(exchange);
}
})
.add(Methods.GET, "/v2/user/{username}", new HttpHandler() {
.add(Methods.GET, basePath + "/user/{username}", new HttpHandler() {
@Override
public void handleRequest(HttpServerExchange exchange) throws Exception {
exchange.getResponseSender().send("getUserByName");
getUserByName().handleRequest(exchange);
}
})
.add(Methods.GET, "/v2/user/login", new HttpHandler() {
.add(Methods.GET, basePath + "/user/login", new HttpHandler() {
@Override
public void handleRequest(HttpServerExchange exchange) throws Exception {
exchange.getResponseSender().send("loginUser");
loginUser().handleRequest(exchange);
}
})
.add(Methods.GET, "/v2/user/logout", new HttpHandler() {
.add(Methods.GET, basePath + "/user/logout", new HttpHandler() {
@Override
public void handleRequest(HttpServerExchange exchange) throws Exception {
exchange.getResponseSender().send("logoutUser");
logoutUser().handleRequest(exchange);
}
})
.add(Methods.PUT, "/v2/user/{username}", new HttpHandler() {
.add(Methods.PUT, basePath + "/user/{username}", new HttpHandler() {
@Override
public void handleRequest(HttpServerExchange exchange) throws Exception {
exchange.getResponseSender().send("updateUser");
updateUser().handleRequest(exchange);
}
})
;
return handler;
}
}
/**
* Returns a stateful {@link HttpHandler} that configures all endpoints in this server.
*
* <p>Endpoints bound in this method do NOT start with "/v2", and
* it's your responsibility to configure a {@link PathHandler} with a prefix path
* by calling {@link PathHandler#addPrefixPath} like so:</p>
*
* <code>pathHandler.addPrefixPath("/v2", handler)</code>
*
* <p>Note: the endpoints bound to the returned {@link HttpHandler} are stateful and will
* retain any state between multiple sessions.</p>
*
* @return an {@link HttpHandler} of type {@link RoutingHandler}
*/
@javax.annotation.Nonnull
public HttpHandler getStatefulHandler() {
return getStatefulHandler(false);
}
/**
* Returns a stateful {@link HttpHandler} that configures all endpoints in this server.
*
* <p>Note: the endpoints bound to the returned {@link HttpHandler} are stateful and will
* retain any state between multiple sessions.</p>
*
* @param withBasePath if true, all endpoints would start with "/v2"
* @return an {@link HttpHandler} of type {@link RoutingHandler}
*/
@javax.annotation.Nonnull
public HttpHandler getStatefulHandler(final boolean withBasePath) {
return getStatefulHandler(withBasePath ? getBasePath() : "");
}
/**
* Returns a stateful {@link HttpHandler} that configures all endpoints in this server.
*
* <p>Note: the endpoints bound to the returned {@link HttpHandler} are stateful and will
* retain any state between multiple sessions.</p>
*
* @param basePath base path to set for all endpoints
* @return an {@link HttpHandler} of type {@link RoutingHandler}
*/
@javax.annotation.Nonnull
public HttpHandler getStatefulHandler(final String basePath) {
return Handlers.routing()
.add(Methods.POST, basePath + "/pet", addPet())
.add(Methods.DELETE, basePath + "/pet/{petId}", deletePet())
.add(Methods.GET, basePath + "/pet/findByStatus", findPetsByStatus())
.add(Methods.GET, basePath + "/pet/findByTags", findPetsByTags())
.add(Methods.GET, basePath + "/pet/{petId}", getPetById())
.add(Methods.PUT, basePath + "/pet", updatePet())
.add(Methods.POST, basePath + "/pet/{petId}", updatePetWithForm())
.add(Methods.POST, basePath + "/pet/{petId}/uploadImage", uploadFile())
.add(Methods.DELETE, basePath + "/store/order/{orderId}", deleteOrder())
.add(Methods.GET, basePath + "/store/inventory", getInventory())
.add(Methods.GET, basePath + "/store/order/{orderId}", getOrderById())
.add(Methods.POST, basePath + "/store/order", placeOrder())
.add(Methods.POST, basePath + "/user", createUser())
.add(Methods.POST, basePath + "/user/createWithArray", createUsersWithArrayInput())
.add(Methods.POST, basePath + "/user/createWithList", createUsersWithListInput())
.add(Methods.DELETE, basePath + "/user/{username}", deleteUser())
.add(Methods.GET, basePath + "/user/{username}", getUserByName())
.add(Methods.GET, basePath + "/user/login", loginUser())
.add(Methods.GET, basePath + "/user/logout", logoutUser())
.add(Methods.PUT, basePath + "/user/{username}", updateUser())
;
}
}

View File

@ -1,3 +1,13 @@
/*
* OpenAPI Petstore
*
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI document version: 1.0.0
*
*
* AUTO-GENERATED FILE, DO NOT MODIFY!
*/
package org.openapitools.model;
import java.util.Objects;
@ -10,7 +20,7 @@ import io.swagger.annotations.ApiModelProperty;
/**
* A category for a pet
**/
*/
@ApiModel(description = "A category for a pet")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaUndertowServerCodegen")
@ -20,7 +30,7 @@ public class Category {
private String name;
/**
**/
*/
public Category id(Long id) {
this.id = id;
return this;
@ -37,7 +47,7 @@ public class Category {
}
/**
**/
*/
public Category name(String name) {
this.name = name;
return this;

View File

@ -1,3 +1,13 @@
/*
* OpenAPI Petstore
*
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI document version: 1.0.0
*
*
* AUTO-GENERATED FILE, DO NOT MODIFY!
*/
package org.openapitools.model;
import java.util.Objects;
@ -10,7 +20,7 @@ import io.swagger.annotations.ApiModelProperty;
/**
* Describes the result of uploading an image resource
**/
*/
@ApiModel(description = "Describes the result of uploading an image resource")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaUndertowServerCodegen")
@ -21,7 +31,7 @@ public class ModelApiResponse {
private String message;
/**
**/
*/
public ModelApiResponse code(Integer code) {
this.code = code;
return this;
@ -38,7 +48,7 @@ public class ModelApiResponse {
}
/**
**/
*/
public ModelApiResponse type(String type) {
this.type = type;
return this;
@ -55,7 +65,7 @@ public class ModelApiResponse {
}
/**
**/
*/
public ModelApiResponse message(String message) {
this.message = message;
return this;

View File

@ -1,3 +1,13 @@
/*
* OpenAPI Petstore
*
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI document version: 1.0.0
*
*
* AUTO-GENERATED FILE, DO NOT MODIFY!
*/
package org.openapitools.model;
import java.util.Objects;
@ -12,7 +22,7 @@ import java.util.Date;
/**
* An order for a pets from the pet store
**/
*/
@ApiModel(description = "An order for a pets from the pet store")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaUndertowServerCodegen")
@ -46,7 +56,7 @@ public class Order {
private Boolean complete = false;
/**
**/
*/
public Order id(Long id) {
this.id = id;
return this;
@ -63,7 +73,7 @@ public class Order {
}
/**
**/
*/
public Order petId(Long petId) {
this.petId = petId;
return this;
@ -80,7 +90,7 @@ public class Order {
}
/**
**/
*/
public Order quantity(Integer quantity) {
this.quantity = quantity;
return this;
@ -97,7 +107,7 @@ public class Order {
}
/**
**/
*/
public Order shipDate(Date shipDate) {
this.shipDate = shipDate;
return this;
@ -115,7 +125,7 @@ public class Order {
/**
* Order Status
**/
*/
public Order status(StatusEnum status) {
this.status = status;
return this;
@ -132,7 +142,7 @@ public class Order {
}
/**
**/
*/
public Order complete(Boolean complete) {
this.complete = complete;
return this;

View File

@ -1,3 +1,13 @@
/*
* OpenAPI Petstore
*
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI document version: 1.0.0
*
*
* AUTO-GENERATED FILE, DO NOT MODIFY!
*/
package org.openapitools.model;
import java.util.Objects;
@ -15,7 +25,7 @@ import org.openapitools.model.Tag;
/**
* A pet for sale in the pet store
**/
*/
@ApiModel(description = "A pet for sale in the pet store")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaUndertowServerCodegen")
@ -49,7 +59,7 @@ public class Pet {
private StatusEnum status;
/**
**/
*/
public Pet id(Long id) {
this.id = id;
return this;
@ -66,7 +76,7 @@ public class Pet {
}
/**
**/
*/
public Pet category(Category category) {
this.category = category;
return this;
@ -83,7 +93,7 @@ public class Pet {
}
/**
**/
*/
public Pet name(String name) {
this.name = name;
return this;
@ -100,7 +110,7 @@ public class Pet {
}
/**
**/
*/
public Pet photoUrls(List<String> photoUrls) {
this.photoUrls = photoUrls;
return this;
@ -117,7 +127,7 @@ public class Pet {
}
/**
**/
*/
public Pet tags(List<Tag> tags) {
this.tags = tags;
return this;
@ -135,7 +145,7 @@ public class Pet {
/**
* pet status in the store
**/
*/
public Pet status(StatusEnum status) {
this.status = status;
return this;

View File

@ -1,3 +1,13 @@
/*
* OpenAPI Petstore
*
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI document version: 1.0.0
*
*
* AUTO-GENERATED FILE, DO NOT MODIFY!
*/
package org.openapitools.model;
import java.util.Objects;
@ -10,7 +20,7 @@ import io.swagger.annotations.ApiModelProperty;
/**
* A tag for a pet
**/
*/
@ApiModel(description = "A tag for a pet")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaUndertowServerCodegen")
@ -20,7 +30,7 @@ public class Tag {
private String name;
/**
**/
*/
public Tag id(Long id) {
this.id = id;
return this;
@ -37,7 +47,7 @@ public class Tag {
}
/**
**/
*/
public Tag name(String name) {
this.name = name;
return this;

View File

@ -1,3 +1,13 @@
/*
* OpenAPI Petstore
*
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI document version: 1.0.0
*
*
* AUTO-GENERATED FILE, DO NOT MODIFY!
*/
package org.openapitools.model;
import java.util.Objects;
@ -10,7 +20,7 @@ import io.swagger.annotations.ApiModelProperty;
/**
* A User who is purchasing from the pet store
**/
*/
@ApiModel(description = "A User who is purchasing from the pet store")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaUndertowServerCodegen")
@ -26,7 +36,7 @@ public class User {
private Integer userStatus;
/**
**/
*/
public User id(Long id) {
this.id = id;
return this;
@ -43,7 +53,7 @@ public class User {
}
/**
**/
*/
public User username(String username) {
this.username = username;
return this;
@ -60,7 +70,7 @@ public class User {
}
/**
**/
*/
public User firstName(String firstName) {
this.firstName = firstName;
return this;
@ -77,7 +87,7 @@ public class User {
}
/**
**/
*/
public User lastName(String lastName) {
this.lastName = lastName;
return this;
@ -94,7 +104,7 @@ public class User {
}
/**
**/
*/
public User email(String email) {
this.email = email;
return this;
@ -111,7 +121,7 @@ public class User {
}
/**
**/
*/
public User password(String password) {
this.password = password;
return this;
@ -128,7 +138,7 @@ public class User {
}
/**
**/
*/
public User phone(String phone) {
this.phone = phone;
return this;
@ -146,7 +156,7 @@ public class User {
/**
* User Status
**/
*/
public User userStatus(Integer userStatus) {
this.userStatus = userStatus;
return this;

View File

@ -1037,5 +1037,6 @@
"type" : "apiKey"
}
}
}
},
"x-original-swagger-version" : "2.0"
}