forked from loafle/openapi-generator-original
Change generated MP server return type from Response
to the document-indicated type (#72)
Signed-off-by: tim.quinn@oracle.com <tim.quinn@oracle.com> Signed-off-by: tim.quinn@oracle.com <tim.quinn@oracle.com>
This commit is contained in:
parent
700f01dbf8
commit
048f78e0c6
@ -24,8 +24,11 @@ import java.util.Locale;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.models.Operation;
|
||||||
|
import io.swagger.v3.oas.models.servers.Server;
|
||||||
import org.openapitools.codegen.CliOption;
|
import org.openapitools.codegen.CliOption;
|
||||||
import org.openapitools.codegen.CodegenConstants;
|
import org.openapitools.codegen.CodegenConstants;
|
||||||
|
import org.openapitools.codegen.CodegenOperation;
|
||||||
import org.openapitools.codegen.SupportingFile;
|
import org.openapitools.codegen.SupportingFile;
|
||||||
import org.openapitools.codegen.languages.features.BeanValidationFeatures;
|
import org.openapitools.codegen.languages.features.BeanValidationFeatures;
|
||||||
import org.openapitools.codegen.languages.features.PerformBeanValidationFeatures;
|
import org.openapitools.codegen.languages.features.PerformBeanValidationFeatures;
|
||||||
@ -52,6 +55,8 @@ public abstract class JavaHelidonCommonCodegen extends AbstractJavaCodegen
|
|||||||
|
|
||||||
static final String MICROPROFILE_ROOT_PACKAGE = "rootJavaEEPackage";
|
static final String MICROPROFILE_ROOT_PACKAGE = "rootJavaEEPackage";
|
||||||
static final String MICROPROFILE_ROOT_DEP_PREFIX = "x-helidon-rootJavaEEDepPrefix";
|
static final String MICROPROFILE_ROOT_DEP_PREFIX = "x-helidon-rootJavaEEDepPrefix";
|
||||||
|
static final String X_HAS_RETURN_TYPE = "x-helidon-hasReturnType";
|
||||||
|
static final String X_RETURN_TYPE_EXAMPLE_VALUE = "x-helidon-exampleReturnTypeValue";
|
||||||
static final String MICROPROFILE_ROOT_PACKAGE_DESC = "Root package name for Java EE";
|
static final String MICROPROFILE_ROOT_PACKAGE_DESC = "Root package name for Java EE";
|
||||||
static final String MICROPROFILE_ROOT_PACKAGE_JAVAX = "javax";
|
static final String MICROPROFILE_ROOT_PACKAGE_JAVAX = "javax";
|
||||||
static final String MICROPROFILE_ROOT_PACKAGE_JAKARTA = "jakarta";
|
static final String MICROPROFILE_ROOT_PACKAGE_JAKARTA = "jakarta";
|
||||||
@ -125,6 +130,14 @@ public abstract class JavaHelidonCommonCodegen extends AbstractJavaCodegen
|
|||||||
setEEPackageAndDependencies(helidonVersion);
|
setEEPackageAndDependencies(helidonVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CodegenOperation fromOperation(String path, String httpMethod, Operation operation, List<Server> servers) {
|
||||||
|
CodegenOperation op = super.fromOperation(path, httpMethod, operation, servers);
|
||||||
|
op.vendorExtensions.put(X_HAS_RETURN_TYPE, op.returnType != null && !op.returnType.equals("void"));
|
||||||
|
op.vendorExtensions.put(X_RETURN_TYPE_EXAMPLE_VALUE, chooseExampleReturnTypeValue(op));
|
||||||
|
return op;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove set of options not currently used by any Helidon generator. Should be
|
* Remove set of options not currently used by any Helidon generator. Should be
|
||||||
* called during construction but only on leaf classes.
|
* called during construction but only on leaf classes.
|
||||||
@ -257,4 +270,49 @@ public abstract class JavaHelidonCommonCodegen extends AbstractJavaCodegen
|
|||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
forRemoval.forEach(cliOptions::remove);
|
forRemoval.forEach(cliOptions::remove);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String chooseExampleReturnTypeValue(CodegenOperation op) {
|
||||||
|
|
||||||
|
// See DefaultCodegen#handleMethodResponse to see how the various op fields related to the return type are set.
|
||||||
|
if (op.returnType == null) {
|
||||||
|
return ""; // won't be used anyway in the templates
|
||||||
|
}
|
||||||
|
if (op.isMap) {
|
||||||
|
return "java.util.Collections.emptyMap()";
|
||||||
|
}
|
||||||
|
if (op.isArray) {
|
||||||
|
return "java.util.Collections.emptyList()";
|
||||||
|
}
|
||||||
|
switch (op.returnType) {
|
||||||
|
case "Integer":
|
||||||
|
return "new Integer(0)";
|
||||||
|
|
||||||
|
case "byte[]":
|
||||||
|
return "new byte[0]";
|
||||||
|
|
||||||
|
case "Float":
|
||||||
|
return "new Float(0.0f)";
|
||||||
|
|
||||||
|
case "boolean":
|
||||||
|
return "false";
|
||||||
|
|
||||||
|
case "Long":
|
||||||
|
return "new Long(0L)";
|
||||||
|
|
||||||
|
case "Object":
|
||||||
|
return "new Object()";
|
||||||
|
|
||||||
|
case "String":
|
||||||
|
return "\"\"";
|
||||||
|
|
||||||
|
case "Boolean":
|
||||||
|
return "new Boolean(false)";
|
||||||
|
|
||||||
|
case "Double":
|
||||||
|
return "new Double(0.0d)";
|
||||||
|
|
||||||
|
default:
|
||||||
|
return "null";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,9 @@ package {{package}};
|
|||||||
{{/imports}}
|
{{/imports}}
|
||||||
|
|
||||||
import {{rootJavaEEPackage}}.ws.rs.*;
|
import {{rootJavaEEPackage}}.ws.rs.*;
|
||||||
|
{{#returnResponse}}
|
||||||
import {{rootJavaEEPackage}}.ws.rs.core.Response;
|
import {{rootJavaEEPackage}}.ws.rs.core.Response;
|
||||||
|
{{/returnResponse}}
|
||||||
{{#supportAsync}}
|
{{#supportAsync}}
|
||||||
import java.util.concurrent.CompletionStage;
|
import java.util.concurrent.CompletionStage;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
@ -2,4 +2,4 @@
|
|||||||
@Path("{{{path}}}"){{/subresourceOperation}}{{#hasConsumes}}
|
@Path("{{{path}}}"){{/subresourceOperation}}{{#hasConsumes}}
|
||||||
@Consumes({ {{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}} }){{/hasConsumes}}{{#hasProduces}}
|
@Consumes({ {{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}} }){{/hasConsumes}}{{#hasProduces}}
|
||||||
@Produces({ {{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}} }){{/hasProduces}}
|
@Produces({ {{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}} }){{/hasProduces}}
|
||||||
abstract {{#supportAsync}}{{>returnAsyncTypeInterface}}{{/supportAsync}}{{^supportAsync}}Response{{/supportAsync}} {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>cookieParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{^-last}}, {{/-last}}{{/allParams}});
|
{{#useAbstractClass}}abstract {{/useAbstractClass}}{{#supportAsync}}{{>returnAsyncTypeInterface}}{{/supportAsync}}{{^supportAsync}}{{>returnTypes}}{{/supportAsync}} {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>cookieParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{^-last}}, {{/-last}}{{/allParams}});
|
@ -5,7 +5,9 @@ package {{package}};
|
|||||||
{{/imports}}
|
{{/imports}}
|
||||||
|
|
||||||
import {{rootJavaEEPackage}}.ws.rs.*;
|
import {{rootJavaEEPackage}}.ws.rs.*;
|
||||||
|
{{#returnResponse}}
|
||||||
import {{rootJavaEEPackage}}.ws.rs.core.Response;
|
import {{rootJavaEEPackage}}.ws.rs.core.Response;
|
||||||
|
{{/returnResponse}}
|
||||||
|
|
||||||
{{#supportAsync}}
|
{{#supportAsync}}
|
||||||
import java.util.concurrent.CompletionStage;
|
import java.util.concurrent.CompletionStage;
|
||||||
|
@ -2,6 +2,21 @@
|
|||||||
@Path("{{{path}}}"){{/subresourceOperation}}{{#hasConsumes}}
|
@Path("{{{path}}}"){{/subresourceOperation}}{{#hasConsumes}}
|
||||||
@Consumes({ {{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}} }){{/hasConsumes}}{{#hasProduces}}
|
@Consumes({ {{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}} }){{/hasConsumes}}{{#hasProduces}}
|
||||||
@Produces({ {{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}} }){{/hasProduces}}
|
@Produces({ {{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}} }){{/hasProduces}}
|
||||||
public {{#supportAsync}}CompletionStage<{{/supportAsync}}Response{{#supportAsync}}>{{/supportAsync}} {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>cookieParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{^-last}},{{/-last}}{{/allParams}}) {
|
public {{#supportAsync}}{{>returnAsyncTypeInterface}}{{/supportAsync}}{{^supportAsync}}{{>returnTypes}}{{/supportAsync}} {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>cookieParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{^-last}},{{/-last}}{{/allParams}}) {
|
||||||
return {{#supportAsync}}CompletableFuture.supplyAsync(() -> {{/supportAsync}}Response.ok().entity("magic!").build(){{#supportAsync}}){{/supportAsync}};
|
{{#returnResponse}}
|
||||||
|
return {{#supportAsync}}CompletableFuture.supplyAsync(() -> {{/supportAsync}}Response.ok({{#vendorExtensions.x-helidon-hasReturnType}}/* Pass {{{returnType}}} entity payload */{{/vendorExtensions.x-helidon-hasReturnType}}).build(){{#supportAsync}}){{/supportAsync}}; // Replace with correct business logic.
|
||||||
|
{{/returnResponse}}
|
||||||
|
{{^returnResponse}}
|
||||||
|
{{#vendorExtensions.x-helidon-hasReturnType}}
|
||||||
|
{{{returnType}}} result = {{{vendorExtensions.x-helidon-exampleReturnTypeValue}}}; // Replace with correct business logic.
|
||||||
|
{{/vendorExtensions.x-helidon-hasReturnType}}
|
||||||
|
{{#supportAsync}}
|
||||||
|
return CompletableFuture.supplyAsync(() -> {{#vendorExtensions.x-helidon-hasReturnType}}result{{/vendorExtensions.x-helidon-hasReturnType}}{{^vendorExtensions.x-helidon-hasReturnType}}null{{/vendorExtensions.x-helidon-hasReturnType}});
|
||||||
|
{{/supportAsync}}
|
||||||
|
{{^supportAsync}}
|
||||||
|
{{#vendorExtensions.x-helidon-hasReturnType}}
|
||||||
|
return result;
|
||||||
|
{{/vendorExtensions.x-helidon-hasReturnType}}
|
||||||
|
{{/supportAsync}}
|
||||||
|
{{/returnResponse}}
|
||||||
}
|
}
|
@ -0,0 +1 @@
|
|||||||
|
CompletionStage<{{#returnResponse}}Response{{/returnResponse}}{{^returnResponse}}{{#returnContainer}}{{#isMap}}Map<String, {{{returnBaseType}}}>{{/isMap}}{{#isArray}}{{{returnContainer}}}<{{{returnBaseType}}}>{{/isArray}}{{/returnContainer}}{{^returnContainer}}{{{returnBaseType}}}{{/returnContainer}}{{/returnResponse}}>
|
@ -1 +1 @@
|
|||||||
{{#returnContainer}}{{#isMap}}Map<String, {{{returnType}}}>{{/isMap}}{{#isArray}}{{{returnContainer}}}<{{{returnType}}}>{{/isArray}}{{/returnContainer}}{{^returnContainer}}{{{returnType}}}{{/returnContainer}}
|
{{#returnResponse}}Response{{/returnResponse}}{{^returnResponse}}{{#returnContainer}}{{#isMap}}Map<String, {{{returnBaseType}}}>{{/isMap}}{{#isArray}}{{{returnContainer}}}<{{{returnBaseType}}}>{{/isArray}}{{/returnContainer}}{{^returnContainer}}{{{returnType}}}{{/returnContainer}}{{/returnResponse}}
|
@ -29,6 +29,7 @@ import java.io.IOException;
|
|||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
import static org.hamcrest.CoreMatchers.is;
|
import static org.hamcrest.CoreMatchers.is;
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
import static org.hamcrest.MatcherAssert.assertThat;
|
||||||
@ -111,13 +112,13 @@ public class JavaHelidonMpServerCodegenTest {
|
|||||||
.fileContains("public abstract class StoreService")
|
.fileContains("public abstract class StoreService")
|
||||||
.assertMethod("placeOrder", "Order")
|
.assertMethod("placeOrder", "Order")
|
||||||
.doesNotHaveImplementation()
|
.doesNotHaveImplementation()
|
||||||
.hasReturnType("Response");
|
.hasReturnType("Order");
|
||||||
|
|
||||||
JavaFileAssert.assertThat(Paths.get(apiPackage + "/StoreServiceImpl.java"))
|
JavaFileAssert.assertThat(Paths.get(apiPackage + "/StoreServiceImpl.java"))
|
||||||
.fileContains("public class StoreServiceImpl extends StoreService")
|
.fileContains("public class StoreServiceImpl extends StoreService")
|
||||||
.assertMethod("placeOrder", "Order")
|
.assertMethod("placeOrder", "Order")
|
||||||
.hasReturnType("Response")
|
.hasReturnType("Order")
|
||||||
.bodyContainsLines("return Response.ok().entity(\"magic!\").build();");
|
.bodyContainsLines("Order result = null; // Replace with correct business logic.", "return result;");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -131,7 +132,7 @@ public class JavaHelidonMpServerCodegenTest {
|
|||||||
JavaFileAssert.assertThat(Paths.get(apiPackage + "/StoreService.java"))
|
JavaFileAssert.assertThat(Paths.get(apiPackage + "/StoreService.java"))
|
||||||
.fileContains("public interface StoreService")
|
.fileContains("public interface StoreService")
|
||||||
.assertMethod("placeOrder", "Order")
|
.assertMethod("placeOrder", "Order")
|
||||||
.hasReturnType("Response");
|
.hasReturnType("Order");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -206,4 +207,46 @@ public class JavaHelidonMpServerCodegenTest {
|
|||||||
TestUtils.assertFileNotExists(Paths.get(outputPath + "/pom.xml"));
|
TestUtils.assertFileNotExists(Paths.get(outputPath + "/pom.xml"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testReturnResponse() {
|
||||||
|
generate(createConfigurator().addAdditionalProperty("returnResponse", "true"));
|
||||||
|
|
||||||
|
JavaFileAssert.assertThat(Paths.get(apiPackage + "/PetService.java"))
|
||||||
|
.fileContains("public interface PetService")
|
||||||
|
.assertMethod("addPet", "Pet")
|
||||||
|
.hasReturnType("Response");
|
||||||
|
JavaFileAssert.assertThat(Paths.get(apiPackage + "/PetService.java"))
|
||||||
|
.fileContains("public interface PetService")
|
||||||
|
.assertMethod("deletePet", "Long", "String", "Long", "String", "Integer", "List<Integer>", "List<String>")
|
||||||
|
.hasReturnType("Response");
|
||||||
|
|
||||||
|
JavaFileAssert.assertThat(Paths.get(apiPackage + "/PetServiceImpl.java"))
|
||||||
|
.fileContains("public class PetServiceImpl implements PetService")
|
||||||
|
.assertMethod("addPet", "Pet")
|
||||||
|
.hasReturnType("Response")
|
||||||
|
.bodyContainsLines("return Response.ok(/* Pass Pet entity payload */).build(); "
|
||||||
|
+ "// Replace with correct business logic.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSupportAsync() {
|
||||||
|
generate(createConfigurator().addAdditionalProperty("supportAsync", "true"));
|
||||||
|
|
||||||
|
JavaFileAssert.assertThat(Paths.get(apiPackage + "/PetService.java"))
|
||||||
|
.fileContains("public interface PetService")
|
||||||
|
.assertMethod("addPet", "Pet")
|
||||||
|
.hasReturnType("CompletionStage<Pet>");
|
||||||
|
JavaFileAssert.assertThat(Paths.get(apiPackage + "/PetService.java"))
|
||||||
|
.fileContains("public interface PetService")
|
||||||
|
.assertMethod("deletePet", "Long", "String", "Long", "String", "Integer", "List<Integer>", "List<String>")
|
||||||
|
.hasReturnType("CompletionStage<Void>");
|
||||||
|
|
||||||
|
JavaFileAssert.assertThat(Paths.get(apiPackage + "/PetServiceImpl.java"))
|
||||||
|
.fileContains("public class PetServiceImpl implements PetService")
|
||||||
|
.assertMethod("addPet", "Pet")
|
||||||
|
.hasReturnType("CompletionStage<Pet>")
|
||||||
|
.bodyContainsLines("Pet result = null; // Replace with correct business logic.",
|
||||||
|
"return CompletableFuture.supplyAsync(() -> result);");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -15,8 +15,6 @@ package org.openapitools.server.api;
|
|||||||
import org.openapitools.server.model.Client;
|
import org.openapitools.server.model.Client;
|
||||||
|
|
||||||
import jakarta.ws.rs.*;
|
import jakarta.ws.rs.*;
|
||||||
import jakarta.ws.rs.core.Response;
|
|
||||||
|
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -31,5 +29,5 @@ public interface AnotherFakeService {
|
|||||||
@PATCH
|
@PATCH
|
||||||
@Consumes({ "application/json" })
|
@Consumes({ "application/json" })
|
||||||
@Produces({ "application/json" })
|
@Produces({ "application/json" })
|
||||||
abstract Response call123testSpecialTags(@Valid @NotNull Client client);
|
Client call123testSpecialTags(@Valid @NotNull Client client);
|
||||||
}
|
}
|
||||||
|
@ -15,8 +15,6 @@ package org.openapitools.server.api;
|
|||||||
import org.openapitools.server.model.FooGetDefaultResponse;
|
import org.openapitools.server.model.FooGetDefaultResponse;
|
||||||
|
|
||||||
import jakarta.ws.rs.*;
|
import jakarta.ws.rs.*;
|
||||||
import jakarta.ws.rs.core.Response;
|
|
||||||
|
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -30,5 +28,5 @@ public interface DefaultService {
|
|||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Produces({ "application/json" })
|
@Produces({ "application/json" })
|
||||||
abstract Response fooGet();
|
FooGetDefaultResponse fooGet();
|
||||||
}
|
}
|
||||||
|
@ -15,8 +15,6 @@ package org.openapitools.server.api;
|
|||||||
import org.openapitools.server.model.Client;
|
import org.openapitools.server.model.Client;
|
||||||
|
|
||||||
import jakarta.ws.rs.*;
|
import jakarta.ws.rs.*;
|
||||||
import jakarta.ws.rs.core.Response;
|
|
||||||
|
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -31,5 +29,5 @@ public interface FakeClassnameTags123Service {
|
|||||||
@PATCH
|
@PATCH
|
||||||
@Consumes({ "application/json" })
|
@Consumes({ "application/json" })
|
||||||
@Produces({ "application/json" })
|
@Produces({ "application/json" })
|
||||||
abstract Response testClassname(@Valid @NotNull Client client);
|
Client testClassname(@Valid @NotNull Client client);
|
||||||
}
|
}
|
||||||
|
@ -27,8 +27,6 @@ import org.openapitools.server.model.Pet;
|
|||||||
import org.openapitools.server.model.User;
|
import org.openapitools.server.model.User;
|
||||||
|
|
||||||
import jakarta.ws.rs.*;
|
import jakarta.ws.rs.*;
|
||||||
import jakarta.ws.rs.core.Response;
|
|
||||||
|
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -43,85 +41,85 @@ public interface FakeService {
|
|||||||
@GET
|
@GET
|
||||||
@Path("/health")
|
@Path("/health")
|
||||||
@Produces({ "application/json" })
|
@Produces({ "application/json" })
|
||||||
abstract Response fakeHealthGet();
|
HealthCheckResult fakeHealthGet();
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("/http-signature-test")
|
@Path("/http-signature-test")
|
||||||
@Consumes({ "application/json", "application/xml" })
|
@Consumes({ "application/json", "application/xml" })
|
||||||
abstract Response fakeHttpSignatureTest(@Valid @NotNull Pet pet, @QueryParam("query_1") String query1, @HeaderParam("header_1") String header1);
|
void fakeHttpSignatureTest(@Valid @NotNull Pet pet, @QueryParam("query_1") String query1, @HeaderParam("header_1") String header1);
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@Path("/outer/boolean")
|
@Path("/outer/boolean")
|
||||||
@Consumes({ "application/json" })
|
@Consumes({ "application/json" })
|
||||||
@Produces({ "*/*" })
|
@Produces({ "*/*" })
|
||||||
abstract Response fakeOuterBooleanSerialize(@Valid Boolean body);
|
Boolean fakeOuterBooleanSerialize(@Valid Boolean body);
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@Path("/outer/composite")
|
@Path("/outer/composite")
|
||||||
@Consumes({ "application/json" })
|
@Consumes({ "application/json" })
|
||||||
@Produces({ "*/*" })
|
@Produces({ "*/*" })
|
||||||
abstract Response fakeOuterCompositeSerialize(@Valid OuterComposite outerComposite);
|
OuterComposite fakeOuterCompositeSerialize(@Valid OuterComposite outerComposite);
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@Path("/outer/number")
|
@Path("/outer/number")
|
||||||
@Consumes({ "application/json" })
|
@Consumes({ "application/json" })
|
||||||
@Produces({ "*/*" })
|
@Produces({ "*/*" })
|
||||||
abstract Response fakeOuterNumberSerialize(@Valid BigDecimal body);
|
BigDecimal fakeOuterNumberSerialize(@Valid BigDecimal body);
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@Path("/outer/string")
|
@Path("/outer/string")
|
||||||
@Consumes({ "application/json" })
|
@Consumes({ "application/json" })
|
||||||
@Produces({ "*/*" })
|
@Produces({ "*/*" })
|
||||||
abstract Response fakeOuterStringSerialize(@Valid String body);
|
String fakeOuterStringSerialize(@Valid String body);
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@Path("/property/enum-int")
|
@Path("/property/enum-int")
|
||||||
@Consumes({ "application/json" })
|
@Consumes({ "application/json" })
|
||||||
@Produces({ "*/*" })
|
@Produces({ "*/*" })
|
||||||
abstract Response fakePropertyEnumIntegerSerialize(@Valid @NotNull OuterObjectWithEnumProperty outerObjectWithEnumProperty);
|
OuterObjectWithEnumProperty fakePropertyEnumIntegerSerialize(@Valid @NotNull OuterObjectWithEnumProperty outerObjectWithEnumProperty);
|
||||||
|
|
||||||
@PUT
|
@PUT
|
||||||
@Path("/body-with-binary")
|
@Path("/body-with-binary")
|
||||||
@Consumes({ "image/png" })
|
@Consumes({ "image/png" })
|
||||||
abstract Response testBodyWithBinary(@Valid File body);
|
void testBodyWithBinary(@Valid File body);
|
||||||
|
|
||||||
@PUT
|
@PUT
|
||||||
@Path("/body-with-file-schema")
|
@Path("/body-with-file-schema")
|
||||||
@Consumes({ "application/json" })
|
@Consumes({ "application/json" })
|
||||||
abstract Response testBodyWithFileSchema(@Valid @NotNull FileSchemaTestClass fileSchemaTestClass);
|
void testBodyWithFileSchema(@Valid @NotNull FileSchemaTestClass fileSchemaTestClass);
|
||||||
|
|
||||||
@PUT
|
@PUT
|
||||||
@Path("/body-with-query-params")
|
@Path("/body-with-query-params")
|
||||||
@Consumes({ "application/json" })
|
@Consumes({ "application/json" })
|
||||||
abstract Response testBodyWithQueryParams(@QueryParam("query") @NotNull String query, @Valid @NotNull User user);
|
void testBodyWithQueryParams(@QueryParam("query") @NotNull String query, @Valid @NotNull User user);
|
||||||
|
|
||||||
@PATCH
|
@PATCH
|
||||||
@Consumes({ "application/json" })
|
@Consumes({ "application/json" })
|
||||||
@Produces({ "application/json" })
|
@Produces({ "application/json" })
|
||||||
abstract Response testClientModel(@Valid @NotNull Client client);
|
Client testClientModel(@Valid @NotNull Client client);
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@Consumes({ "application/x-www-form-urlencoded" })
|
@Consumes({ "application/x-www-form-urlencoded" })
|
||||||
abstract Response testEndpointParameters(@FormParam(value = "number") BigDecimal number, @FormParam(value = "double") Double _double, @FormParam(value = "pattern_without_delimiter") String patternWithoutDelimiter, @FormParam(value = "byte") byte[] _byte, @FormParam(value = "integer") Integer integer, @FormParam(value = "int32") Integer int32, @FormParam(value = "int64") Long int64, @FormParam(value = "float") Float _float, @FormParam(value = "string") String string, @FormParam(value = "binary") InputStream binaryInputStream, @FormParam(value = "date") LocalDate date, @FormParam(value = "dateTime") OffsetDateTime dateTime, @FormParam(value = "password") String password, @FormParam(value = "callback") String paramCallback);
|
void testEndpointParameters(@FormParam(value = "number") BigDecimal number, @FormParam(value = "double") Double _double, @FormParam(value = "pattern_without_delimiter") String patternWithoutDelimiter, @FormParam(value = "byte") byte[] _byte, @FormParam(value = "integer") Integer integer, @FormParam(value = "int32") Integer int32, @FormParam(value = "int64") Long int64, @FormParam(value = "float") Float _float, @FormParam(value = "string") String string, @FormParam(value = "binary") InputStream binaryInputStream, @FormParam(value = "date") LocalDate date, @FormParam(value = "dateTime") OffsetDateTime dateTime, @FormParam(value = "password") String password, @FormParam(value = "callback") String paramCallback);
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Consumes({ "application/x-www-form-urlencoded" })
|
@Consumes({ "application/x-www-form-urlencoded" })
|
||||||
abstract Response testEnumParameters(@HeaderParam("enum_header_string_array") List<String> enumHeaderStringArray, @HeaderParam("enum_header_string") @DefaultValue("-efg") String enumHeaderString, @QueryParam("enum_query_string_array") List<String> enumQueryStringArray, @QueryParam("enum_query_string") @DefaultValue("-efg") String enumQueryString, @QueryParam("enum_query_integer") Integer enumQueryInteger, @QueryParam("enum_query_double") Double enumQueryDouble, @QueryParam("enum_query_model_array") List<EnumClass> enumQueryModelArray, @FormParam(value = "enum_form_string_array") List<String> enumFormStringArray, @FormParam(value = "enum_form_string") String enumFormString);
|
void testEnumParameters(@HeaderParam("enum_header_string_array") List<String> enumHeaderStringArray, @HeaderParam("enum_header_string") @DefaultValue("-efg") String enumHeaderString, @QueryParam("enum_query_string_array") List<String> enumQueryStringArray, @QueryParam("enum_query_string") @DefaultValue("-efg") String enumQueryString, @QueryParam("enum_query_integer") Integer enumQueryInteger, @QueryParam("enum_query_double") Double enumQueryDouble, @QueryParam("enum_query_model_array") List<EnumClass> enumQueryModelArray, @FormParam(value = "enum_form_string_array") List<String> enumFormStringArray, @FormParam(value = "enum_form_string") String enumFormString);
|
||||||
|
|
||||||
@DELETE
|
@DELETE
|
||||||
abstract Response testGroupParameters(@QueryParam("required_string_group") @NotNull Integer requiredStringGroup, @HeaderParam("required_boolean_group") @NotNull Boolean requiredBooleanGroup, @QueryParam("required_int64_group") @NotNull Long requiredInt64Group, @QueryParam("string_group") Integer stringGroup, @HeaderParam("boolean_group") Boolean booleanGroup, @QueryParam("int64_group") Long int64Group);
|
void testGroupParameters(@QueryParam("required_string_group") @NotNull Integer requiredStringGroup, @HeaderParam("required_boolean_group") @NotNull Boolean requiredBooleanGroup, @QueryParam("required_int64_group") @NotNull Long requiredInt64Group, @QueryParam("string_group") Integer stringGroup, @HeaderParam("boolean_group") Boolean booleanGroup, @QueryParam("int64_group") Long int64Group);
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@Path("/inline-additionalProperties")
|
@Path("/inline-additionalProperties")
|
||||||
@Consumes({ "application/json" })
|
@Consumes({ "application/json" })
|
||||||
abstract Response testInlineAdditionalProperties(@Valid @NotNull Map<String, String> requestBody);
|
void testInlineAdditionalProperties(@Valid @NotNull Map<String, String> requestBody);
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("/jsonFormData")
|
@Path("/jsonFormData")
|
||||||
@Consumes({ "application/x-www-form-urlencoded" })
|
@Consumes({ "application/x-www-form-urlencoded" })
|
||||||
abstract Response testJsonFormData(@FormParam(value = "param") String param, @FormParam(value = "param2") String param2);
|
void testJsonFormData(@FormParam(value = "param") String param, @FormParam(value = "param2") String param2);
|
||||||
|
|
||||||
@PUT
|
@PUT
|
||||||
@Path("/test-query-parameters")
|
@Path("/test-query-parameters")
|
||||||
abstract Response testQueryParameterCollectionFormat(@QueryParam("pipe") @NotNull List<String> pipe, @QueryParam("ioutil") @NotNull List<String> ioutil, @QueryParam("http") @NotNull List<String> http, @QueryParam("url") @NotNull List<String> url, @QueryParam("context") @NotNull List<String> context, @QueryParam("allowEmpty") @NotNull String allowEmpty, @QueryParam("language") Map<String, String> language);
|
void testQueryParameterCollectionFormat(@QueryParam("pipe") @NotNull List<String> pipe, @QueryParam("ioutil") @NotNull List<String> ioutil, @QueryParam("http") @NotNull List<String> http, @QueryParam("url") @NotNull List<String> url, @QueryParam("context") @NotNull List<String> context, @QueryParam("allowEmpty") @NotNull String allowEmpty, @QueryParam("language") Map<String, String> language);
|
||||||
}
|
}
|
||||||
|
@ -18,8 +18,6 @@ import org.openapitools.server.model.Pet;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import jakarta.ws.rs.*;
|
import jakarta.ws.rs.*;
|
||||||
import jakarta.ws.rs.core.Response;
|
|
||||||
|
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -34,46 +32,46 @@ public interface PetService {
|
|||||||
@POST
|
@POST
|
||||||
@Path("/pet")
|
@Path("/pet")
|
||||||
@Consumes({ "application/json", "application/xml" })
|
@Consumes({ "application/json", "application/xml" })
|
||||||
abstract Response addPet(@Valid @NotNull Pet pet);
|
void addPet(@Valid @NotNull Pet pet);
|
||||||
|
|
||||||
@DELETE
|
@DELETE
|
||||||
@Path("/pet/{petId}")
|
@Path("/pet/{petId}")
|
||||||
abstract Response deletePet(@PathParam("petId") Long petId, @HeaderParam("api_key") String apiKey);
|
void deletePet(@PathParam("petId") Long petId, @HeaderParam("api_key") String apiKey);
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("/pet/findByStatus")
|
@Path("/pet/findByStatus")
|
||||||
@Produces({ "application/xml", "application/json" })
|
@Produces({ "application/xml", "application/json" })
|
||||||
abstract Response findPetsByStatus(@QueryParam("status") @NotNull List<String> status);
|
List<Pet> findPetsByStatus(@QueryParam("status") @NotNull List<String> status);
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("/pet/findByTags")
|
@Path("/pet/findByTags")
|
||||||
@Produces({ "application/xml", "application/json" })
|
@Produces({ "application/xml", "application/json" })
|
||||||
abstract Response findPetsByTags(@QueryParam("tags") @NotNull Set<String> tags);
|
Set<Pet> findPetsByTags(@QueryParam("tags") @NotNull Set<String> tags);
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("/pet/{petId}")
|
@Path("/pet/{petId}")
|
||||||
@Produces({ "application/xml", "application/json" })
|
@Produces({ "application/xml", "application/json" })
|
||||||
abstract Response getPetById(@PathParam("petId") Long petId);
|
Pet getPetById(@PathParam("petId") Long petId);
|
||||||
|
|
||||||
@PUT
|
@PUT
|
||||||
@Path("/pet")
|
@Path("/pet")
|
||||||
@Consumes({ "application/json", "application/xml" })
|
@Consumes({ "application/json", "application/xml" })
|
||||||
abstract Response updatePet(@Valid @NotNull Pet pet);
|
void updatePet(@Valid @NotNull Pet pet);
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@Path("/pet/{petId}")
|
@Path("/pet/{petId}")
|
||||||
@Consumes({ "application/x-www-form-urlencoded" })
|
@Consumes({ "application/x-www-form-urlencoded" })
|
||||||
abstract Response updatePetWithForm(@PathParam("petId") Long petId, @FormParam(value = "name") String name, @FormParam(value = "status") String status);
|
void updatePetWithForm(@PathParam("petId") Long petId, @FormParam(value = "name") String name, @FormParam(value = "status") String status);
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@Path("/pet/{petId}/uploadImage")
|
@Path("/pet/{petId}/uploadImage")
|
||||||
@Consumes({ "multipart/form-data" })
|
@Consumes({ "multipart/form-data" })
|
||||||
@Produces({ "application/json" })
|
@Produces({ "application/json" })
|
||||||
abstract Response uploadFile(@PathParam("petId") Long petId, @FormParam(value = "additionalMetadata") String additionalMetadata, @FormParam(value = "file") InputStream _fileInputStream);
|
ModelApiResponse uploadFile(@PathParam("petId") Long petId, @FormParam(value = "additionalMetadata") String additionalMetadata, @FormParam(value = "file") InputStream _fileInputStream);
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@Path("/fake/{petId}/uploadImageWithRequiredFile")
|
@Path("/fake/{petId}/uploadImageWithRequiredFile")
|
||||||
@Consumes({ "multipart/form-data" })
|
@Consumes({ "multipart/form-data" })
|
||||||
@Produces({ "application/json" })
|
@Produces({ "application/json" })
|
||||||
abstract Response uploadFileWithRequiredFile(@PathParam("petId") Long petId, @FormParam(value = "requiredFile") InputStream requiredFileInputStream, @FormParam(value = "additionalMetadata") String additionalMetadata);
|
ModelApiResponse uploadFileWithRequiredFile(@PathParam("petId") Long petId, @FormParam(value = "requiredFile") InputStream requiredFileInputStream, @FormParam(value = "additionalMetadata") String additionalMetadata);
|
||||||
}
|
}
|
||||||
|
@ -16,8 +16,6 @@ import java.util.Map;
|
|||||||
import org.openapitools.server.model.Order;
|
import org.openapitools.server.model.Order;
|
||||||
|
|
||||||
import jakarta.ws.rs.*;
|
import jakarta.ws.rs.*;
|
||||||
import jakarta.ws.rs.core.Response;
|
|
||||||
|
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -31,21 +29,21 @@ public interface StoreService {
|
|||||||
|
|
||||||
@DELETE
|
@DELETE
|
||||||
@Path("/order/{order_id}")
|
@Path("/order/{order_id}")
|
||||||
abstract Response deleteOrder(@PathParam("order_id") String orderId);
|
void deleteOrder(@PathParam("order_id") String orderId);
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("/inventory")
|
@Path("/inventory")
|
||||||
@Produces({ "application/json" })
|
@Produces({ "application/json" })
|
||||||
abstract Response getInventory();
|
Map<String, Integer> getInventory();
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("/order/{order_id}")
|
@Path("/order/{order_id}")
|
||||||
@Produces({ "application/xml", "application/json" })
|
@Produces({ "application/xml", "application/json" })
|
||||||
abstract Response getOrderById(@PathParam("order_id") @Min(1L) @Max(5L) Long orderId);
|
Order getOrderById(@PathParam("order_id") @Min(1L) @Max(5L) Long orderId);
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@Path("/order")
|
@Path("/order")
|
||||||
@Consumes({ "application/json" })
|
@Consumes({ "application/json" })
|
||||||
@Produces({ "application/xml", "application/json" })
|
@Produces({ "application/xml", "application/json" })
|
||||||
abstract Response placeOrder(@Valid @NotNull Order order);
|
Order placeOrder(@Valid @NotNull Order order);
|
||||||
}
|
}
|
||||||
|
@ -17,8 +17,6 @@ import java.time.OffsetDateTime;
|
|||||||
import org.openapitools.server.model.User;
|
import org.openapitools.server.model.User;
|
||||||
|
|
||||||
import jakarta.ws.rs.*;
|
import jakarta.ws.rs.*;
|
||||||
import jakarta.ws.rs.core.Response;
|
|
||||||
|
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -32,38 +30,38 @@ public interface UserService {
|
|||||||
|
|
||||||
@POST
|
@POST
|
||||||
@Consumes({ "application/json" })
|
@Consumes({ "application/json" })
|
||||||
abstract Response createUser(@Valid @NotNull User user);
|
void createUser(@Valid @NotNull User user);
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@Path("/createWithArray")
|
@Path("/createWithArray")
|
||||||
@Consumes({ "application/json" })
|
@Consumes({ "application/json" })
|
||||||
abstract Response createUsersWithArrayInput(@Valid @NotNull List<User> user);
|
void createUsersWithArrayInput(@Valid @NotNull List<User> user);
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@Path("/createWithList")
|
@Path("/createWithList")
|
||||||
@Consumes({ "application/json" })
|
@Consumes({ "application/json" })
|
||||||
abstract Response createUsersWithListInput(@Valid @NotNull List<User> user);
|
void createUsersWithListInput(@Valid @NotNull List<User> user);
|
||||||
|
|
||||||
@DELETE
|
@DELETE
|
||||||
@Path("/{username}")
|
@Path("/{username}")
|
||||||
abstract Response deleteUser(@PathParam("username") String username);
|
void deleteUser(@PathParam("username") String username);
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("/{username}")
|
@Path("/{username}")
|
||||||
@Produces({ "application/xml", "application/json" })
|
@Produces({ "application/xml", "application/json" })
|
||||||
abstract Response getUserByName(@PathParam("username") String username);
|
User getUserByName(@PathParam("username") String username);
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("/login")
|
@Path("/login")
|
||||||
@Produces({ "application/xml", "application/json" })
|
@Produces({ "application/xml", "application/json" })
|
||||||
abstract Response loginUser(@QueryParam("username") @NotNull String username, @QueryParam("password") @NotNull String password);
|
String loginUser(@QueryParam("username") @NotNull String username, @QueryParam("password") @NotNull String password);
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("/logout")
|
@Path("/logout")
|
||||||
abstract Response logoutUser();
|
void logoutUser();
|
||||||
|
|
||||||
@PUT
|
@PUT
|
||||||
@Path("/{username}")
|
@Path("/{username}")
|
||||||
@Consumes({ "application/json" })
|
@Consumes({ "application/json" })
|
||||||
abstract Response updateUser(@PathParam("username") String username, @Valid @NotNull User user);
|
void updateUser(@PathParam("username") String username, @Valid @NotNull User user);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user