[Java/Microprofile] Add support for Jackson serialization & async interfaces using Mutiny in Java Microprofile library (#11554)

This commit is contained in:
pravussum 2023-02-03 12:39:01 +01:00 committed by GitHub
parent 6b80410bf3
commit 4f1708c3fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 94 additions and 51 deletions

View File

@ -57,10 +57,11 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|implicitHeadersRegex|Skip header parameters that matches given regex in the generated API methods using @ApiImplicitParams annotation. Note: this parameter is ignored when implicitHeaders=true| |null| |implicitHeadersRegex|Skip header parameters that matches given regex in the generated API methods using @ApiImplicitParams annotation. Note: this parameter is ignored when implicitHeaders=true| |null|
|invokerPackage|root package for generated code| |org.openapitools.client| |invokerPackage|root package for generated code| |org.openapitools.client|
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C#have this enabled by default).|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true| |legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C#have this enabled by default).|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|
|library|library template (sub-template) to use|<dl><dt>**jersey1**</dt><dd>HTTP client: Jersey client 1.19.x. JSON processing: Jackson 2.9.x. Enable gzip request encoding using '-DuseGzipFeature=true'. IMPORTANT NOTE: jersey 1.x is no longer actively maintained so please upgrade to 'jersey3' or other HTTP libraries instead.</dd><dt>**jersey2**</dt><dd>HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.9.x</dd><dt>**jersey3**</dt><dd>HTTP client: Jersey client 3.x. JSON processing: Jackson 2.x</dd><dt>**feign**</dt><dd>HTTP client: OpenFeign 10.x. JSON processing: Jackson 2.9.x. or Gson 2.x</dd><dt>**okhttp-gson**</dt><dd>[DEFAULT] HTTP client: OkHttp 3.x. JSON processing: Gson 2.8.x. Enable Parcelable models on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'.</dd><dt>**retrofit2**</dt><dd>HTTP client: OkHttp 3.x. JSON processing: Gson 2.x (Retrofit 2.3.0). Enable the RxJava adapter using '-DuseRxJava[2/3]=true'. (RxJava 1.x or 2.x or 3.x)</dd><dt>**resttemplate**</dt><dd>HTTP client: Spring RestTemplate 4.x. JSON processing: Jackson 2.9.x</dd><dt>**webclient**</dt><dd>HTTP client: Spring WebClient 5.x. JSON processing: Jackson 2.9.x</dd><dt>**resteasy**</dt><dd>HTTP client: Resteasy client 3.x. JSON processing: Jackson 2.9.x</dd><dt>**vertx**</dt><dd>HTTP client: VertX client 3.x. JSON processing: Jackson 2.9.x</dd><dt>**google-api-client**</dt><dd>HTTP client: Google API client 1.x. JSON processing: Jackson 2.9.x</dd><dt>**rest-assured**</dt><dd>HTTP client: rest-assured : 4.x. JSON processing: Gson 2.x or Jackson 2.10.x. Only for Java 8</dd><dt>**native**</dt><dd>HTTP client: Java native HttpClient. JSON processing: Jackson 2.9.x. Only for Java11+</dd><dt>**microprofile**</dt><dd>HTTP client: Microprofile client 1.x. JSON processing: JSON-B</dd><dt>**apache-httpclient**</dt><dd>HTTP client: Apache httpclient 4.x</dd></dl>|okhttp-gson| |library|library template (sub-template) to use|<dl><dt>**jersey1**</dt><dd>HTTP client: Jersey client 1.19.x. JSON processing: Jackson 2.9.x. Enable gzip request encoding using '-DuseGzipFeature=true'. IMPORTANT NOTE: jersey 1.x is no longer actively maintained so please upgrade to 'jersey3' or other HTTP libraries instead.</dd><dt>**jersey2**</dt><dd>HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.9.x</dd><dt>**jersey3**</dt><dd>HTTP client: Jersey client 3.x. JSON processing: Jackson 2.x</dd><dt>**feign**</dt><dd>HTTP client: OpenFeign 10.x. JSON processing: Jackson 2.9.x. or Gson 2.x</dd><dt>**okhttp-gson**</dt><dd>[DEFAULT] HTTP client: OkHttp 3.x. JSON processing: Gson 2.8.x. Enable Parcelable models on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'.</dd><dt>**retrofit2**</dt><dd>HTTP client: OkHttp 3.x. JSON processing: Gson 2.x (Retrofit 2.3.0). Enable the RxJava adapter using '-DuseRxJava[2/3]=true'. (RxJava 1.x or 2.x or 3.x)</dd><dt>**resttemplate**</dt><dd>HTTP client: Spring RestTemplate 4.x. JSON processing: Jackson 2.9.x</dd><dt>**webclient**</dt><dd>HTTP client: Spring WebClient 5.x. JSON processing: Jackson 2.9.x</dd><dt>**resteasy**</dt><dd>HTTP client: Resteasy client 3.x. JSON processing: Jackson 2.9.x</dd><dt>**vertx**</dt><dd>HTTP client: VertX client 3.x. JSON processing: Jackson 2.9.x</dd><dt>**google-api-client**</dt><dd>HTTP client: Google API client 1.x. JSON processing: Jackson 2.9.x</dd><dt>**rest-assured**</dt><dd>HTTP client: rest-assured : 4.x. JSON processing: Gson 2.x or Jackson 2.10.x. Only for Java 8</dd><dt>**native**</dt><dd>HTTP client: Java native HttpClient. JSON processing: Jackson 2.9.x. Only for Java11+</dd><dt>**microprofile**</dt><dd>HTTP client: Microprofile client 1.x. JSON processing: JSON-B or Jackson 2.9.x</dd><dt>**apache-httpclient**</dt><dd>HTTP client: Apache httpclient 4.x</dd></dl>|okhttp-gson|
|licenseName|The name of the license| |Unlicense| |licenseName|The name of the license| |Unlicense|
|licenseUrl|The URL of the license| |http://unlicense.org| |licenseUrl|The URL of the license| |http://unlicense.org|
|microprofileFramework|Framework for microprofile. Possible values &quot;kumuluzee&quot;| |null| |microprofileFramework|Framework for microprofile. Possible values &quot;kumuluzee&quot;| |null|
|microprofileMutiny|Whether to use async types for microprofile (currently only Smallrye Mutiny is supported).| |null|
|microprofileRestClientVersion|Version of MicroProfile Rest Client API.| |null| |microprofileRestClientVersion|Version of MicroProfile Rest Client API.| |null|
|modelPackage|package for generated models| |org.openapitools.client.model| |modelPackage|package for generated models| |org.openapitools.client.model|
|openApiNullable|Enable OpenAPI Jackson Nullable library| |true| |openApiNullable|Enable OpenAPI Jackson Nullable library| |true|

View File

@ -65,6 +65,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
public static final String USE_REFLECTION_EQUALS_HASHCODE = "useReflectionEqualsHashCode"; public static final String USE_REFLECTION_EQUALS_HASHCODE = "useReflectionEqualsHashCode";
public static final String CASE_INSENSITIVE_RESPONSE_HEADERS = "caseInsensitiveResponseHeaders"; public static final String CASE_INSENSITIVE_RESPONSE_HEADERS = "caseInsensitiveResponseHeaders";
public static final String MICROPROFILE_FRAMEWORK = "microprofileFramework"; public static final String MICROPROFILE_FRAMEWORK = "microprofileFramework";
public static final String MICROPROFILE_MUTINY = "microprofileMutiny";
public static final String USE_ABSTRACTION_FOR_FILES = "useAbstractionForFiles"; public static final String USE_ABSTRACTION_FOR_FILES = "useAbstractionForFiles";
public static final String DYNAMIC_OPERATIONS = "dynamicOperations"; public static final String DYNAMIC_OPERATIONS = "dynamicOperations";
public static final String SUPPORT_STREAMING = "supportStreaming"; public static final String SUPPORT_STREAMING = "supportStreaming";
@ -107,6 +108,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
protected boolean doNotUseRx = true; protected boolean doNotUseRx = true;
protected boolean usePlayWS = false; protected boolean usePlayWS = false;
protected String microprofileFramework = MICROPROFILE_DEFAULT; protected String microprofileFramework = MICROPROFILE_DEFAULT;
protected boolean microprofileMutiny = false;
protected String configKey = null; protected String configKey = null;
protected boolean asyncNative = false; protected boolean asyncNative = false;
@ -199,6 +201,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
cliOptions.add(CliOption.newBoolean(USE_REFLECTION_EQUALS_HASHCODE, "Use org.apache.commons.lang3.builder for equals and hashCode in the models. WARNING: This will fail under a security manager, unless the appropriate permissions are set up correctly and also there's potential performance impact.")); cliOptions.add(CliOption.newBoolean(USE_REFLECTION_EQUALS_HASHCODE, "Use org.apache.commons.lang3.builder for equals and hashCode in the models. WARNING: This will fail under a security manager, unless the appropriate permissions are set up correctly and also there's potential performance impact."));
cliOptions.add(CliOption.newBoolean(CASE_INSENSITIVE_RESPONSE_HEADERS, "Make API response's headers case-insensitive. Available on " + OKHTTP_GSON + ", " + JERSEY2 + " libraries")); cliOptions.add(CliOption.newBoolean(CASE_INSENSITIVE_RESPONSE_HEADERS, "Make API response's headers case-insensitive. Available on " + OKHTTP_GSON + ", " + JERSEY2 + " libraries"));
cliOptions.add(CliOption.newString(MICROPROFILE_FRAMEWORK, "Framework for microprofile. Possible values \"kumuluzee\"")); cliOptions.add(CliOption.newString(MICROPROFILE_FRAMEWORK, "Framework for microprofile. Possible values \"kumuluzee\""));
cliOptions.add(CliOption.newString(MICROPROFILE_MUTINY, "Whether to use async types for microprofile (currently only Smallrye Mutiny is supported)."));
cliOptions.add(CliOption.newBoolean(USE_ABSTRACTION_FOR_FILES, "Use alternative types instead of java.io.File to allow passing bytes without a file on disk. Available on resttemplate, webclient, libraries")); cliOptions.add(CliOption.newBoolean(USE_ABSTRACTION_FOR_FILES, "Use alternative types instead of java.io.File to allow passing bytes without a file on disk. Available on resttemplate, webclient, libraries"));
cliOptions.add(CliOption.newBoolean(DYNAMIC_OPERATIONS, "Generate operations dynamically at runtime from an OAS", this.dynamicOperations)); cliOptions.add(CliOption.newBoolean(DYNAMIC_OPERATIONS, "Generate operations dynamically at runtime from an OAS", this.dynamicOperations));
cliOptions.add(CliOption.newBoolean(SUPPORT_STREAMING, "Support streaming endpoint (beta)", this.supportStreaming)); cliOptions.add(CliOption.newBoolean(SUPPORT_STREAMING, "Support streaming endpoint (beta)", this.supportStreaming));
@ -224,7 +227,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
supportedLibraries.put(GOOGLE_API_CLIENT, "HTTP client: Google API client 1.x. JSON processing: Jackson 2.9.x"); supportedLibraries.put(GOOGLE_API_CLIENT, "HTTP client: Google API client 1.x. JSON processing: Jackson 2.9.x");
supportedLibraries.put(REST_ASSURED, "HTTP client: rest-assured : 4.x. JSON processing: Gson 2.x or Jackson 2.10.x. Only for Java 8"); supportedLibraries.put(REST_ASSURED, "HTTP client: rest-assured : 4.x. JSON processing: Gson 2.x or Jackson 2.10.x. Only for Java 8");
supportedLibraries.put(NATIVE, "HTTP client: Java native HttpClient. JSON processing: Jackson 2.9.x. Only for Java11+"); supportedLibraries.put(NATIVE, "HTTP client: Java native HttpClient. JSON processing: Jackson 2.9.x. Only for Java11+");
supportedLibraries.put(MICROPROFILE, "HTTP client: Microprofile client 1.x. JSON processing: JSON-B"); supportedLibraries.put(MICROPROFILE, "HTTP client: Microprofile client 1.x. JSON processing: JSON-B or Jackson 2.9.x");
supportedLibraries.put(APACHE, "HTTP client: Apache httpclient 4.x"); supportedLibraries.put(APACHE, "HTTP client: Apache httpclient 4.x");
CliOption libraryOption = new CliOption(CodegenConstants.LIBRARY, "library template (sub-template) to use"); CliOption libraryOption = new CliOption(CodegenConstants.LIBRARY, "library template (sub-template) to use");
@ -336,6 +339,10 @@ public class JavaClientCodegen extends AbstractJavaCodegen
} }
additionalProperties.put(MICROPROFILE_FRAMEWORK, microprofileFramework); additionalProperties.put(MICROPROFILE_FRAMEWORK, microprofileFramework);
if (additionalProperties.containsKey(MICROPROFILE_MUTINY)) {
this.setMicroprofileMutiny(convertPropertyToBooleanAndWriteBack(MICROPROFILE_MUTINY));
}
if (!additionalProperties.containsKey(MICROPROFILE_REST_CLIENT_VERSION)) { if (!additionalProperties.containsKey(MICROPROFILE_REST_CLIENT_VERSION)) {
additionalProperties.put(MICROPROFILE_REST_CLIENT_VERSION, MICROPROFILE_REST_CLIENT_DEFAULT_VERSION); additionalProperties.put(MICROPROFILE_REST_CLIENT_VERSION, MICROPROFILE_REST_CLIENT_DEFAULT_VERSION);
} else { } else {
@ -646,7 +653,12 @@ public class JavaClientCodegen extends AbstractJavaCodegen
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
supportingFiles.add(new SupportingFile("api_exception.mustache", apiExceptionFolder, "ApiException.java")); supportingFiles.add(new SupportingFile("api_exception.mustache", apiExceptionFolder, "ApiException.java"));
supportingFiles.add(new SupportingFile("api_exception_mapper.mustache", apiExceptionFolder, "ApiExceptionMapper.java")); supportingFiles.add(new SupportingFile("api_exception_mapper.mustache", apiExceptionFolder, "ApiExceptionMapper.java"));
serializationLibrary = "none"; if (getSerializationLibrary() == null) {
LOGGER.info("No serializationLibrary configured, using '{}' as fallback", SERIALIZATION_LIBRARY_JSONB);
setSerializationLibrary(SERIALIZATION_LIBRARY_JSONB);
} else if (getSerializationLibrary().equals(SERIALIZATION_LIBRARY_GSON)) {
forceSerializationLibrary(SERIALIZATION_LIBRARY_JSONB);
}
if (microprofileFramework.equals(MICROPROFILE_KUMULUZEE)) { if (microprofileFramework.equals(MICROPROFILE_KUMULUZEE)) {
supportingFiles.add(new SupportingFile("kumuluzee.pom.mustache", "", "pom.xml")); supportingFiles.add(new SupportingFile("kumuluzee.pom.mustache", "", "pom.xml"));
@ -1123,7 +1135,11 @@ public class JavaClientCodegen extends AbstractJavaCodegen
this.microprofileFramework = microprofileFramework; this.microprofileFramework = microprofileFramework;
} }
public void setConfigKey(String configKey) { public void setMicroprofileMutiny(boolean microprofileMutiny) {
this.microprofileMutiny = microprofileMutiny;
}
public void setConfigKey(String configKey) {
this.configKey = configKey; this.configKey = configKey;
} }

View File

@ -15,6 +15,9 @@ import {{rootJavaEEPackage}}.ws.rs.core.MediaType;
{{^disableMultipart}} {{^disableMultipart}}
import org.apache.cxf.jaxrs.ext.multipart.*; import org.apache.cxf.jaxrs.ext.multipart.*;
{{/disableMultipart}} {{/disableMultipart}}
{{#microprofileMutiny}}
import io.smallrye.mutiny.Uni;
{{/microprofileMutiny}}
{{#useBeanValidation}} {{#useBeanValidation}}
import {{javaxPackage}}.validation.constraints.*; import {{javaxPackage}}.validation.constraints.*;
@ -66,7 +69,7 @@ public interface {{classname}} {
{{#hasProduces}} {{#hasProduces}}
@Produces({ {{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}} }) @Produces({ {{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}} })
{{/hasProduces}} {{/hasProduces}}
public {{{returnType}}}{{^returnType}}void{{/returnType}} {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException, ProcessingException; {{^vendorExtensions.x-java-is-response-void}}{{#microprofileMutiny}}Uni<{{{returnType}}}>{{/microprofileMutiny}}{{^microprofileMutiny}}{{{returnType}}}{{/microprofileMutiny}}{{/vendorExtensions.x-java-is-response-void}}{{#vendorExtensions.x-java-is-response-void}}{{#microprofileMutiny}}Uni<Void>{{/microprofileMutiny}}{{^microprofileMutiny}}void{{/microprofileMutiny}}{{/vendorExtensions.x-java-is-response-void}} {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException, ProcessingException;
{{/operation}} {{/operation}}
} }
{{/operations}} {{/operations}}

View File

@ -72,7 +72,7 @@ public class {{classname}}Test {
{{#allParams}} {{#allParams}}
{{^isFile}}{{{dataType}}} {{paramName}} = null;{{/isFile}}{{#isFile}}org.apache.cxf.jaxrs.ext.multipart.Attachment {{paramName}} = null;{{/isFile}} {{^isFile}}{{{dataType}}} {{paramName}} = null;{{/isFile}}{{#isFile}}org.apache.cxf.jaxrs.ext.multipart.Attachment {{paramName}} = null;{{/isFile}}
{{/allParams}} {{/allParams}}
//{{#returnType}}{{{.}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); //{{^vendorExtensions.x-java-is-response-void}}{{#microprofileMutiny}}Uni<{{{returnType}}}>{{/microprofileMutiny}}{{^microprofileMutiny}}{{{returnType}}}{{/microprofileMutiny}} response = {{/vendorExtensions.x-java-is-response-void}}api.{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});
//{{#returnType}}assertNotNull(response);{{/returnType}} //{{#returnType}}assertNotNull(response);{{/returnType}}

View File

@ -3,8 +3,10 @@
@XmlEnum({{dataType}}.class) @XmlEnum({{dataType}}.class)
{{/withXml}} {{/withXml}}
{{^withXml}} {{^withXml}}
{{#jsonb}}
@JsonbTypeSerializer({{datatypeWithEnum}}.Serializer.class) @JsonbTypeSerializer({{datatypeWithEnum}}.Serializer.class)
@JsonbTypeDeserializer({{datatypeWithEnum}}.Deserializer.class) @JsonbTypeDeserializer({{datatypeWithEnum}}.Deserializer.class)
{{/jsonb}}
{{/withXml}} {{/withXml}}
{{>additionalEnumTypeAnnotations}}public enum {{datatypeWithEnum}} { {{>additionalEnumTypeAnnotations}}public enum {{datatypeWithEnum}} {
@ -24,6 +26,9 @@
value = v; value = v;
} }
{{#jackson}}
@JsonValue
{{/jackson}}
public {{dataType}} value() { public {{dataType}} value() {
return value; return value;
} }
@ -44,6 +49,7 @@
} }
{{/withXml}} {{/withXml}}
{{^withXml}} {{^withXml}}
{{#jsonb}}
public static final class Deserializer implements JsonbDeserializer<{{datatypeWithEnum}}> { public static final class Deserializer implements JsonbDeserializer<{{datatypeWithEnum}}> {
@Override @Override
public {{datatypeWithEnum}} deserialize(JsonParser parser, DeserializationContext ctx, Type rtType) { public {{datatypeWithEnum}} deserialize(JsonParser parser, DeserializationContext ctx, Type rtType) {
@ -62,5 +68,17 @@
generator.write(obj.value); generator.write(obj.value);
} }
} }
{{/jsonb}}
{{#jackson}}
@JsonCreator
public static {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} fromValue({{{dataType}}} value) {
for ({{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) {
if (b.value.equals(value)) {
return b;
}
}
{{#isNullable}}return null;{{/isNullable}}{{^isNullable}}throw new IllegalArgumentException("Unexpected value '" + value + "'");{{/isNullable}}
}
{{/jackson}}
{{/withXml}} {{/withXml}}
} }

View File

@ -156,6 +156,13 @@
<version>${jakarta.annotation.version}</version> <version>${jakarta.annotation.version}</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
{{#microprofileMutiny}}
<dependency>
<groupId>io.smallrye.reactive</groupId>
<artifactId>mutiny</artifactId>
<version>${mutiny.version}</version>
</dependency>
{{/microprofileMutiny}}
</dependencies> </dependencies>
<repositories> <repositories>
<repository> <repository>
@ -196,5 +203,8 @@
<maven.failsafe.plugin.version>2.6</maven.failsafe.plugin.version> <maven.failsafe.plugin.version>2.6</maven.failsafe.plugin.version>
<build.helper.maven.plugin.version>1.9.1</build.helper.maven.plugin.version> <build.helper.maven.plugin.version>1.9.1</build.helper.maven.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
{{#microprofileMutiny}}
<mutiny.version>1.2.0</mutiny.version>
{{/microprofileMutiny}}
</properties> </properties>
</project> </project>

View File

@ -1,4 +0,0 @@
{{#useGenericResponse}}Response{{/useGenericResponse}}{{! non-generic response:
}}{{^useGenericResponse}}{{!
}}{{{returnType}}}{{!
}}{{/useGenericResponse}}

View File

@ -52,7 +52,7 @@ public interface PetApi {
@Consumes({ "application/json", "application/xml" }) @Consumes({ "application/json", "application/xml" })
@Produces({ "application/xml", "application/json" }) @Produces({ "application/xml", "application/json" })
public Pet addPet(Pet pet) throws ApiException, ProcessingException; Pet addPet(Pet pet) throws ApiException, ProcessingException;
/** /**
* Deletes a pet * Deletes a pet
@ -62,7 +62,7 @@ public interface PetApi {
*/ */
@DELETE @DELETE
@Path("/{petId}") @Path("/{petId}")
public void deletePet(@PathParam("petId") Long petId, @HeaderParam("api_key") String apiKey) throws ApiException, ProcessingException; void deletePet(@PathParam("petId") Long petId, @HeaderParam("api_key") String apiKey) throws ApiException, ProcessingException;
/** /**
* Finds Pets by status * Finds Pets by status
@ -73,7 +73,7 @@ public interface PetApi {
@GET @GET
@Path("/findByStatus") @Path("/findByStatus")
@Produces({ "application/xml", "application/json" }) @Produces({ "application/xml", "application/json" })
public List<Pet> findPetsByStatus(@QueryParam("status") List<String> status) throws ApiException, ProcessingException; List<Pet> findPetsByStatus(@QueryParam("status") List<String> status) throws ApiException, ProcessingException;
/** /**
* Finds Pets by tags * Finds Pets by tags
@ -86,7 +86,7 @@ public interface PetApi {
@GET @GET
@Path("/findByTags") @Path("/findByTags")
@Produces({ "application/xml", "application/json" }) @Produces({ "application/xml", "application/json" })
public List<Pet> findPetsByTags(@QueryParam("tags") List<String> tags) throws ApiException, ProcessingException; List<Pet> findPetsByTags(@QueryParam("tags") List<String> tags) throws ApiException, ProcessingException;
/** /**
* Find pet by ID * Find pet by ID
@ -97,7 +97,7 @@ public interface PetApi {
@GET @GET
@Path("/{petId}") @Path("/{petId}")
@Produces({ "application/xml", "application/json" }) @Produces({ "application/xml", "application/json" })
public Pet getPetById(@PathParam("petId") Long petId) throws ApiException, ProcessingException; Pet getPetById(@PathParam("petId") Long petId) throws ApiException, ProcessingException;
/** /**
* Update an existing pet * Update an existing pet
@ -109,7 +109,7 @@ public interface PetApi {
@Consumes({ "application/json", "application/xml" }) @Consumes({ "application/json", "application/xml" })
@Produces({ "application/xml", "application/json" }) @Produces({ "application/xml", "application/json" })
public Pet updatePet(Pet pet) throws ApiException, ProcessingException; Pet updatePet(Pet pet) throws ApiException, ProcessingException;
/** /**
* Updates a pet in the store with form data * Updates a pet in the store with form data
@ -120,7 +120,7 @@ public interface PetApi {
@POST @POST
@Path("/{petId}") @Path("/{petId}")
@Consumes({ "application/x-www-form-urlencoded" }) @Consumes({ "application/x-www-form-urlencoded" })
public void updatePetWithForm(@PathParam("petId") Long petId, @Multipart(value = "name", required = false) String name, @Multipart(value = "status", required = false) String status) throws ApiException, ProcessingException; void updatePetWithForm(@PathParam("petId") Long petId, @Multipart(value = "name", required = false) String name, @Multipart(value = "status", required = false) String status) throws ApiException, ProcessingException;
/** /**
* uploads an image * uploads an image
@ -132,5 +132,5 @@ public interface PetApi {
@Path("/{petId}/uploadImage") @Path("/{petId}/uploadImage")
@Consumes({ "multipart/form-data" }) @Consumes({ "multipart/form-data" })
@Produces({ "application/json" }) @Produces({ "application/json" })
public ModelApiResponse uploadFile(@PathParam("petId") Long petId, @Multipart(value = "additionalMetadata", required = false) String additionalMetadata, @Multipart(value = "file" , required = false) Attachment _fileDetail) throws ApiException, ProcessingException; ModelApiResponse uploadFile(@PathParam("petId") Long petId, @Multipart(value = "additionalMetadata", required = false) String additionalMetadata, @Multipart(value = "file" , required = false) Attachment _fileDetail) throws ApiException, ProcessingException;
} }

View File

@ -48,7 +48,7 @@ public interface StoreApi {
*/ */
@DELETE @DELETE
@Path("/order/{orderId}") @Path("/order/{orderId}")
public void deleteOrder(@PathParam("orderId") String orderId) throws ApiException, ProcessingException; void deleteOrder(@PathParam("orderId") String orderId) throws ApiException, ProcessingException;
/** /**
* Returns pet inventories by status * Returns pet inventories by status
@ -59,7 +59,7 @@ public interface StoreApi {
@GET @GET
@Path("/inventory") @Path("/inventory")
@Produces({ "application/json" }) @Produces({ "application/json" })
public Map<String, Integer> getInventory() throws ApiException, ProcessingException; Map<String, Integer> getInventory() throws ApiException, ProcessingException;
/** /**
* Find purchase order by ID * Find purchase order by ID
@ -70,7 +70,7 @@ public interface StoreApi {
@GET @GET
@Path("/order/{orderId}") @Path("/order/{orderId}")
@Produces({ "application/xml", "application/json" }) @Produces({ "application/xml", "application/json" })
public Order getOrderById(@PathParam("orderId") Long orderId) throws ApiException, ProcessingException; Order getOrderById(@PathParam("orderId") Long orderId) throws ApiException, ProcessingException;
/** /**
* Place an order for a pet * Place an order for a pet
@ -82,5 +82,5 @@ public interface StoreApi {
@Path("/order") @Path("/order")
@Consumes({ "application/json" }) @Consumes({ "application/json" })
@Produces({ "application/xml", "application/json" }) @Produces({ "application/xml", "application/json" })
public Order placeOrder(Order order) throws ApiException, ProcessingException; Order placeOrder(Order order) throws ApiException, ProcessingException;
} }

View File

@ -50,7 +50,7 @@ public interface UserApi {
@POST @POST
@Consumes({ "application/json" }) @Consumes({ "application/json" })
public void createUser(User user) throws ApiException, ProcessingException; void createUser(User user) throws ApiException, ProcessingException;
/** /**
* Creates list of users with given input array * Creates list of users with given input array
@ -61,7 +61,7 @@ public interface UserApi {
@POST @POST
@Path("/createWithArray") @Path("/createWithArray")
@Consumes({ "application/json" }) @Consumes({ "application/json" })
public void createUsersWithArrayInput(List<User> user) throws ApiException, ProcessingException; void createUsersWithArrayInput(List<User> user) throws ApiException, ProcessingException;
/** /**
* Creates list of users with given input array * Creates list of users with given input array
@ -72,7 +72,7 @@ public interface UserApi {
@POST @POST
@Path("/createWithList") @Path("/createWithList")
@Consumes({ "application/json" }) @Consumes({ "application/json" })
public void createUsersWithListInput(List<User> user) throws ApiException, ProcessingException; void createUsersWithListInput(List<User> user) throws ApiException, ProcessingException;
/** /**
* Delete user * Delete user
@ -82,7 +82,7 @@ public interface UserApi {
*/ */
@DELETE @DELETE
@Path("/{username}") @Path("/{username}")
public void deleteUser(@PathParam("username") String username) throws ApiException, ProcessingException; void deleteUser(@PathParam("username") String username) throws ApiException, ProcessingException;
/** /**
* Get user by user name * Get user by user name
@ -93,7 +93,7 @@ public interface UserApi {
@GET @GET
@Path("/{username}") @Path("/{username}")
@Produces({ "application/xml", "application/json" }) @Produces({ "application/xml", "application/json" })
public User getUserByName(@PathParam("username") String username) throws ApiException, ProcessingException; User getUserByName(@PathParam("username") String username) throws ApiException, ProcessingException;
/** /**
* Logs user into the system * Logs user into the system
@ -104,7 +104,7 @@ public interface UserApi {
@GET @GET
@Path("/login") @Path("/login")
@Produces({ "application/xml", "application/json" }) @Produces({ "application/xml", "application/json" })
public String loginUser(@QueryParam("username") String username, @QueryParam("password") String password) throws ApiException, ProcessingException; String loginUser(@QueryParam("username") String username, @QueryParam("password") String password) throws ApiException, ProcessingException;
/** /**
* Logs out current logged in user session * Logs out current logged in user session
@ -114,7 +114,7 @@ public interface UserApi {
*/ */
@GET @GET
@Path("/logout") @Path("/logout")
public void logoutUser() throws ApiException, ProcessingException; void logoutUser() throws ApiException, ProcessingException;
/** /**
* Updated user * Updated user
@ -125,5 +125,5 @@ public interface UserApi {
@PUT @PUT
@Path("/{username}") @Path("/{username}")
@Consumes({ "application/json" }) @Consumes({ "application/json" })
public void updateUser(@PathParam("username") String username, User user) throws ApiException, ProcessingException; void updateUser(@PathParam("username") String username, User user) throws ApiException, ProcessingException;
} }

View File

@ -49,7 +49,7 @@ public interface PetApi {
@POST @POST
@Consumes({ "application/json", "application/xml" }) @Consumes({ "application/json", "application/xml" })
public void addPet(Pet body) throws ApiException, ProcessingException; void addPet(Pet body) throws ApiException, ProcessingException;
/** /**
* Deletes a pet * Deletes a pet
@ -57,7 +57,7 @@ public interface PetApi {
*/ */
@DELETE @DELETE
@Path("/{petId}") @Path("/{petId}")
public void deletePet(@PathParam("petId") Long petId, @HeaderParam("api_key") String apiKey) throws ApiException, ProcessingException; void deletePet(@PathParam("petId") Long petId, @HeaderParam("api_key") String apiKey) throws ApiException, ProcessingException;
/** /**
* Finds Pets by status * Finds Pets by status
@ -68,7 +68,7 @@ public interface PetApi {
@GET @GET
@Path("/findByStatus") @Path("/findByStatus")
@Produces({ "application/xml", "application/json" }) @Produces({ "application/xml", "application/json" })
public List<Pet> findPetsByStatus(@QueryParam("status") List<String> status) throws ApiException, ProcessingException; List<Pet> findPetsByStatus(@QueryParam("status") List<String> status) throws ApiException, ProcessingException;
/** /**
* Finds Pets by tags * Finds Pets by tags
@ -81,7 +81,7 @@ public interface PetApi {
@GET @GET
@Path("/findByTags") @Path("/findByTags")
@Produces({ "application/xml", "application/json" }) @Produces({ "application/xml", "application/json" })
public List<Pet> findPetsByTags(@QueryParam("tags") List<String> tags) throws ApiException, ProcessingException; List<Pet> findPetsByTags(@QueryParam("tags") List<String> tags) throws ApiException, ProcessingException;
/** /**
* Find pet by ID * Find pet by ID
@ -92,7 +92,7 @@ public interface PetApi {
@GET @GET
@Path("/{petId}") @Path("/{petId}")
@Produces({ "application/xml", "application/json" }) @Produces({ "application/xml", "application/json" })
public Pet getPetById(@PathParam("petId") Long petId) throws ApiException, ProcessingException; Pet getPetById(@PathParam("petId") Long petId) throws ApiException, ProcessingException;
/** /**
* Update an existing pet * Update an existing pet
@ -101,7 +101,7 @@ public interface PetApi {
@PUT @PUT
@Consumes({ "application/json", "application/xml" }) @Consumes({ "application/json", "application/xml" })
public void updatePet(Pet body) throws ApiException, ProcessingException; void updatePet(Pet body) throws ApiException, ProcessingException;
/** /**
* Updates a pet in the store with form data * Updates a pet in the store with form data
@ -110,7 +110,7 @@ public interface PetApi {
@POST @POST
@Path("/{petId}") @Path("/{petId}")
@Consumes({ "application/x-www-form-urlencoded" }) @Consumes({ "application/x-www-form-urlencoded" })
public void updatePetWithForm(@PathParam("petId") Long petId, @Multipart(value = "name", required = false) String name, @Multipart(value = "status", required = false) String status) throws ApiException, ProcessingException; void updatePetWithForm(@PathParam("petId") Long petId, @Multipart(value = "name", required = false) String name, @Multipart(value = "status", required = false) String status) throws ApiException, ProcessingException;
/** /**
* uploads an image * uploads an image
@ -120,5 +120,5 @@ public interface PetApi {
@Path("/{petId}/uploadImage") @Path("/{petId}/uploadImage")
@Consumes({ "multipart/form-data" }) @Consumes({ "multipart/form-data" })
@Produces({ "application/json" }) @Produces({ "application/json" })
public ModelApiResponse uploadFile(@PathParam("petId") Long petId, @Multipart(value = "additionalMetadata", required = false) String additionalMetadata, @Multipart(value = "file" , required = false) Attachment _fileDetail) throws ApiException, ProcessingException; ModelApiResponse uploadFile(@PathParam("petId") Long petId, @Multipart(value = "additionalMetadata", required = false) String additionalMetadata, @Multipart(value = "file" , required = false) Attachment _fileDetail) throws ApiException, ProcessingException;
} }

View File

@ -48,7 +48,7 @@ public interface StoreApi {
*/ */
@DELETE @DELETE
@Path("/order/{orderId}") @Path("/order/{orderId}")
public void deleteOrder(@PathParam("orderId") String orderId) throws ApiException, ProcessingException; void deleteOrder(@PathParam("orderId") String orderId) throws ApiException, ProcessingException;
/** /**
* Returns pet inventories by status * Returns pet inventories by status
@ -59,7 +59,7 @@ public interface StoreApi {
@GET @GET
@Path("/inventory") @Path("/inventory")
@Produces({ "application/json" }) @Produces({ "application/json" })
public Map<String, Integer> getInventory() throws ApiException, ProcessingException; Map<String, Integer> getInventory() throws ApiException, ProcessingException;
/** /**
* Find purchase order by ID * Find purchase order by ID
@ -70,7 +70,7 @@ public interface StoreApi {
@GET @GET
@Path("/order/{orderId}") @Path("/order/{orderId}")
@Produces({ "application/xml", "application/json" }) @Produces({ "application/xml", "application/json" })
public Order getOrderById(@PathParam("orderId") Long orderId) throws ApiException, ProcessingException; Order getOrderById(@PathParam("orderId") Long orderId) throws ApiException, ProcessingException;
/** /**
* Place an order for a pet * Place an order for a pet
@ -79,5 +79,5 @@ public interface StoreApi {
@POST @POST
@Path("/order") @Path("/order")
@Produces({ "application/xml", "application/json" }) @Produces({ "application/xml", "application/json" })
public Order placeOrder(Order body) throws ApiException, ProcessingException; Order placeOrder(Order body) throws ApiException, ProcessingException;
} }

View File

@ -49,7 +49,7 @@ public interface UserApi {
*/ */
@POST @POST
public void createUser(User body) throws ApiException, ProcessingException; void createUser(User body) throws ApiException, ProcessingException;
/** /**
* Creates list of users with given input array * Creates list of users with given input array
@ -57,7 +57,7 @@ public interface UserApi {
*/ */
@POST @POST
@Path("/createWithArray") @Path("/createWithArray")
public void createUsersWithArrayInput(List<User> body) throws ApiException, ProcessingException; void createUsersWithArrayInput(List<User> body) throws ApiException, ProcessingException;
/** /**
* Creates list of users with given input array * Creates list of users with given input array
@ -65,7 +65,7 @@ public interface UserApi {
*/ */
@POST @POST
@Path("/createWithList") @Path("/createWithList")
public void createUsersWithListInput(List<User> body) throws ApiException, ProcessingException; void createUsersWithListInput(List<User> body) throws ApiException, ProcessingException;
/** /**
* Delete user * Delete user
@ -75,7 +75,7 @@ public interface UserApi {
*/ */
@DELETE @DELETE
@Path("/{username}") @Path("/{username}")
public void deleteUser(@PathParam("username") String username) throws ApiException, ProcessingException; void deleteUser(@PathParam("username") String username) throws ApiException, ProcessingException;
/** /**
* Get user by user name * Get user by user name
@ -84,7 +84,7 @@ public interface UserApi {
@GET @GET
@Path("/{username}") @Path("/{username}")
@Produces({ "application/xml", "application/json" }) @Produces({ "application/xml", "application/json" })
public User getUserByName(@PathParam("username") String username) throws ApiException, ProcessingException; User getUserByName(@PathParam("username") String username) throws ApiException, ProcessingException;
/** /**
* Logs user into the system * Logs user into the system
@ -93,7 +93,7 @@ public interface UserApi {
@GET @GET
@Path("/login") @Path("/login")
@Produces({ "application/xml", "application/json" }) @Produces({ "application/xml", "application/json" })
public String loginUser(@QueryParam("username") String username, @QueryParam("password") String password) throws ApiException, ProcessingException; String loginUser(@QueryParam("username") String username, @QueryParam("password") String password) throws ApiException, ProcessingException;
/** /**
* Logs out current logged in user session * Logs out current logged in user session
@ -101,7 +101,7 @@ public interface UserApi {
*/ */
@GET @GET
@Path("/logout") @Path("/logout")
public void logoutUser() throws ApiException, ProcessingException; void logoutUser() throws ApiException, ProcessingException;
/** /**
* Updated user * Updated user
@ -111,5 +111,5 @@ public interface UserApi {
*/ */
@PUT @PUT
@Path("/{username}") @Path("/{username}")
public void updateUser(@PathParam("username") String username, User body) throws ApiException, ProcessingException; void updateUser(@PathParam("username") String username, User body) throws ApiException, ProcessingException;
} }

View File

@ -3,7 +3,6 @@ package org.openapitools.model;
import java.util.Objects; import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;