diff --git a/bin/jaxrs-spec-petstore-server-interface-returning-response.sh b/bin/jaxrs-spec-petstore-server-interface-returning-response.sh new file mode 100755 index 000000000000..976677b10199 --- /dev/null +++ b/bin/jaxrs-spec-petstore-server-interface-returning-response.sh @@ -0,0 +1,35 @@ +#!/bin/sh + +SCRIPT="$0" + +while [ -h "$SCRIPT" ] ; do + ls=`ls -ld "$SCRIPT"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + SCRIPT="$link" + else + SCRIPT=`dirname "$SCRIPT"`/"$link" + fi +done + +if [ ! -d "${APP_DIR}" ]; then + APP_DIR=`dirname "$SCRIPT"`/.. + APP_DIR=`cd "${APP_DIR}"; pwd` +fi + +executable="./modules/swagger-codegen-cli/target/swagger-codegen-cli.jar" + +if [ ! -f "$executable" ] +then + mvn clean package +fi + +# if you've executed sbt assembly previously it will use that instead. +export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l jaxrs-spec -o samples/server/petstore/jaxrs-spec-interface-response +-DhideGenerationTimestamp=true +-DserializableModel=true +-DinterfaceOnly=true +-DreturnResponse=true" + +java $JAVA_OPTS -jar $executable $ags diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaJAXRSSpecServerCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaJAXRSSpecServerCodegen.java index f48b4e34097e..3d66995f3865 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaJAXRSSpecServerCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaJAXRSSpecServerCodegen.java @@ -23,9 +23,11 @@ public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen { public static final String INTERFACE_ONLY = "interfaceOnly"; + public static final String RETURN_RESPONSE = "returnResponse"; public static final String GENERATE_POM = "generatePom"; private boolean interfaceOnly = false; + private boolean returnResponse = false; private boolean generatePom = true; public JavaJAXRSSpecServerCodegen() @@ -75,6 +77,7 @@ public JavaJAXRSSpecServerCodegen() cliOptions.add(library); cliOptions.add(CliOption.newBoolean(GENERATE_POM, "Whether to generate pom.xml if the file does not already exist.").defaultValue(String.valueOf(generatePom))); cliOptions.add(CliOption.newBoolean(INTERFACE_ONLY, "Whether to generate only API interface stubs without the server files.").defaultValue(String.valueOf(interfaceOnly))); + cliOptions.add(CliOption.newBoolean(RETURN_RESPONSE, "Whether generate API interface should return javax.ws.rs.core.Response instead of a deserialized entity. Only useful if interfaceOnly is true.").defaultValue(String.valueOf(returnResponse))); } @Override @@ -89,6 +92,12 @@ public void processOpts() additionalProperties.remove(INTERFACE_ONLY); } } + if (additionalProperties.containsKey(RETURN_RESPONSE)) { + returnResponse = Boolean.valueOf(additionalProperties.get(RETURN_RESPONSE).toString()); + if (!returnResponse) { + additionalProperties.remove(RETURN_RESPONSE); + } + } if (interfaceOnly) { // Change default artifactId if genereating interfaces only, before command line options are applied in base class. artifactId = "swagger-jaxrs-client"; diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/spec/apiInterface.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/spec/apiInterface.mustache index 6d786768986f..0463921182e2 100644 --- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/spec/apiInterface.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/spec/apiInterface.mustache @@ -11,4 +11,4 @@ }{{/hasAuthMethods}}, tags={ {{#vendorExtensions.x-tags}}"{{tag}}"{{#hasMore}}, {{/hasMore}}{{/vendorExtensions.x-tags}} }) @ApiResponses(value = { {{#responses}} @ApiResponse(code = {{{code}}}, message = "{{{message}}}", response = {{{baseType}}}.class{{#returnContainer}}, responseContainer = "{{{returnContainer}}}"{{/returnContainer}}){{#hasMore}},{{/hasMore}}{{/responses}} }) - {{>returnTypeInterface}} {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}},{{/hasMore}}{{/allParams}}); \ No newline at end of file + {{#returnResponse}}Response{{/returnResponse}}{{^returnResponse}}{{>returnTypeInterface}}{{/returnResponse}} {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}},{{/hasMore}}{{/allParams}}); \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/spec/apiMethod.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/spec/apiMethod.mustache index d4ab5850ac26..01ac3fc907d1 100644 --- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/spec/apiMethod.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/spec/apiMethod.mustache @@ -10,7 +10,8 @@ {{/hasMore}}{{/authMethods}} }{{/hasAuthMethods}}, tags={ {{#vendorExtensions.x-tags}}"{{tag}}"{{#hasMore}}, {{/hasMore}}{{/vendorExtensions.x-tags}} }) @ApiResponses(value = { {{#responses}} - @ApiResponse(code = {{{code}}}, message = "{{{message}}}", response = {{{baseType}}}.class{{#containerType}}, responseContainer = "{{{containerType}}}"{{/containerType}}){{#hasMore}},{{/hasMore}}{{/responses}} }) + @ApiResponse(code = {{{code}}}, message = "{{{message}}}", response = {{{baseType}}}.class{{#containerType}}, responseContainer = "{{{containerType}}}"{{/containerType}}){{#hasMore}},{{/hasMore}}{{/responses}} + }) public Response {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}},{{/hasMore}}{{/allParams}}) { return Response.ok().entity("magic!").build(); } \ No newline at end of file diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/languages/JavaJAXRSSpecServerCodegenTest.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/languages/JavaJAXRSSpecServerCodegenTest.java index fe42e33e255a..7796dbb67468 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/languages/JavaJAXRSSpecServerCodegenTest.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/languages/JavaJAXRSSpecServerCodegenTest.java @@ -63,6 +63,20 @@ public void verify_that_generatePom_exists_as_a_parameter_with_default_true() { Assert.fail("Missing " + JavaJAXRSSpecServerCodegen.GENERATE_POM); } + @Test + public void verify_that_returnResponse_is_removed_from_additional_properties_if_false() { + generator.additionalProperties().put(JavaJAXRSSpecServerCodegen.RETURN_RESPONSE, Boolean.FALSE.toString()); + generator.processOpts(); + Assert.assertFalse(generator.additionalProperties().containsKey(JavaJAXRSSpecServerCodegen.RETURN_RESPONSE)); + } + + @Test + public void verify_that_returnResponse_is_preserved_in_additional_properties_if_true() { + generator.additionalProperties().put(JavaJAXRSSpecServerCodegen.RETURN_RESPONSE, Boolean.TRUE.toString()); + generator.processOpts(); + Assert.assertTrue(generator.additionalProperties().containsKey(JavaJAXRSSpecServerCodegen.RETURN_RESPONSE)); + } + @Test public void verify_that_interfaceOnly_exists_as_a_parameter_with_default_false() { for (CliOption option : generator.cliOptions()) { diff --git a/samples/server/petstore/jaxrs-spec-interface-response/.swagger-codegen-ignore b/samples/server/petstore/jaxrs-spec-interface-response/.swagger-codegen-ignore new file mode 100644 index 000000000000..c5fa491b4c55 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-interface-response/.swagger-codegen-ignore @@ -0,0 +1,23 @@ +# Swagger Codegen Ignore +# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/server/petstore/jaxrs-spec-interface-response/.swagger-codegen/VERSION b/samples/server/petstore/jaxrs-spec-interface-response/.swagger-codegen/VERSION new file mode 100644 index 000000000000..855ff9501eb8 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-interface-response/.swagger-codegen/VERSION @@ -0,0 +1 @@ +2.4.0-SNAPSHOT \ No newline at end of file diff --git a/samples/server/petstore/jaxrs-spec-interface-response/pom.xml b/samples/server/petstore/jaxrs-spec-interface-response/pom.xml new file mode 100644 index 000000000000..a32dafce9eec --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-interface-response/pom.xml @@ -0,0 +1,48 @@ + + 4.0.0 + io.swagger + swagger-jaxrs-client + jar + swagger-jaxrs-client + 1.0.0 + + src/main/java + + + org.apache.maven.plugins + maven-jar-plugin + 2.2 + + + + + + javax.ws.rs + javax.ws.rs-api + 2.0 + provided + + + io.swagger + swagger-annotations + provided + 1.5.3 + + + junit + junit + ${junit-version} + test + + + + javax.validation + validation-api + 1.1.0.Final + provided + + + + 4.8.1 + + diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/api/AnotherFakeApi.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/api/AnotherFakeApi.java new file mode 100644 index 000000000000..f6b65ca9b006 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/api/AnotherFakeApi.java @@ -0,0 +1,27 @@ +package io.swagger.api; + +import io.swagger.model.Client; + +import javax.ws.rs.*; +import javax.ws.rs.core.Response; + +import io.swagger.annotations.*; + +import java.util.Map; +import java.util.List; +import javax.validation.constraints.*; +import javax.validation.Valid; + +@Path("/another-fake") +@Api(description = "the another-fake API") +public interface AnotherFakeApi { + + @PATCH + @Path("/dummy") + @Consumes({ "application/json" }) + @Produces({ "application/json" }) + @ApiOperation(value = "To test special tags", notes = "To test special tags", tags={ "$another-fake?" }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + Response testSpecialTags(@Valid Client body); +} diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/api/FakeApi.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/api/FakeApi.java new file mode 100644 index 000000000000..4b6a925ba9a7 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/api/FakeApi.java @@ -0,0 +1,94 @@ +package io.swagger.api; + +import java.math.BigDecimal; +import io.swagger.model.Client; +import java.util.Date; +import org.joda.time.LocalDate; +import io.swagger.model.OuterComposite; + +import javax.ws.rs.*; +import javax.ws.rs.core.Response; + +import io.swagger.annotations.*; + +import java.util.Map; +import java.util.List; +import javax.validation.constraints.*; +import javax.validation.Valid; + +@Path("/fake") +@Api(description = "the fake API") +public interface FakeApi { + + @POST + @Path("/outer/boolean") + @ApiOperation(value = "", notes = "Test serialization of outer boolean types", tags={ "fake", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Output boolean", response = Boolean.class) }) + Response fakeOuterBooleanSerialize(@Valid Boolean body); + + @POST + @Path("/outer/composite") + @ApiOperation(value = "", notes = "Test serialization of object with outer number type", tags={ "fake", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Output composite", response = OuterComposite.class) }) + Response fakeOuterCompositeSerialize(@Valid OuterComposite body); + + @POST + @Path("/outer/number") + @ApiOperation(value = "", notes = "Test serialization of outer number types", tags={ "fake", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Output number", response = BigDecimal.class) }) + Response fakeOuterNumberSerialize(@Valid BigDecimal body); + + @POST + @Path("/outer/string") + @ApiOperation(value = "", notes = "Test serialization of outer string types", tags={ "fake", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Output string", response = String.class) }) + Response fakeOuterStringSerialize(@Valid String body); + + @PATCH + @Consumes({ "application/json" }) + @Produces({ "application/json" }) + @ApiOperation(value = "To test \"client\" model", notes = "To test \"client\" model", tags={ "fake", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + Response testClientModel(@Valid Client body); + + @POST + @Consumes({ "application/xml; charset=utf-8", "application/json; charset=utf-8" }) + @Produces({ "application/xml; charset=utf-8", "application/json; charset=utf-8" }) + @ApiOperation(value = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", notes = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", authorizations = { + @Authorization(value = "http_basic_test") + }, tags={ "fake", }) + @ApiResponses(value = { + @ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), + @ApiResponse(code = 404, message = "User not found", response = Void.class) }) + 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") byte[] binary,@FormParam(value = "date") LocalDate date,@FormParam(value = "dateTime") Date dateTime,@FormParam(value = "password") String password,@FormParam(value = "callback") String paramCallback); + + @GET + @Consumes({ "*/*" }) + @Produces({ "*/*" }) + @ApiOperation(value = "To test enum parameters", notes = "To test enum parameters", tags={ "fake", }) + @ApiResponses(value = { + @ApiResponse(code = 400, message = "Invalid request", response = Void.class), + @ApiResponse(code = 404, message = "Not found", response = Void.class) }) + Response testEnumParameters(@FormParam(value = "enum_form_string_array") List enumFormStringArray,@FormParam(value = "enum_form_string") String enumFormString,@HeaderParam("enum_header_string_array") @ApiParam("Header parameter enum test (string array)") List enumHeaderStringArray,@HeaderParam("enum_header_string") @DefaultValue("-efg") @ApiParam("Header parameter enum test (string)") String enumHeaderString,@QueryParam("enum_query_string_array") @ApiParam("Query parameter enum test (string array)") List enumQueryStringArray,@QueryParam("enum_query_string") @DefaultValue("-efg") @ApiParam("Query parameter enum test (string)") String enumQueryString,@QueryParam("enum_query_integer") @ApiParam("Query parameter enum test (double)") Integer enumQueryInteger,@FormParam(value = "enum_query_double") Double enumQueryDouble); + + @POST + @Path("/inline-additionalProperties") + @Consumes({ "application/json" }) + @ApiOperation(value = "test inline additionalProperties", notes = "", tags={ "fake", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + Response testInlineAdditionalProperties(@Valid Object param); + + @GET + @Path("/jsonFormData") + @Consumes({ "application/json" }) + @ApiOperation(value = "test json serialization of form data", notes = "", tags={ "fake" }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + Response testJsonFormData(@FormParam(value = "param") String param,@FormParam(value = "param2") String param2); +} diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/api/FakeClassnameTestApi.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/api/FakeClassnameTestApi.java new file mode 100644 index 000000000000..8c4188d5b1ba --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/api/FakeClassnameTestApi.java @@ -0,0 +1,28 @@ +package io.swagger.api; + +import io.swagger.model.Client; + +import javax.ws.rs.*; +import javax.ws.rs.core.Response; + +import io.swagger.annotations.*; + +import java.util.Map; +import java.util.List; +import javax.validation.constraints.*; +import javax.validation.Valid; + +@Path("/fake_classname_test") +@Api(description = "the fake_classname_test API") +public interface FakeClassnameTestApi { + + @PATCH + @Consumes({ "application/json" }) + @Produces({ "application/json" }) + @ApiOperation(value = "To test class name in snake case", notes = "", authorizations = { + @Authorization(value = "api_key_query") + }, tags={ "fake_classname_tags 123#$%^" }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + Response testClassname(@Valid Client body); +} diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/api/PetApi.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/api/PetApi.java new file mode 100644 index 000000000000..5fed5aea67d5 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/api/PetApi.java @@ -0,0 +1,130 @@ +package io.swagger.api; + +import java.io.File; +import io.swagger.model.ModelApiResponse; +import io.swagger.model.Pet; + +import javax.ws.rs.*; +import javax.ws.rs.core.Response; + +import io.swagger.annotations.*; + +import java.util.Map; +import java.util.List; +import javax.validation.constraints.*; +import javax.validation.Valid; + +@Path("/pet") +@Api(description = "the pet API") +public interface PetApi { + + @POST + @Consumes({ "application/json", "application/xml" }) + @Produces({ "application/xml", "application/json" }) + @ApiOperation(value = "Add a new pet to the store", notes = "", authorizations = { + @Authorization(value = "petstore_auth", scopes = { + @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), + @AuthorizationScope(scope = "read:pets", description = "read your pets") + }) + }, tags={ "pet", }) + @ApiResponses(value = { + @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) + Response addPet(@Valid Pet body); + + @DELETE + @Path("/{petId}") + @Produces({ "application/xml", "application/json" }) + @ApiOperation(value = "Deletes a pet", notes = "", authorizations = { + @Authorization(value = "petstore_auth", scopes = { + @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), + @AuthorizationScope(scope = "read:pets", description = "read your pets") + }) + }, tags={ "pet", }) + @ApiResponses(value = { + @ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) }) + Response deletePet(@PathParam("petId") @ApiParam("Pet id to delete") Long petId,@HeaderParam("api_key") String apiKey); + + @GET + @Path("/findByStatus") + @Produces({ "application/xml", "application/json" }) + @ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma separated strings", authorizations = { + @Authorization(value = "petstore_auth", scopes = { + @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), + @AuthorizationScope(scope = "read:pets", description = "read your pets") + }) + }, tags={ "pet", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"), + @ApiResponse(code = 400, message = "Invalid status value", response = Void.class, responseContainer = "List") }) + Response findPetsByStatus(@QueryParam("status") @NotNull @ApiParam("Status values that need to be considered for filter") List status); + + @GET + @Path("/findByTags") + @Produces({ "application/xml", "application/json" }) + @ApiOperation(value = "Finds Pets by tags", notes = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", authorizations = { + @Authorization(value = "petstore_auth", scopes = { + @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), + @AuthorizationScope(scope = "read:pets", description = "read your pets") + }) + }, tags={ "pet", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"), + @ApiResponse(code = 400, message = "Invalid tag value", response = Void.class, responseContainer = "List") }) + Response findPetsByTags(@QueryParam("tags") @NotNull @ApiParam("Tags to filter by") List tags); + + @GET + @Path("/{petId}") + @Produces({ "application/xml", "application/json" }) + @ApiOperation(value = "Find pet by ID", notes = "Returns a single pet", authorizations = { + @Authorization(value = "api_key") + }, tags={ "pet", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Pet.class), + @ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), + @ApiResponse(code = 404, message = "Pet not found", response = Void.class) }) + Response getPetById(@PathParam("petId") @ApiParam("ID of pet to return") Long petId); + + @PUT + @Consumes({ "application/json", "application/xml" }) + @Produces({ "application/xml", "application/json" }) + @ApiOperation(value = "Update an existing pet", notes = "", authorizations = { + @Authorization(value = "petstore_auth", scopes = { + @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), + @AuthorizationScope(scope = "read:pets", description = "read your pets") + }) + }, tags={ "pet", }) + @ApiResponses(value = { + @ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), + @ApiResponse(code = 404, message = "Pet not found", response = Void.class), + @ApiResponse(code = 405, message = "Validation exception", response = Void.class) }) + Response updatePet(@Valid Pet body); + + @POST + @Path("/{petId}") + @Consumes({ "application/x-www-form-urlencoded" }) + @Produces({ "application/xml", "application/json" }) + @ApiOperation(value = "Updates a pet in the store with form data", notes = "", authorizations = { + @Authorization(value = "petstore_auth", scopes = { + @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), + @AuthorizationScope(scope = "read:pets", description = "read your pets") + }) + }, tags={ "pet", }) + @ApiResponses(value = { + @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) + Response updatePetWithForm(@PathParam("petId") @ApiParam("ID of pet that needs to be updated") Long petId,@FormParam(value = "name") String name,@FormParam(value = "status") String status); + + @POST + @Path("/{petId}/uploadImage") + @Consumes({ "multipart/form-data" }) + @Produces({ "application/json" }) + @ApiOperation(value = "uploads an image", notes = "", authorizations = { + @Authorization(value = "petstore_auth", scopes = { + @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), + @AuthorizationScope(scope = "read:pets", description = "read your pets") + }) + }, tags={ "pet" }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) }) + Response uploadFile(@PathParam("petId") @ApiParam("ID of pet to update") Long petId,@FormParam(value = "additionalMetadata") String additionalMetadata, @FormParam(value = "file") InputStream fileInputStream, + @FormParam(value = "file") Attachment fileDetail); +} diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/api/StoreApi.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/api/StoreApi.java new file mode 100644 index 000000000000..27d17837aa9d --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/api/StoreApi.java @@ -0,0 +1,57 @@ +package io.swagger.api; + +import java.util.Map; +import io.swagger.model.Order; + +import javax.ws.rs.*; +import javax.ws.rs.core.Response; + +import io.swagger.annotations.*; + +import java.util.Map; +import java.util.List; +import javax.validation.constraints.*; +import javax.validation.Valid; + +@Path("/store") +@Api(description = "the store API") +public interface StoreApi { + + @DELETE + @Path("/order/{order_id}") + @Produces({ "application/xml", "application/json" }) + @ApiOperation(value = "Delete purchase order by ID", notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", tags={ "store", }) + @ApiResponses(value = { + @ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), + @ApiResponse(code = 404, message = "Order not found", response = Void.class) }) + Response deleteOrder(@PathParam("order_id") @ApiParam("ID of the order that needs to be deleted") String orderId); + + @GET + @Path("/inventory") + @Produces({ "application/json" }) + @ApiOperation(value = "Returns pet inventories by status", notes = "Returns a map of status codes to quantities", authorizations = { + @Authorization(value = "api_key") + }, tags={ "store", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Map.class, responseContainer = "Map") }) + Response getInventory(); + + @GET + @Path("/order/{order_id}") + @Produces({ "application/xml", "application/json" }) + @ApiOperation(value = "Find purchase order by ID", notes = "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", tags={ "store", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Order.class), + @ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), + @ApiResponse(code = 404, message = "Order not found", response = Void.class) }) + Response getOrderById(@PathParam("order_id") @Min(1L) @Max(5L) @ApiParam("ID of pet that needs to be fetched") Long orderId); + + @POST + @Path("/order") + @Produces({ "application/xml", "application/json" }) + @ApiOperation(value = "Place an order for a pet", notes = "", tags={ "store" }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Order.class), + @ApiResponse(code = 400, message = "Invalid Order", response = Void.class) }) + Response placeOrder(@Valid Order body); +} diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/api/UserApi.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/api/UserApi.java new file mode 100644 index 000000000000..55709a0f4d3b --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/api/UserApi.java @@ -0,0 +1,87 @@ +package io.swagger.api; + +import java.util.List; +import io.swagger.model.User; + +import javax.ws.rs.*; +import javax.ws.rs.core.Response; + +import io.swagger.annotations.*; + +import java.util.Map; +import java.util.List; +import javax.validation.constraints.*; +import javax.validation.Valid; + +@Path("/user") +@Api(description = "the user API") +public interface UserApi { + + @POST + @Produces({ "application/xml", "application/json" }) + @ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", tags={ "user", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + Response createUser(@Valid User body); + + @POST + @Path("/createWithArray") + @Produces({ "application/xml", "application/json" }) + @ApiOperation(value = "Creates list of users with given input array", notes = "", tags={ "user", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + Response createUsersWithArrayInput(@Valid List body); + + @POST + @Path("/createWithList") + @Produces({ "application/xml", "application/json" }) + @ApiOperation(value = "Creates list of users with given input array", notes = "", tags={ "user", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + Response createUsersWithListInput(@Valid List body); + + @DELETE + @Path("/{username}") + @Produces({ "application/xml", "application/json" }) + @ApiOperation(value = "Delete user", notes = "This can only be done by the logged in user.", tags={ "user", }) + @ApiResponses(value = { + @ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), + @ApiResponse(code = 404, message = "User not found", response = Void.class) }) + Response deleteUser(@PathParam("username") @ApiParam("The name that needs to be deleted") String username); + + @GET + @Path("/{username}") + @Produces({ "application/xml", "application/json" }) + @ApiOperation(value = "Get user by user name", notes = "", tags={ "user", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = User.class), + @ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), + @ApiResponse(code = 404, message = "User not found", response = Void.class) }) + Response getUserByName(@PathParam("username") @ApiParam("The name that needs to be fetched. Use user1 for testing. ") String username); + + @GET + @Path("/login") + @Produces({ "application/xml", "application/json" }) + @ApiOperation(value = "Logs user into the system", notes = "", tags={ "user", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = String.class), + @ApiResponse(code = 400, message = "Invalid username/password supplied", response = Void.class) }) + Response loginUser(@QueryParam("username") @NotNull @ApiParam("The user name for login") String username,@QueryParam("password") @NotNull @ApiParam("The password for login in clear text") String password); + + @GET + @Path("/logout") + @Produces({ "application/xml", "application/json" }) + @ApiOperation(value = "Logs out current logged in user session", notes = "", tags={ "user", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + Response logoutUser(); + + @PUT + @Path("/{username}") + @Produces({ "application/xml", "application/json" }) + @ApiOperation(value = "Updated user", notes = "This can only be done by the logged in user.", tags={ "user" }) + @ApiResponses(value = { + @ApiResponse(code = 400, message = "Invalid user supplied", response = Void.class), + @ApiResponse(code = 404, message = "User not found", response = Void.class) }) + Response updateUser(@PathParam("username") @ApiParam("name that need to be deleted") String username,@Valid User body); +} diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/AdditionalPropertiesClass.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/AdditionalPropertiesClass.java new file mode 100644 index 000000000000..6aa5fc2b980a --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/AdditionalPropertiesClass.java @@ -0,0 +1,96 @@ +package io.swagger.model; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; + + +public class AdditionalPropertiesClass implements Serializable { + + private @Valid Map mapProperty = new HashMap(); + private @Valid Map> mapOfMapProperty = new HashMap>(); + + /** + **/ + public AdditionalPropertiesClass mapProperty(Map mapProperty) { + this.mapProperty = mapProperty; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("map_property") + public Map getMapProperty() { + return mapProperty; + } + public void setMapProperty(Map mapProperty) { + this.mapProperty = mapProperty; + } + + /** + **/ + public AdditionalPropertiesClass mapOfMapProperty(Map> mapOfMapProperty) { + this.mapOfMapProperty = mapOfMapProperty; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("map_of_map_property") + public Map> getMapOfMapProperty() { + return mapOfMapProperty; + } + public void setMapOfMapProperty(Map> mapOfMapProperty) { + this.mapOfMapProperty = mapOfMapProperty; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalPropertiesClass additionalPropertiesClass = (AdditionalPropertiesClass) o; + return Objects.equals(mapProperty, additionalPropertiesClass.mapProperty) && + Objects.equals(mapOfMapProperty, additionalPropertiesClass.mapOfMapProperty); + } + + @Override + public int hashCode() { + return Objects.hash(mapProperty, mapOfMapProperty); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalPropertiesClass {\n"); + + sb.append(" mapProperty: ").append(toIndentedString(mapProperty)).append("\n"); + sb.append(" mapOfMapProperty: ").append(toIndentedString(mapOfMapProperty)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/Animal.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/Animal.java new file mode 100644 index 000000000000..bb54e9cad226 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/Animal.java @@ -0,0 +1,96 @@ +package io.swagger.model; + +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; + + +public class Animal implements Serializable { + + private @Valid String className = null; + private @Valid String color = "red"; + + /** + **/ + public Animal className(String className) { + this.className = className; + return this; + } + + + @ApiModelProperty(required = true, value = "") + @JsonProperty("className") + @NotNull + public String getClassName() { + return className; + } + public void setClassName(String className) { + this.className = className; + } + + /** + **/ + public Animal color(String color) { + this.color = color; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("color") + public String getColor() { + return color; + } + public void setColor(String color) { + this.color = color; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Animal animal = (Animal) o; + return Objects.equals(className, animal.className) && + Objects.equals(color, animal.color); + } + + @Override + public int hashCode() { + return Objects.hash(className, color); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Animal {\n"); + + sb.append(" className: ").append(toIndentedString(className)).append("\n"); + sb.append(" color: ").append(toIndentedString(color)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/AnimalFarm.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/AnimalFarm.java new file mode 100644 index 000000000000..f14a33d343ea --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/AnimalFarm.java @@ -0,0 +1,57 @@ +package io.swagger.model; + +import io.swagger.model.Animal; +import java.util.ArrayList; +import java.util.List; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; + + +public class AnimalFarm extends ArrayList implements Serializable { + + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AnimalFarm animalFarm = (AnimalFarm) o; + return true; + } + + @Override + public int hashCode() { + return Objects.hash(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AnimalFarm {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java new file mode 100644 index 000000000000..0be064503175 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java @@ -0,0 +1,76 @@ +package io.swagger.model; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; + + +public class ArrayOfArrayOfNumberOnly implements Serializable { + + private @Valid List> arrayArrayNumber = new ArrayList>(); + + /** + **/ + public ArrayOfArrayOfNumberOnly arrayArrayNumber(List> arrayArrayNumber) { + this.arrayArrayNumber = arrayArrayNumber; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("ArrayArrayNumber") + public List> getArrayArrayNumber() { + return arrayArrayNumber; + } + public void setArrayArrayNumber(List> arrayArrayNumber) { + this.arrayArrayNumber = arrayArrayNumber; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly = (ArrayOfArrayOfNumberOnly) o; + return Objects.equals(arrayArrayNumber, arrayOfArrayOfNumberOnly.arrayArrayNumber); + } + + @Override + public int hashCode() { + return Objects.hash(arrayArrayNumber); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayOfArrayOfNumberOnly {\n"); + + sb.append(" arrayArrayNumber: ").append(toIndentedString(arrayArrayNumber)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/ArrayOfNumberOnly.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/ArrayOfNumberOnly.java new file mode 100644 index 000000000000..c131d2c633a5 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/ArrayOfNumberOnly.java @@ -0,0 +1,76 @@ +package io.swagger.model; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; + + +public class ArrayOfNumberOnly implements Serializable { + + private @Valid List arrayNumber = new ArrayList(); + + /** + **/ + public ArrayOfNumberOnly arrayNumber(List arrayNumber) { + this.arrayNumber = arrayNumber; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("ArrayNumber") + public List getArrayNumber() { + return arrayNumber; + } + public void setArrayNumber(List arrayNumber) { + this.arrayNumber = arrayNumber; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ArrayOfNumberOnly arrayOfNumberOnly = (ArrayOfNumberOnly) o; + return Objects.equals(arrayNumber, arrayOfNumberOnly.arrayNumber); + } + + @Override + public int hashCode() { + return Objects.hash(arrayNumber); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayOfNumberOnly {\n"); + + sb.append(" arrayNumber: ").append(toIndentedString(arrayNumber)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/ArrayTest.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/ArrayTest.java new file mode 100644 index 000000000000..1720cde126c0 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/ArrayTest.java @@ -0,0 +1,116 @@ +package io.swagger.model; + +import io.swagger.model.ReadOnlyFirst; +import java.util.ArrayList; +import java.util.List; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; + + +public class ArrayTest implements Serializable { + + private @Valid List arrayOfString = new ArrayList(); + private @Valid List> arrayArrayOfInteger = new ArrayList>(); + private @Valid List> arrayArrayOfModel = new ArrayList>(); + + /** + **/ + public ArrayTest arrayOfString(List arrayOfString) { + this.arrayOfString = arrayOfString; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("array_of_string") + public List getArrayOfString() { + return arrayOfString; + } + public void setArrayOfString(List arrayOfString) { + this.arrayOfString = arrayOfString; + } + + /** + **/ + public ArrayTest arrayArrayOfInteger(List> arrayArrayOfInteger) { + this.arrayArrayOfInteger = arrayArrayOfInteger; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("array_array_of_integer") + public List> getArrayArrayOfInteger() { + return arrayArrayOfInteger; + } + public void setArrayArrayOfInteger(List> arrayArrayOfInteger) { + this.arrayArrayOfInteger = arrayArrayOfInteger; + } + + /** + **/ + public ArrayTest arrayArrayOfModel(List> arrayArrayOfModel) { + this.arrayArrayOfModel = arrayArrayOfModel; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("array_array_of_model") + public List> getArrayArrayOfModel() { + return arrayArrayOfModel; + } + public void setArrayArrayOfModel(List> arrayArrayOfModel) { + this.arrayArrayOfModel = arrayArrayOfModel; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ArrayTest arrayTest = (ArrayTest) o; + return Objects.equals(arrayOfString, arrayTest.arrayOfString) && + Objects.equals(arrayArrayOfInteger, arrayTest.arrayArrayOfInteger) && + Objects.equals(arrayArrayOfModel, arrayTest.arrayArrayOfModel); + } + + @Override + public int hashCode() { + return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayTest {\n"); + + sb.append(" arrayOfString: ").append(toIndentedString(arrayOfString)).append("\n"); + sb.append(" arrayArrayOfInteger: ").append(toIndentedString(arrayArrayOfInteger)).append("\n"); + sb.append(" arrayArrayOfModel: ").append(toIndentedString(arrayArrayOfModel)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/Capitalization.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/Capitalization.java new file mode 100644 index 000000000000..00402e4788ab --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/Capitalization.java @@ -0,0 +1,174 @@ +package io.swagger.model; + +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; + + +public class Capitalization implements Serializable { + + private @Valid String smallCamel = null; + private @Valid String capitalCamel = null; + private @Valid String smallSnake = null; + private @Valid String capitalSnake = null; + private @Valid String scAETHFlowPoints = null; + private @Valid String ATT_NAME = null; + + /** + **/ + public Capitalization smallCamel(String smallCamel) { + this.smallCamel = smallCamel; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("smallCamel") + public String getSmallCamel() { + return smallCamel; + } + public void setSmallCamel(String smallCamel) { + this.smallCamel = smallCamel; + } + + /** + **/ + public Capitalization capitalCamel(String capitalCamel) { + this.capitalCamel = capitalCamel; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("CapitalCamel") + public String getCapitalCamel() { + return capitalCamel; + } + public void setCapitalCamel(String capitalCamel) { + this.capitalCamel = capitalCamel; + } + + /** + **/ + public Capitalization smallSnake(String smallSnake) { + this.smallSnake = smallSnake; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("small_Snake") + public String getSmallSnake() { + return smallSnake; + } + public void setSmallSnake(String smallSnake) { + this.smallSnake = smallSnake; + } + + /** + **/ + public Capitalization capitalSnake(String capitalSnake) { + this.capitalSnake = capitalSnake; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("Capital_Snake") + public String getCapitalSnake() { + return capitalSnake; + } + public void setCapitalSnake(String capitalSnake) { + this.capitalSnake = capitalSnake; + } + + /** + **/ + public Capitalization scAETHFlowPoints(String scAETHFlowPoints) { + this.scAETHFlowPoints = scAETHFlowPoints; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("SCA_ETH_Flow_Points") + public String getScAETHFlowPoints() { + return scAETHFlowPoints; + } + public void setScAETHFlowPoints(String scAETHFlowPoints) { + this.scAETHFlowPoints = scAETHFlowPoints; + } + + /** + * Name of the pet + **/ + public Capitalization ATT_NAME(String ATT_NAME) { + this.ATT_NAME = ATT_NAME; + return this; + } + + + @ApiModelProperty(value = "Name of the pet ") + @JsonProperty("ATT_NAME") + public String getATTNAME() { + return ATT_NAME; + } + public void setATTNAME(String ATT_NAME) { + this.ATT_NAME = ATT_NAME; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Capitalization capitalization = (Capitalization) o; + return Objects.equals(smallCamel, capitalization.smallCamel) && + Objects.equals(capitalCamel, capitalization.capitalCamel) && + Objects.equals(smallSnake, capitalization.smallSnake) && + Objects.equals(capitalSnake, capitalization.capitalSnake) && + Objects.equals(scAETHFlowPoints, capitalization.scAETHFlowPoints) && + Objects.equals(ATT_NAME, capitalization.ATT_NAME); + } + + @Override + public int hashCode() { + return Objects.hash(smallCamel, capitalCamel, smallSnake, capitalSnake, scAETHFlowPoints, ATT_NAME); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Capitalization {\n"); + + sb.append(" smallCamel: ").append(toIndentedString(smallCamel)).append("\n"); + sb.append(" capitalCamel: ").append(toIndentedString(capitalCamel)).append("\n"); + sb.append(" smallSnake: ").append(toIndentedString(smallSnake)).append("\n"); + sb.append(" capitalSnake: ").append(toIndentedString(capitalSnake)).append("\n"); + sb.append(" scAETHFlowPoints: ").append(toIndentedString(scAETHFlowPoints)).append("\n"); + sb.append(" ATT_NAME: ").append(toIndentedString(ATT_NAME)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/Cat.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/Cat.java new file mode 100644 index 000000000000..086c6462d8ec --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/Cat.java @@ -0,0 +1,74 @@ +package io.swagger.model; + +import io.swagger.model.Animal; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; + + +public class Cat extends Animal implements Serializable { + + private @Valid Boolean declawed = null; + + /** + **/ + public Cat declawed(Boolean declawed) { + this.declawed = declawed; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("declawed") + public Boolean isDeclawed() { + return declawed; + } + public void setDeclawed(Boolean declawed) { + this.declawed = declawed; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Cat cat = (Cat) o; + return Objects.equals(declawed, cat.declawed); + } + + @Override + public int hashCode() { + return Objects.hash(declawed); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Cat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" declawed: ").append(toIndentedString(declawed)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/Category.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/Category.java new file mode 100644 index 000000000000..1e5c20bf7309 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/Category.java @@ -0,0 +1,93 @@ +package io.swagger.model; + +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; + + +public class Category implements Serializable { + + private @Valid Long id = null; + private @Valid String name = null; + + /** + **/ + public Category id(Long id) { + this.id = id; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("id") + public Long getId() { + return id; + } + public void setId(Long id) { + this.id = id; + } + + /** + **/ + public Category name(String name) { + this.name = name; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("name") + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Category category = (Category) o; + return Objects.equals(id, category.id) && + Objects.equals(name, category.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Category {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/ClassModel.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/ClassModel.java new file mode 100644 index 000000000000..c05c7b4a9b6c --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/ClassModel.java @@ -0,0 +1,77 @@ +package io.swagger.model; + +import io.swagger.annotations.ApiModel; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + + +/** + * Model for testing model with \"_class\" property + **/ +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +@ApiModel(description = "Model for testing model with \"_class\" property") + +public class ClassModel implements Serializable { + + private @Valid String propertyClass = null; + + /** + **/ + public ClassModel propertyClass(String propertyClass) { + this.propertyClass = propertyClass; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("_class") + public String getPropertyClass() { + return propertyClass; + } + public void setPropertyClass(String propertyClass) { + this.propertyClass = propertyClass; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ClassModel classModel = (ClassModel) o; + return Objects.equals(propertyClass, classModel.propertyClass); + } + + @Override + public int hashCode() { + return Objects.hash(propertyClass); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ClassModel {\n"); + + sb.append(" propertyClass: ").append(toIndentedString(propertyClass)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/Client.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/Client.java new file mode 100644 index 000000000000..61c2aef0512a --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/Client.java @@ -0,0 +1,73 @@ +package io.swagger.model; + +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; + + +public class Client implements Serializable { + + private @Valid String client = null; + + /** + **/ + public Client client(String client) { + this.client = client; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("client") + public String getClient() { + return client; + } + public void setClient(String client) { + this.client = client; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Client client = (Client) o; + return Objects.equals(client, client.client); + } + + @Override + public int hashCode() { + return Objects.hash(client); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Client {\n"); + + sb.append(" client: ").append(toIndentedString(client)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/Dog.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/Dog.java new file mode 100644 index 000000000000..8c1d2c3f85b3 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/Dog.java @@ -0,0 +1,74 @@ +package io.swagger.model; + +import io.swagger.model.Animal; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; + + +public class Dog extends Animal implements Serializable { + + private @Valid String breed = null; + + /** + **/ + public Dog breed(String breed) { + this.breed = breed; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("breed") + public String getBreed() { + return breed; + } + public void setBreed(String breed) { + this.breed = breed; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Dog dog = (Dog) o; + return Objects.equals(breed, dog.breed); + } + + @Override + public int hashCode() { + return Objects.hash(breed); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Dog {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" breed: ").append(toIndentedString(breed)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/EnumArrays.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/EnumArrays.java new file mode 100644 index 000000000000..0ed8a2bf521c --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/EnumArrays.java @@ -0,0 +1,161 @@ +package io.swagger.model; + +import java.util.ArrayList; +import java.util.List; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; + + +public class EnumArrays implements Serializable { + + +public enum JustSymbolEnum { + + GREATER_THAN_OR_EQUAL_TO(String.valueOf(">=")), DOLLAR(String.valueOf("$")); + + + private String value; + + JustSymbolEnum (String v) { + value = v; + } + + public String value() { + return value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static JustSymbolEnum fromValue(String v) { + for (JustSymbolEnum b : JustSymbolEnum.values()) { + if (String.valueOf(b.value).equals(v)) { + return b; + } + } + return null; + } +} + + private @Valid JustSymbolEnum justSymbol = null; + +public enum ArrayEnumEnum { + + FISH(String.valueOf("fish")), CRAB(String.valueOf("crab")); + + + private String value; + + ArrayEnumEnum (String v) { + value = v; + } + + public String value() { + return value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static ArrayEnumEnum fromValue(String v) { + for (ArrayEnumEnum b : ArrayEnumEnum.values()) { + if (String.valueOf(b.value).equals(v)) { + return b; + } + } + return null; + } +} + + private @Valid List arrayEnum = new ArrayList(); + + /** + **/ + public EnumArrays justSymbol(JustSymbolEnum justSymbol) { + this.justSymbol = justSymbol; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("just_symbol") + public JustSymbolEnum getJustSymbol() { + return justSymbol; + } + public void setJustSymbol(JustSymbolEnum justSymbol) { + this.justSymbol = justSymbol; + } + + /** + **/ + public EnumArrays arrayEnum(List arrayEnum) { + this.arrayEnum = arrayEnum; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("array_enum") + public List getArrayEnum() { + return arrayEnum; + } + public void setArrayEnum(List arrayEnum) { + this.arrayEnum = arrayEnum; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EnumArrays enumArrays = (EnumArrays) o; + return Objects.equals(justSymbol, enumArrays.justSymbol) && + Objects.equals(arrayEnum, enumArrays.arrayEnum); + } + + @Override + public int hashCode() { + return Objects.hash(justSymbol, arrayEnum); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EnumArrays {\n"); + + sb.append(" justSymbol: ").append(toIndentedString(justSymbol)).append("\n"); + sb.append(" arrayEnum: ").append(toIndentedString(arrayEnum)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/EnumClass.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/EnumClass.java new file mode 100644 index 000000000000..13cf0a338e79 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/EnumClass.java @@ -0,0 +1,45 @@ +package io.swagger.model; + +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets EnumClass + */ +public enum EnumClass { + + _ABC("_abc"), + + _EFG("-efg"), + + _XYZ_("(xyz)"); + + private String value; + + EnumClass(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumClass fromValue(String text) { + for (EnumClass b : EnumClass.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } +} + + diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/EnumTest.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/EnumTest.java new file mode 100644 index 000000000000..7fdc1ad96d7b --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/EnumTest.java @@ -0,0 +1,233 @@ +package io.swagger.model; + +import io.swagger.model.OuterEnum; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; + + +public class EnumTest implements Serializable { + + +public enum EnumStringEnum { + + UPPER(String.valueOf("UPPER")), LOWER(String.valueOf("lower")), EMPTY(String.valueOf("")); + + + private String value; + + EnumStringEnum (String v) { + value = v; + } + + public String value() { + return value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumStringEnum fromValue(String v) { + for (EnumStringEnum b : EnumStringEnum.values()) { + if (String.valueOf(b.value).equals(v)) { + return b; + } + } + return null; + } +} + + private @Valid EnumStringEnum enumString = null; + +public enum EnumIntegerEnum { + + NUMBER_1(Integer.valueOf(1)), NUMBER_MINUS_1(Integer.valueOf(-1)); + + + private Integer value; + + EnumIntegerEnum (Integer v) { + value = v; + } + + public String value() { + return value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumIntegerEnum fromValue(String v) { + for (EnumIntegerEnum b : EnumIntegerEnum.values()) { + if (String.valueOf(b.value).equals(v)) { + return b; + } + } + return null; + } +} + + private @Valid EnumIntegerEnum enumInteger = null; + +public enum EnumNumberEnum { + + NUMBER_1_DOT_1(Double.valueOf(1.1)), NUMBER_MINUS_1_DOT_2(Double.valueOf(-1.2)); + + + private Double value; + + EnumNumberEnum (Double v) { + value = v; + } + + public String value() { + return value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumNumberEnum fromValue(String v) { + for (EnumNumberEnum b : EnumNumberEnum.values()) { + if (String.valueOf(b.value).equals(v)) { + return b; + } + } + return null; + } +} + + private @Valid EnumNumberEnum enumNumber = null; + private @Valid OuterEnum outerEnum = null; + + /** + **/ + public EnumTest enumString(EnumStringEnum enumString) { + this.enumString = enumString; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("enum_string") + public EnumStringEnum getEnumString() { + return enumString; + } + public void setEnumString(EnumStringEnum enumString) { + this.enumString = enumString; + } + + /** + **/ + public EnumTest enumInteger(EnumIntegerEnum enumInteger) { + this.enumInteger = enumInteger; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("enum_integer") + public EnumIntegerEnum getEnumInteger() { + return enumInteger; + } + public void setEnumInteger(EnumIntegerEnum enumInteger) { + this.enumInteger = enumInteger; + } + + /** + **/ + public EnumTest enumNumber(EnumNumberEnum enumNumber) { + this.enumNumber = enumNumber; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("enum_number") + public EnumNumberEnum getEnumNumber() { + return enumNumber; + } + public void setEnumNumber(EnumNumberEnum enumNumber) { + this.enumNumber = enumNumber; + } + + /** + **/ + public EnumTest outerEnum(OuterEnum outerEnum) { + this.outerEnum = outerEnum; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("outerEnum") + public OuterEnum getOuterEnum() { + return outerEnum; + } + public void setOuterEnum(OuterEnum outerEnum) { + this.outerEnum = outerEnum; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EnumTest enumTest = (EnumTest) o; + return Objects.equals(enumString, enumTest.enumString) && + Objects.equals(enumInteger, enumTest.enumInteger) && + Objects.equals(enumNumber, enumTest.enumNumber) && + Objects.equals(outerEnum, enumTest.outerEnum); + } + + @Override + public int hashCode() { + return Objects.hash(enumString, enumInteger, enumNumber, outerEnum); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EnumTest {\n"); + + sb.append(" enumString: ").append(toIndentedString(enumString)).append("\n"); + sb.append(" enumInteger: ").append(toIndentedString(enumInteger)).append("\n"); + sb.append(" enumNumber: ").append(toIndentedString(enumNumber)).append("\n"); + sb.append(" outerEnum: ").append(toIndentedString(outerEnum)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/FormatTest.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/FormatTest.java new file mode 100644 index 000000000000..bb3072fe1e9d --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/FormatTest.java @@ -0,0 +1,331 @@ +package io.swagger.model; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.UUID; +import org.joda.time.LocalDate; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; + + +public class FormatTest implements Serializable { + + private @Valid Integer integer = null; + private @Valid Integer int32 = null; + private @Valid Long int64 = null; + private @Valid BigDecimal number = null; + private @Valid Float _float = null; + private @Valid Double _double = null; + private @Valid String string = null; + private @Valid byte[] _byte = null; + private @Valid byte[] binary = null; + private @Valid LocalDate date = null; + private @Valid Date dateTime = null; + private @Valid UUID uuid = null; + private @Valid String password = null; + + /** + * minimum: 10 + * maximum: 100 + **/ + public FormatTest integer(Integer integer) { + this.integer = integer; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("integer") + @Min(10) @Max(100) public Integer getInteger() { + return integer; + } + public void setInteger(Integer integer) { + this.integer = integer; + } + + /** + * minimum: 20 + * maximum: 200 + **/ + public FormatTest int32(Integer int32) { + this.int32 = int32; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("int32") + @Min(20) @Max(200) public Integer getInt32() { + return int32; + } + public void setInt32(Integer int32) { + this.int32 = int32; + } + + /** + **/ + public FormatTest int64(Long int64) { + this.int64 = int64; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("int64") + public Long getInt64() { + return int64; + } + public void setInt64(Long int64) { + this.int64 = int64; + } + + /** + * minimum: 32.1 + * maximum: 543.2 + **/ + public FormatTest number(BigDecimal number) { + this.number = number; + return this; + } + + + @ApiModelProperty(required = true, value = "") + @JsonProperty("number") + @NotNull + @DecimalMin("32.1") @DecimalMax("543.2") public BigDecimal getNumber() { + return number; + } + public void setNumber(BigDecimal number) { + this.number = number; + } + + /** + * minimum: 54.3 + * maximum: 987.6 + **/ + public FormatTest _float(Float _float) { + this._float = _float; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("float") + @DecimalMin("54.3") @DecimalMax("987.6") public Float getFloat() { + return _float; + } + public void setFloat(Float _float) { + this._float = _float; + } + + /** + * minimum: 67.8 + * maximum: 123.4 + **/ + public FormatTest _double(Double _double) { + this._double = _double; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("double") + @DecimalMin("67.8") @DecimalMax("123.4") public Double getDouble() { + return _double; + } + public void setDouble(Double _double) { + this._double = _double; + } + + /** + **/ + public FormatTest string(String string) { + this.string = string; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("string") + @Pattern(regexp="/[a-z]/i") public String getString() { + return string; + } + public void setString(String string) { + this.string = string; + } + + /** + **/ + public FormatTest _byte(byte[] _byte) { + this._byte = _byte; + return this; + } + + + @ApiModelProperty(required = true, value = "") + @JsonProperty("byte") + @NotNull + @Pattern(regexp="^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$") public byte[] getByte() { + return _byte; + } + public void setByte(byte[] _byte) { + this._byte = _byte; + } + + /** + **/ + public FormatTest binary(byte[] binary) { + this.binary = binary; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("binary") + public byte[] getBinary() { + return binary; + } + public void setBinary(byte[] binary) { + this.binary = binary; + } + + /** + **/ + public FormatTest date(LocalDate date) { + this.date = date; + return this; + } + + + @ApiModelProperty(required = true, value = "") + @JsonProperty("date") + @NotNull + public LocalDate getDate() { + return date; + } + public void setDate(LocalDate date) { + this.date = date; + } + + /** + **/ + public FormatTest dateTime(Date dateTime) { + this.dateTime = dateTime; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("dateTime") + public Date getDateTime() { + return dateTime; + } + public void setDateTime(Date dateTime) { + this.dateTime = dateTime; + } + + /** + **/ + public FormatTest uuid(UUID uuid) { + this.uuid = uuid; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("uuid") + public UUID getUuid() { + return uuid; + } + public void setUuid(UUID uuid) { + this.uuid = uuid; + } + + /** + **/ + public FormatTest password(String password) { + this.password = password; + return this; + } + + + @ApiModelProperty(required = true, value = "") + @JsonProperty("password") + @NotNull + @Size(min=10,max=64) public String getPassword() { + return password; + } + public void setPassword(String password) { + this.password = password; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FormatTest formatTest = (FormatTest) o; + return Objects.equals(integer, formatTest.integer) && + Objects.equals(int32, formatTest.int32) && + Objects.equals(int64, formatTest.int64) && + Objects.equals(number, formatTest.number) && + Objects.equals(_float, formatTest._float) && + Objects.equals(_double, formatTest._double) && + Objects.equals(string, formatTest.string) && + Objects.equals(_byte, formatTest._byte) && + Objects.equals(binary, formatTest.binary) && + Objects.equals(date, formatTest.date) && + Objects.equals(dateTime, formatTest.dateTime) && + Objects.equals(uuid, formatTest.uuid) && + Objects.equals(password, formatTest.password); + } + + @Override + public int hashCode() { + return Objects.hash(integer, int32, int64, number, _float, _double, string, _byte, binary, date, dateTime, uuid, password); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FormatTest {\n"); + + sb.append(" integer: ").append(toIndentedString(integer)).append("\n"); + sb.append(" int32: ").append(toIndentedString(int32)).append("\n"); + sb.append(" int64: ").append(toIndentedString(int64)).append("\n"); + sb.append(" number: ").append(toIndentedString(number)).append("\n"); + sb.append(" _float: ").append(toIndentedString(_float)).append("\n"); + sb.append(" _double: ").append(toIndentedString(_double)).append("\n"); + sb.append(" string: ").append(toIndentedString(string)).append("\n"); + sb.append(" _byte: ").append(toIndentedString(_byte)).append("\n"); + sb.append(" binary: ").append(toIndentedString(binary)).append("\n"); + sb.append(" date: ").append(toIndentedString(date)).append("\n"); + sb.append(" dateTime: ").append(toIndentedString(dateTime)).append("\n"); + sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/HasOnlyReadOnly.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/HasOnlyReadOnly.java new file mode 100644 index 000000000000..ef9c27288466 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/HasOnlyReadOnly.java @@ -0,0 +1,93 @@ +package io.swagger.model; + +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; + + +public class HasOnlyReadOnly implements Serializable { + + private @Valid String bar = null; + private @Valid String foo = null; + + /** + **/ + public HasOnlyReadOnly bar(String bar) { + this.bar = bar; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("bar") + public String getBar() { + return bar; + } + public void setBar(String bar) { + this.bar = bar; + } + + /** + **/ + public HasOnlyReadOnly foo(String foo) { + this.foo = foo; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("foo") + public String getFoo() { + return foo; + } + public void setFoo(String foo) { + this.foo = foo; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HasOnlyReadOnly hasOnlyReadOnly = (HasOnlyReadOnly) o; + return Objects.equals(bar, hasOnlyReadOnly.bar) && + Objects.equals(foo, hasOnlyReadOnly.foo); + } + + @Override + public int hashCode() { + return Objects.hash(bar, foo); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HasOnlyReadOnly {\n"); + + sb.append(" bar: ").append(toIndentedString(bar)).append("\n"); + sb.append(" foo: ").append(toIndentedString(foo)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/MapTest.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/MapTest.java new file mode 100644 index 000000000000..6a11ab8cbf65 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/MapTest.java @@ -0,0 +1,129 @@ +package io.swagger.model; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; + + +public class MapTest implements Serializable { + + private @Valid Map> mapMapOfString = new HashMap>(); + +public enum InnerEnum { + + UPPER(String.valueOf("UPPER")), LOWER(String.valueOf("lower")); + + + private String value; + + InnerEnum (String v) { + value = v; + } + + public String value() { + return value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static InnerEnum fromValue(String v) { + for (InnerEnum b : InnerEnum.values()) { + if (String.valueOf(b.value).equals(v)) { + return b; + } + } + return null; + } +} + + private @Valid Map mapOfEnumString = new HashMap(); + + /** + **/ + public MapTest mapMapOfString(Map> mapMapOfString) { + this.mapMapOfString = mapMapOfString; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("map_map_of_string") + public Map> getMapMapOfString() { + return mapMapOfString; + } + public void setMapMapOfString(Map> mapMapOfString) { + this.mapMapOfString = mapMapOfString; + } + + /** + **/ + public MapTest mapOfEnumString(Map mapOfEnumString) { + this.mapOfEnumString = mapOfEnumString; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("map_of_enum_string") + public Map getMapOfEnumString() { + return mapOfEnumString; + } + public void setMapOfEnumString(Map mapOfEnumString) { + this.mapOfEnumString = mapOfEnumString; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MapTest mapTest = (MapTest) o; + return Objects.equals(mapMapOfString, mapTest.mapMapOfString) && + Objects.equals(mapOfEnumString, mapTest.mapOfEnumString); + } + + @Override + public int hashCode() { + return Objects.hash(mapMapOfString, mapOfEnumString); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MapTest {\n"); + + sb.append(" mapMapOfString: ").append(toIndentedString(mapMapOfString)).append("\n"); + sb.append(" mapOfEnumString: ").append(toIndentedString(mapOfEnumString)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java new file mode 100644 index 000000000000..673adda125ee --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -0,0 +1,119 @@ +package io.swagger.model; + +import io.swagger.model.Animal; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; + + +public class MixedPropertiesAndAdditionalPropertiesClass implements Serializable { + + private @Valid UUID uuid = null; + private @Valid Date dateTime = null; + private @Valid Map map = new HashMap(); + + /** + **/ + public MixedPropertiesAndAdditionalPropertiesClass uuid(UUID uuid) { + this.uuid = uuid; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("uuid") + public UUID getUuid() { + return uuid; + } + public void setUuid(UUID uuid) { + this.uuid = uuid; + } + + /** + **/ + public MixedPropertiesAndAdditionalPropertiesClass dateTime(Date dateTime) { + this.dateTime = dateTime; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("dateTime") + public Date getDateTime() { + return dateTime; + } + public void setDateTime(Date dateTime) { + this.dateTime = dateTime; + } + + /** + **/ + public MixedPropertiesAndAdditionalPropertiesClass map(Map map) { + this.map = map; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("map") + public Map getMap() { + return map; + } + public void setMap(Map map) { + this.map = map; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass = (MixedPropertiesAndAdditionalPropertiesClass) o; + return Objects.equals(uuid, mixedPropertiesAndAdditionalPropertiesClass.uuid) && + Objects.equals(dateTime, mixedPropertiesAndAdditionalPropertiesClass.dateTime) && + Objects.equals(map, mixedPropertiesAndAdditionalPropertiesClass.map); + } + + @Override + public int hashCode() { + return Objects.hash(uuid, dateTime, map); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MixedPropertiesAndAdditionalPropertiesClass {\n"); + + sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); + sb.append(" dateTime: ").append(toIndentedString(dateTime)).append("\n"); + sb.append(" map: ").append(toIndentedString(map)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/Model200Response.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/Model200Response.java new file mode 100644 index 000000000000..eeb8e7547cf4 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/Model200Response.java @@ -0,0 +1,97 @@ +package io.swagger.model; + +import io.swagger.annotations.ApiModel; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + + +/** + * Model for testing model name starting with number + **/ +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +@ApiModel(description = "Model for testing model name starting with number") + +public class Model200Response implements Serializable { + + private @Valid Integer name = null; + private @Valid String propertyClass = null; + + /** + **/ + public Model200Response name(Integer name) { + this.name = name; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("name") + public Integer getName() { + return name; + } + public void setName(Integer name) { + this.name = name; + } + + /** + **/ + public Model200Response propertyClass(String propertyClass) { + this.propertyClass = propertyClass; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("class") + public String getPropertyClass() { + return propertyClass; + } + public void setPropertyClass(String propertyClass) { + this.propertyClass = propertyClass; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Model200Response _200Response = (Model200Response) o; + return Objects.equals(name, _200Response.name) && + Objects.equals(propertyClass, _200Response.propertyClass); + } + + @Override + public int hashCode() { + return Objects.hash(name, propertyClass); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Model200Response {\n"); + + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" propertyClass: ").append(toIndentedString(propertyClass)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/ModelApiResponse.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/ModelApiResponse.java new file mode 100644 index 000000000000..e97b1fdfd8ba --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/ModelApiResponse.java @@ -0,0 +1,113 @@ +package io.swagger.model; + +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; + + +public class ModelApiResponse implements Serializable { + + private @Valid Integer code = null; + private @Valid String type = null; + private @Valid String message = null; + + /** + **/ + public ModelApiResponse code(Integer code) { + this.code = code; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("code") + public Integer getCode() { + return code; + } + public void setCode(Integer code) { + this.code = code; + } + + /** + **/ + public ModelApiResponse type(String type) { + this.type = type; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("type") + public String getType() { + return type; + } + public void setType(String type) { + this.type = type; + } + + /** + **/ + public ModelApiResponse message(String message) { + this.message = message; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("message") + public String getMessage() { + return message; + } + public void setMessage(String message) { + this.message = message; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelApiResponse _apiResponse = (ModelApiResponse) o; + return Objects.equals(code, _apiResponse.code) && + Objects.equals(type, _apiResponse.type) && + Objects.equals(message, _apiResponse.message); + } + + @Override + public int hashCode() { + return Objects.hash(code, type, message); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelApiResponse {\n"); + + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/ModelReturn.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/ModelReturn.java new file mode 100644 index 000000000000..72a677f7ab02 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/ModelReturn.java @@ -0,0 +1,77 @@ +package io.swagger.model; + +import io.swagger.annotations.ApiModel; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + + +/** + * Model for testing reserved words + **/ +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +@ApiModel(description = "Model for testing reserved words") + +public class ModelReturn implements Serializable { + + private @Valid Integer _return = null; + + /** + **/ + public ModelReturn _return(Integer _return) { + this._return = _return; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("return") + public Integer getReturn() { + return _return; + } + public void setReturn(Integer _return) { + this._return = _return; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelReturn _return = (ModelReturn) o; + return Objects.equals(_return, _return._return); + } + + @Override + public int hashCode() { + return Objects.hash(_return); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelReturn {\n"); + + sb.append(" _return: ").append(toIndentedString(_return)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/Name.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/Name.java new file mode 100644 index 000000000000..5460ff8a9b9e --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/Name.java @@ -0,0 +1,138 @@ +package io.swagger.model; + +import io.swagger.annotations.ApiModel; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + + +/** + * Model for testing model name same as property name + **/ +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +@ApiModel(description = "Model for testing model name same as property name") + +public class Name implements Serializable { + + private @Valid Integer name = null; + private @Valid Integer snakeCase = null; + private @Valid String property = null; + private @Valid Integer _123Number = null; + + /** + **/ + public Name name(Integer name) { + this.name = name; + return this; + } + + + @ApiModelProperty(required = true, value = "") + @JsonProperty("name") + @NotNull + public Integer getName() { + return name; + } + public void setName(Integer name) { + this.name = name; + } + + /** + **/ + public Name snakeCase(Integer snakeCase) { + this.snakeCase = snakeCase; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("snake_case") + public Integer getSnakeCase() { + return snakeCase; + } + public void setSnakeCase(Integer snakeCase) { + this.snakeCase = snakeCase; + } + + /** + **/ + public Name property(String property) { + this.property = property; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("property") + public String getProperty() { + return property; + } + public void setProperty(String property) { + this.property = property; + } + + /** + **/ + public Name _123Number(Integer _123Number) { + this._123Number = _123Number; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("123Number") + public Integer get123Number() { + return _123Number; + } + public void set123Number(Integer _123Number) { + this._123Number = _123Number; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Name name = (Name) o; + return Objects.equals(name, name.name) && + Objects.equals(snakeCase, name.snakeCase) && + Objects.equals(property, name.property) && + Objects.equals(_123Number, name._123Number); + } + + @Override + public int hashCode() { + return Objects.hash(name, snakeCase, property, _123Number); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Name {\n"); + + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" snakeCase: ").append(toIndentedString(snakeCase)).append("\n"); + sb.append(" property: ").append(toIndentedString(property)).append("\n"); + sb.append(" _123Number: ").append(toIndentedString(_123Number)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/NumberOnly.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/NumberOnly.java new file mode 100644 index 000000000000..5f02fd0649aa --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/NumberOnly.java @@ -0,0 +1,74 @@ +package io.swagger.model; + +import java.math.BigDecimal; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; + + +public class NumberOnly implements Serializable { + + private @Valid BigDecimal justNumber = null; + + /** + **/ + public NumberOnly justNumber(BigDecimal justNumber) { + this.justNumber = justNumber; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("JustNumber") + public BigDecimal getJustNumber() { + return justNumber; + } + public void setJustNumber(BigDecimal justNumber) { + this.justNumber = justNumber; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + NumberOnly numberOnly = (NumberOnly) o; + return Objects.equals(justNumber, numberOnly.justNumber); + } + + @Override + public int hashCode() { + return Objects.hash(justNumber); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NumberOnly {\n"); + + sb.append(" justNumber: ").append(toIndentedString(justNumber)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/Order.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/Order.java new file mode 100644 index 000000000000..393f06ff0397 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/Order.java @@ -0,0 +1,208 @@ +package io.swagger.model; + +import java.util.Date; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; + + +public class Order implements Serializable { + + private @Valid Long id = null; + private @Valid Long petId = null; + private @Valid Integer quantity = null; + private @Valid Date shipDate = null; + +public enum StatusEnum { + + PLACED(String.valueOf("placed")), APPROVED(String.valueOf("approved")), DELIVERED(String.valueOf("delivered")); + + + private String value; + + StatusEnum (String v) { + value = v; + } + + public String value() { + return value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static StatusEnum fromValue(String v) { + for (StatusEnum b : StatusEnum.values()) { + if (String.valueOf(b.value).equals(v)) { + return b; + } + } + return null; + } +} + + private @Valid StatusEnum status = null; + private @Valid Boolean complete = false; + + /** + **/ + public Order id(Long id) { + this.id = id; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("id") + public Long getId() { + return id; + } + public void setId(Long id) { + this.id = id; + } + + /** + **/ + public Order petId(Long petId) { + this.petId = petId; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("petId") + public Long getPetId() { + return petId; + } + public void setPetId(Long petId) { + this.petId = petId; + } + + /** + **/ + public Order quantity(Integer quantity) { + this.quantity = quantity; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("quantity") + public Integer getQuantity() { + return quantity; + } + public void setQuantity(Integer quantity) { + this.quantity = quantity; + } + + /** + **/ + public Order shipDate(Date shipDate) { + this.shipDate = shipDate; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("shipDate") + public Date getShipDate() { + return shipDate; + } + public void setShipDate(Date shipDate) { + this.shipDate = shipDate; + } + + /** + * Order Status + **/ + public Order status(StatusEnum status) { + this.status = status; + return this; + } + + + @ApiModelProperty(value = "Order Status") + @JsonProperty("status") + public StatusEnum getStatus() { + return status; + } + public void setStatus(StatusEnum status) { + this.status = status; + } + + /** + **/ + public Order complete(Boolean complete) { + this.complete = complete; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("complete") + public Boolean isComplete() { + return complete; + } + public void setComplete(Boolean complete) { + this.complete = complete; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Order order = (Order) o; + return Objects.equals(id, order.id) && + Objects.equals(petId, order.petId) && + Objects.equals(quantity, order.quantity) && + Objects.equals(shipDate, order.shipDate) && + Objects.equals(status, order.status) && + Objects.equals(complete, order.complete); + } + + @Override + public int hashCode() { + return Objects.hash(id, petId, quantity, shipDate, status, complete); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Order {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" petId: ").append(toIndentedString(petId)).append("\n"); + sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); + sb.append(" shipDate: ").append(toIndentedString(shipDate)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" complete: ").append(toIndentedString(complete)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/OuterComposite.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/OuterComposite.java new file mode 100644 index 000000000000..bfe8211b6544 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/OuterComposite.java @@ -0,0 +1,114 @@ +package io.swagger.model; + +import java.math.BigDecimal; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; + + +public class OuterComposite implements Serializable { + + private @Valid BigDecimal myNumber = null; + private @Valid String myString = null; + private @Valid Boolean myBoolean = null; + + /** + **/ + public OuterComposite myNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("my_number") + public BigDecimal getMyNumber() { + return myNumber; + } + public void setMyNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + } + + /** + **/ + public OuterComposite myString(String myString) { + this.myString = myString; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("my_string") + public String getMyString() { + return myString; + } + public void setMyString(String myString) { + this.myString = myString; + } + + /** + **/ + public OuterComposite myBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("my_boolean") + public Boolean getMyBoolean() { + return myBoolean; + } + public void setMyBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OuterComposite outerComposite = (OuterComposite) o; + return Objects.equals(myNumber, outerComposite.myNumber) && + Objects.equals(myString, outerComposite.myString) && + Objects.equals(myBoolean, outerComposite.myBoolean); + } + + @Override + public int hashCode() { + return Objects.hash(myNumber, myString, myBoolean); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OuterComposite {\n"); + + sb.append(" myNumber: ").append(toIndentedString(myNumber)).append("\n"); + sb.append(" myString: ").append(toIndentedString(myString)).append("\n"); + sb.append(" myBoolean: ").append(toIndentedString(myBoolean)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/OuterEnum.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/OuterEnum.java new file mode 100644 index 000000000000..d682c3f50803 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/OuterEnum.java @@ -0,0 +1,45 @@ +package io.swagger.model; + +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets OuterEnum + */ +public enum OuterEnum { + + PLACED("placed"), + + APPROVED("approved"), + + DELIVERED("delivered"); + + private String value; + + OuterEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static OuterEnum fromValue(String text) { + for (OuterEnum b : OuterEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } +} + + diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/Pet.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/Pet.java new file mode 100644 index 000000000000..1c9f88d1401d --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/Pet.java @@ -0,0 +1,213 @@ +package io.swagger.model; + +import io.swagger.model.Category; +import io.swagger.model.Tag; +import java.util.ArrayList; +import java.util.List; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; + + +public class Pet implements Serializable { + + private @Valid Long id = null; + private @Valid Category category = null; + private @Valid String name = null; + private @Valid List photoUrls = new ArrayList(); + private @Valid List tags = new ArrayList(); + +public enum StatusEnum { + + AVAILABLE(String.valueOf("available")), PENDING(String.valueOf("pending")), SOLD(String.valueOf("sold")); + + + private String value; + + StatusEnum (String v) { + value = v; + } + + public String value() { + return value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static StatusEnum fromValue(String v) { + for (StatusEnum b : StatusEnum.values()) { + if (String.valueOf(b.value).equals(v)) { + return b; + } + } + return null; + } +} + + private @Valid StatusEnum status = null; + + /** + **/ + public Pet id(Long id) { + this.id = id; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("id") + public Long getId() { + return id; + } + public void setId(Long id) { + this.id = id; + } + + /** + **/ + public Pet category(Category category) { + this.category = category; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("category") + public Category getCategory() { + return category; + } + public void setCategory(Category category) { + this.category = category; + } + + /** + **/ + public Pet name(String name) { + this.name = name; + return this; + } + + + @ApiModelProperty(example = "doggie", required = true, value = "") + @JsonProperty("name") + @NotNull + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + + /** + **/ + public Pet photoUrls(List photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + + @ApiModelProperty(required = true, value = "") + @JsonProperty("photoUrls") + @NotNull + public List getPhotoUrls() { + return photoUrls; + } + public void setPhotoUrls(List photoUrls) { + this.photoUrls = photoUrls; + } + + /** + **/ + public Pet tags(List tags) { + this.tags = tags; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("tags") + public List getTags() { + return tags; + } + public void setTags(List tags) { + this.tags = tags; + } + + /** + * pet status in the store + **/ + public Pet status(StatusEnum status) { + this.status = status; + return this; + } + + + @ApiModelProperty(value = "pet status in the store") + @JsonProperty("status") + public StatusEnum getStatus() { + return status; + } + public void setStatus(StatusEnum status) { + this.status = status; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Pet pet = (Pet) o; + return Objects.equals(id, pet.id) && + Objects.equals(category, pet.category) && + Objects.equals(name, pet.name) && + Objects.equals(photoUrls, pet.photoUrls) && + Objects.equals(tags, pet.tags) && + Objects.equals(status, pet.status); + } + + @Override + public int hashCode() { + return Objects.hash(id, category, name, photoUrls, tags, status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Pet {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/ReadOnlyFirst.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/ReadOnlyFirst.java new file mode 100644 index 000000000000..bd4ee7e1cb1a --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/ReadOnlyFirst.java @@ -0,0 +1,93 @@ +package io.swagger.model; + +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; + + +public class ReadOnlyFirst implements Serializable { + + private @Valid String bar = null; + private @Valid String baz = null; + + /** + **/ + public ReadOnlyFirst bar(String bar) { + this.bar = bar; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("bar") + public String getBar() { + return bar; + } + public void setBar(String bar) { + this.bar = bar; + } + + /** + **/ + public ReadOnlyFirst baz(String baz) { + this.baz = baz; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("baz") + public String getBaz() { + return baz; + } + public void setBaz(String baz) { + this.baz = baz; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReadOnlyFirst readOnlyFirst = (ReadOnlyFirst) o; + return Objects.equals(bar, readOnlyFirst.bar) && + Objects.equals(baz, readOnlyFirst.baz); + } + + @Override + public int hashCode() { + return Objects.hash(bar, baz); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReadOnlyFirst {\n"); + + sb.append(" bar: ").append(toIndentedString(bar)).append("\n"); + sb.append(" baz: ").append(toIndentedString(baz)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/SpecialModelName.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/SpecialModelName.java new file mode 100644 index 000000000000..b8144314b82f --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/SpecialModelName.java @@ -0,0 +1,73 @@ +package io.swagger.model; + +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; + + +public class SpecialModelName implements Serializable { + + private @Valid Long specialPropertyName = null; + + /** + **/ + public SpecialModelName specialPropertyName(Long specialPropertyName) { + this.specialPropertyName = specialPropertyName; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("$special[property.name]") + public Long getSpecialPropertyName() { + return specialPropertyName; + } + public void setSpecialPropertyName(Long specialPropertyName) { + this.specialPropertyName = specialPropertyName; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SpecialModelName specialModelName = (SpecialModelName) o; + return Objects.equals(specialPropertyName, specialModelName.specialPropertyName); + } + + @Override + public int hashCode() { + return Objects.hash(specialPropertyName); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SpecialModelName {\n"); + + sb.append(" specialPropertyName: ").append(toIndentedString(specialPropertyName)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/Tag.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/Tag.java new file mode 100644 index 000000000000..10a7ffc7c575 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/Tag.java @@ -0,0 +1,93 @@ +package io.swagger.model; + +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; + + +public class Tag implements Serializable { + + private @Valid Long id = null; + private @Valid String name = null; + + /** + **/ + public Tag id(Long id) { + this.id = id; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("id") + public Long getId() { + return id; + } + public void setId(Long id) { + this.id = id; + } + + /** + **/ + public Tag name(String name) { + this.name = name; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("name") + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Tag tag = (Tag) o; + return Objects.equals(id, tag.id) && + Objects.equals(name, tag.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Tag {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/User.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/User.java new file mode 100644 index 000000000000..a86f0eae070a --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/io/swagger/model/User.java @@ -0,0 +1,214 @@ +package io.swagger.model; + +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; + + +public class User implements Serializable { + + private @Valid Long id = null; + private @Valid String username = null; + private @Valid String firstName = null; + private @Valid String lastName = null; + private @Valid String email = null; + private @Valid String password = null; + private @Valid String phone = null; + private @Valid Integer userStatus = null; + + /** + **/ + public User id(Long id) { + this.id = id; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("id") + public Long getId() { + return id; + } + public void setId(Long id) { + this.id = id; + } + + /** + **/ + public User username(String username) { + this.username = username; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("username") + public String getUsername() { + return username; + } + public void setUsername(String username) { + this.username = username; + } + + /** + **/ + public User firstName(String firstName) { + this.firstName = firstName; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("firstName") + public String getFirstName() { + return firstName; + } + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + /** + **/ + public User lastName(String lastName) { + this.lastName = lastName; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("lastName") + public String getLastName() { + return lastName; + } + public void setLastName(String lastName) { + this.lastName = lastName; + } + + /** + **/ + public User email(String email) { + this.email = email; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("email") + public String getEmail() { + return email; + } + public void setEmail(String email) { + this.email = email; + } + + /** + **/ + public User password(String password) { + this.password = password; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("password") + public String getPassword() { + return password; + } + public void setPassword(String password) { + this.password = password; + } + + /** + **/ + public User phone(String phone) { + this.phone = phone; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("phone") + public String getPhone() { + return phone; + } + public void setPhone(String phone) { + this.phone = phone; + } + + /** + * User Status + **/ + public User userStatus(Integer userStatus) { + this.userStatus = userStatus; + return this; + } + + + @ApiModelProperty(value = "User Status") + @JsonProperty("userStatus") + public Integer getUserStatus() { + return userStatus; + } + public void setUserStatus(Integer userStatus) { + this.userStatus = userStatus; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + User user = (User) o; + return Objects.equals(id, user.id) && + Objects.equals(username, user.username) && + Objects.equals(firstName, user.firstName) && + Objects.equals(lastName, user.lastName) && + Objects.equals(email, user.email) && + Objects.equals(password, user.password) && + Objects.equals(phone, user.phone) && + Objects.equals(userStatus, user.userStatus); + } + + @Override + public int hashCode() { + return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class User {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" username: ").append(toIndentedString(username)).append("\n"); + sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n"); + sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); + sb.append(" userStatus: ").append(toIndentedString(userStatus)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-spec-interface-response/swagger.json b/samples/server/petstore/jaxrs-spec-interface-response/swagger.json new file mode 100644 index 000000000000..26eef9f958c8 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-interface-response/swagger.json @@ -0,0 +1,1719 @@ +{ + "swagger" : "2.0", + "info" : { + "description" : "This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\", + "version" : "1.0.0", + "title" : "Swagger Petstore", + "termsOfService" : "http://swagger.io/terms/", + "contact" : { + "email" : "apiteam@swagger.io" + }, + "license" : { + "name" : "Apache-2.0", + "url" : "http://www.apache.org/licenses/LICENSE-2.0.html" + } + }, + "host" : "petstore.swagger.io:80", + "basePath" : "/v2", + "tags" : [ { + "name" : "pet", + "description" : "Everything about your Pets", + "externalDocs" : { + "description" : "Find out more", + "url" : "http://swagger.io" + } + }, { + "name" : "store", + "description" : "Access to Petstore orders" + }, { + "name" : "user", + "description" : "Operations about user", + "externalDocs" : { + "description" : "Find out more about our store", + "url" : "http://swagger.io" + } + } ], + "schemes" : [ "http" ], + "paths" : { + "/pet" : { + "post" : { + "tags" : [ "pet" ], + "summary" : "Add a new pet to the store", + "description" : "", + "operationId" : "addPet", + "consumes" : [ "application/json", "application/xml" ], + "produces" : [ "application/xml", "application/json" ], + "parameters" : [ { + "in" : "body", + "name" : "body", + "description" : "Pet object that needs to be added to the store", + "required" : true, + "schema" : { + "$ref" : "#/definitions/Pet" + } + } ], + "responses" : { + "405" : { + "description" : "Invalid input" + } + }, + "security" : [ { + "petstore_auth" : [ "write:pets", "read:pets" ] + } ] + }, + "put" : { + "tags" : [ "pet" ], + "summary" : "Update an existing pet", + "description" : "", + "operationId" : "updatePet", + "consumes" : [ "application/json", "application/xml" ], + "produces" : [ "application/xml", "application/json" ], + "parameters" : [ { + "in" : "body", + "name" : "body", + "description" : "Pet object that needs to be added to the store", + "required" : true, + "schema" : { + "$ref" : "#/definitions/Pet" + } + } ], + "responses" : { + "400" : { + "description" : "Invalid ID supplied" + }, + "404" : { + "description" : "Pet not found" + }, + "405" : { + "description" : "Validation exception" + } + }, + "security" : [ { + "petstore_auth" : [ "write:pets", "read:pets" ] + } ] + } + }, + "/pet/findByStatus" : { + "get" : { + "tags" : [ "pet" ], + "summary" : "Finds Pets by status", + "description" : "Multiple status values can be provided with comma separated strings", + "operationId" : "findPetsByStatus", + "produces" : [ "application/xml", "application/json" ], + "parameters" : [ { + "name" : "status", + "in" : "query", + "description" : "Status values that need to be considered for filter", + "required" : true, + "type" : "array", + "items" : { + "type" : "string", + "enum" : [ "available", "pending", "sold" ], + "default" : "available" + }, + "collectionFormat" : "csv" + } ], + "responses" : { + "200" : { + "description" : "successful operation", + "schema" : { + "type" : "array", + "items" : { + "$ref" : "#/definitions/Pet" + } + } + }, + "400" : { + "description" : "Invalid status value" + } + }, + "security" : [ { + "petstore_auth" : [ "write:pets", "read:pets" ] + } ] + } + }, + "/pet/findByTags" : { + "get" : { + "tags" : [ "pet" ], + "summary" : "Finds Pets by tags", + "description" : "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", + "operationId" : "findPetsByTags", + "produces" : [ "application/xml", "application/json" ], + "parameters" : [ { + "name" : "tags", + "in" : "query", + "description" : "Tags to filter by", + "required" : true, + "type" : "array", + "items" : { + "type" : "string" + }, + "collectionFormat" : "csv" + } ], + "responses" : { + "200" : { + "description" : "successful operation", + "schema" : { + "type" : "array", + "items" : { + "$ref" : "#/definitions/Pet" + } + } + }, + "400" : { + "description" : "Invalid tag value" + } + }, + "security" : [ { + "petstore_auth" : [ "write:pets", "read:pets" ] + } ], + "deprecated" : true + } + }, + "/pet/{petId}" : { + "get" : { + "tags" : [ "pet" ], + "summary" : "Find pet by ID", + "description" : "Returns a single pet", + "operationId" : "getPetById", + "produces" : [ "application/xml", "application/json" ], + "parameters" : [ { + "name" : "petId", + "in" : "path", + "description" : "ID of pet to return", + "required" : true, + "type" : "integer", + "format" : "int64" + } ], + "responses" : { + "200" : { + "description" : "successful operation", + "schema" : { + "$ref" : "#/definitions/Pet" + } + }, + "400" : { + "description" : "Invalid ID supplied" + }, + "404" : { + "description" : "Pet not found" + } + }, + "security" : [ { + "api_key" : [ ] + } ] + }, + "post" : { + "tags" : [ "pet" ], + "summary" : "Updates a pet in the store with form data", + "description" : "", + "operationId" : "updatePetWithForm", + "consumes" : [ "application/x-www-form-urlencoded" ], + "produces" : [ "application/xml", "application/json" ], + "parameters" : [ { + "name" : "petId", + "in" : "path", + "description" : "ID of pet that needs to be updated", + "required" : true, + "type" : "integer", + "format" : "int64" + }, { + "name" : "name", + "in" : "formData", + "description" : "Updated name of the pet", + "required" : false, + "type" : "string" + }, { + "name" : "status", + "in" : "formData", + "description" : "Updated status of the pet", + "required" : false, + "type" : "string" + } ], + "responses" : { + "405" : { + "description" : "Invalid input" + } + }, + "security" : [ { + "petstore_auth" : [ "write:pets", "read:pets" ] + } ] + }, + "delete" : { + "tags" : [ "pet" ], + "summary" : "Deletes a pet", + "description" : "", + "operationId" : "deletePet", + "produces" : [ "application/xml", "application/json" ], + "parameters" : [ { + "name" : "api_key", + "in" : "header", + "required" : false, + "type" : "string" + }, { + "name" : "petId", + "in" : "path", + "description" : "Pet id to delete", + "required" : true, + "type" : "integer", + "format" : "int64" + } ], + "responses" : { + "400" : { + "description" : "Invalid pet value" + } + }, + "security" : [ { + "petstore_auth" : [ "write:pets", "read:pets" ] + } ] + } + }, + "/pet/{petId}/uploadImage" : { + "post" : { + "tags" : [ "pet" ], + "summary" : "uploads an image", + "description" : "", + "operationId" : "uploadFile", + "consumes" : [ "multipart/form-data" ], + "produces" : [ "application/json" ], + "parameters" : [ { + "name" : "petId", + "in" : "path", + "description" : "ID of pet to update", + "required" : true, + "type" : "integer", + "format" : "int64" + }, { + "name" : "additionalMetadata", + "in" : "formData", + "description" : "Additional data to pass to server", + "required" : false, + "type" : "string" + }, { + "name" : "file", + "in" : "formData", + "description" : "file to upload", + "required" : false, + "type" : "file" + } ], + "responses" : { + "200" : { + "description" : "successful operation", + "schema" : { + "$ref" : "#/definitions/ApiResponse" + } + } + }, + "security" : [ { + "petstore_auth" : [ "write:pets", "read:pets" ] + } ] + } + }, + "/store/inventory" : { + "get" : { + "tags" : [ "store" ], + "summary" : "Returns pet inventories by status", + "description" : "Returns a map of status codes to quantities", + "operationId" : "getInventory", + "produces" : [ "application/json" ], + "parameters" : [ ], + "responses" : { + "200" : { + "description" : "successful operation", + "schema" : { + "type" : "object", + "additionalProperties" : { + "type" : "integer", + "format" : "int32" + } + } + } + }, + "security" : [ { + "api_key" : [ ] + } ] + } + }, + "/store/order" : { + "post" : { + "tags" : [ "store" ], + "summary" : "Place an order for a pet", + "description" : "", + "operationId" : "placeOrder", + "produces" : [ "application/xml", "application/json" ], + "parameters" : [ { + "in" : "body", + "name" : "body", + "description" : "order placed for purchasing the pet", + "required" : true, + "schema" : { + "$ref" : "#/definitions/Order" + } + } ], + "responses" : { + "200" : { + "description" : "successful operation", + "schema" : { + "$ref" : "#/definitions/Order" + } + }, + "400" : { + "description" : "Invalid Order" + } + } + } + }, + "/store/order/{order_id}" : { + "get" : { + "tags" : [ "store" ], + "summary" : "Find purchase order by ID", + "description" : "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", + "operationId" : "getOrderById", + "produces" : [ "application/xml", "application/json" ], + "parameters" : [ { + "name" : "order_id", + "in" : "path", + "description" : "ID of pet that needs to be fetched", + "required" : true, + "type" : "integer", + "maximum" : 5, + "minimum" : 1, + "format" : "int64" + } ], + "responses" : { + "200" : { + "description" : "successful operation", + "schema" : { + "$ref" : "#/definitions/Order" + } + }, + "400" : { + "description" : "Invalid ID supplied" + }, + "404" : { + "description" : "Order not found" + } + } + }, + "delete" : { + "tags" : [ "store" ], + "summary" : "Delete purchase order by ID", + "description" : "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", + "operationId" : "deleteOrder", + "produces" : [ "application/xml", "application/json" ], + "parameters" : [ { + "name" : "order_id", + "in" : "path", + "description" : "ID of the order that needs to be deleted", + "required" : true, + "type" : "string" + } ], + "responses" : { + "400" : { + "description" : "Invalid ID supplied" + }, + "404" : { + "description" : "Order not found" + } + } + } + }, + "/user" : { + "post" : { + "tags" : [ "user" ], + "summary" : "Create user", + "description" : "This can only be done by the logged in user.", + "operationId" : "createUser", + "produces" : [ "application/xml", "application/json" ], + "parameters" : [ { + "in" : "body", + "name" : "body", + "description" : "Created user object", + "required" : true, + "schema" : { + "$ref" : "#/definitions/User" + } + } ], + "responses" : { + "default" : { + "description" : "successful operation" + } + } + } + }, + "/user/createWithArray" : { + "post" : { + "tags" : [ "user" ], + "summary" : "Creates list of users with given input array", + "description" : "", + "operationId" : "createUsersWithArrayInput", + "produces" : [ "application/xml", "application/json" ], + "parameters" : [ { + "in" : "body", + "name" : "body", + "description" : "List of user object", + "required" : true, + "schema" : { + "type" : "array", + "items" : { + "$ref" : "#/definitions/User" + } + } + } ], + "responses" : { + "default" : { + "description" : "successful operation" + } + } + } + }, + "/user/createWithList" : { + "post" : { + "tags" : [ "user" ], + "summary" : "Creates list of users with given input array", + "description" : "", + "operationId" : "createUsersWithListInput", + "produces" : [ "application/xml", "application/json" ], + "parameters" : [ { + "in" : "body", + "name" : "body", + "description" : "List of user object", + "required" : true, + "schema" : { + "type" : "array", + "items" : { + "$ref" : "#/definitions/User" + } + } + } ], + "responses" : { + "default" : { + "description" : "successful operation" + } + } + } + }, + "/user/login" : { + "get" : { + "tags" : [ "user" ], + "summary" : "Logs user into the system", + "description" : "", + "operationId" : "loginUser", + "produces" : [ "application/xml", "application/json" ], + "parameters" : [ { + "name" : "username", + "in" : "query", + "description" : "The user name for login", + "required" : true, + "type" : "string" + }, { + "name" : "password", + "in" : "query", + "description" : "The password for login in clear text", + "required" : true, + "type" : "string" + } ], + "responses" : { + "200" : { + "description" : "successful operation", + "schema" : { + "type" : "string" + }, + "headers" : { + "X-Rate-Limit" : { + "type" : "integer", + "format" : "int32", + "description" : "calls per hour allowed by the user" + }, + "X-Expires-After" : { + "type" : "string", + "format" : "date-time", + "description" : "date in UTC when toekn expires" + } + } + }, + "400" : { + "description" : "Invalid username/password supplied" + } + } + } + }, + "/user/logout" : { + "get" : { + "tags" : [ "user" ], + "summary" : "Logs out current logged in user session", + "description" : "", + "operationId" : "logoutUser", + "produces" : [ "application/xml", "application/json" ], + "parameters" : [ ], + "responses" : { + "default" : { + "description" : "successful operation" + } + } + } + }, + "/user/{username}" : { + "get" : { + "tags" : [ "user" ], + "summary" : "Get user by user name", + "description" : "", + "operationId" : "getUserByName", + "produces" : [ "application/xml", "application/json" ], + "parameters" : [ { + "name" : "username", + "in" : "path", + "description" : "The name that needs to be fetched. Use user1 for testing. ", + "required" : true, + "type" : "string" + } ], + "responses" : { + "200" : { + "description" : "successful operation", + "schema" : { + "$ref" : "#/definitions/User" + } + }, + "400" : { + "description" : "Invalid username supplied" + }, + "404" : { + "description" : "User not found" + } + } + }, + "put" : { + "tags" : [ "user" ], + "summary" : "Updated user", + "description" : "This can only be done by the logged in user.", + "operationId" : "updateUser", + "produces" : [ "application/xml", "application/json" ], + "parameters" : [ { + "name" : "username", + "in" : "path", + "description" : "name that need to be deleted", + "required" : true, + "type" : "string" + }, { + "in" : "body", + "name" : "body", + "description" : "Updated user object", + "required" : true, + "schema" : { + "$ref" : "#/definitions/User" + } + } ], + "responses" : { + "400" : { + "description" : "Invalid user supplied" + }, + "404" : { + "description" : "User not found" + } + } + }, + "delete" : { + "tags" : [ "user" ], + "summary" : "Delete user", + "description" : "This can only be done by the logged in user.", + "operationId" : "deleteUser", + "produces" : [ "application/xml", "application/json" ], + "parameters" : [ { + "name" : "username", + "in" : "path", + "description" : "The name that needs to be deleted", + "required" : true, + "type" : "string" + } ], + "responses" : { + "400" : { + "description" : "Invalid username supplied" + }, + "404" : { + "description" : "User not found" + } + } + } + }, + "/fake_classname_test" : { + "patch" : { + "tags" : [ "fake_classname_tags 123#$%^" ], + "summary" : "To test class name in snake case", + "operationId" : "testClassname", + "consumes" : [ "application/json" ], + "produces" : [ "application/json" ], + "parameters" : [ { + "in" : "body", + "name" : "body", + "description" : "client model", + "required" : true, + "schema" : { + "$ref" : "#/definitions/Client" + } + } ], + "responses" : { + "200" : { + "description" : "successful operation", + "schema" : { + "$ref" : "#/definitions/Client" + } + } + }, + "security" : [ { + "api_key_query" : [ ] + } ] + } + }, + "/fake" : { + "get" : { + "tags" : [ "fake" ], + "summary" : "To test enum parameters", + "description" : "To test enum parameters", + "operationId" : "testEnumParameters", + "consumes" : [ "*/*" ], + "produces" : [ "*/*" ], + "parameters" : [ { + "name" : "enum_form_string_array", + "in" : "formData", + "description" : "Form parameter enum test (string array)", + "required" : false, + "type" : "array", + "items" : { + "type" : "string", + "enum" : [ ">", "$" ], + "default" : "$" + } + }, { + "name" : "enum_form_string", + "in" : "formData", + "description" : "Form parameter enum test (string)", + "required" : false, + "type" : "string", + "default" : "-efg", + "enum" : [ "_abc", "-efg", "(xyz)" ] + }, { + "name" : "enum_header_string_array", + "in" : "header", + "description" : "Header parameter enum test (string array)", + "required" : false, + "type" : "array", + "items" : { + "type" : "string", + "enum" : [ ">", "$" ], + "default" : "$" + } + }, { + "name" : "enum_header_string", + "in" : "header", + "description" : "Header parameter enum test (string)", + "required" : false, + "type" : "string", + "default" : "-efg", + "enum" : [ "_abc", "-efg", "(xyz)" ] + }, { + "name" : "enum_query_string_array", + "in" : "query", + "description" : "Query parameter enum test (string array)", + "required" : false, + "type" : "array", + "items" : { + "type" : "string", + "enum" : [ ">", "$" ], + "default" : "$" + } + }, { + "name" : "enum_query_string", + "in" : "query", + "description" : "Query parameter enum test (string)", + "required" : false, + "type" : "string", + "default" : "-efg", + "enum" : [ "_abc", "-efg", "(xyz)" ] + }, { + "name" : "enum_query_integer", + "in" : "query", + "description" : "Query parameter enum test (double)", + "required" : false, + "type" : "integer", + "format" : "int32", + "enum" : [ 1, -2 ] + }, { + "name" : "enum_query_double", + "in" : "formData", + "description" : "Query parameter enum test (double)", + "required" : false, + "type" : "number", + "format" : "double", + "enum" : [ 1.1, -1.2 ] + } ], + "responses" : { + "400" : { + "description" : "Invalid request" + }, + "404" : { + "description" : "Not found" + } + } + }, + "post" : { + "tags" : [ "fake" ], + "summary" : "Fake endpoint for testing various parameters\n假端點\n偽のエンドポイント\n가짜 엔드 포인트\n", + "description" : "Fake endpoint for testing various parameters\n假端點\n偽のエンドポイント\n가짜 엔드 포인트\n", + "operationId" : "testEndpointParameters", + "consumes" : [ "application/xml; charset=utf-8", "application/json; charset=utf-8" ], + "produces" : [ "application/xml; charset=utf-8", "application/json; charset=utf-8" ], + "parameters" : [ { + "name" : "integer", + "in" : "formData", + "description" : "None", + "required" : false, + "type" : "integer", + "maximum" : 100, + "minimum" : 10 + }, { + "name" : "int32", + "in" : "formData", + "description" : "None", + "required" : false, + "type" : "integer", + "maximum" : 200, + "minimum" : 20, + "format" : "int32" + }, { + "name" : "int64", + "in" : "formData", + "description" : "None", + "required" : false, + "type" : "integer", + "format" : "int64" + }, { + "name" : "number", + "in" : "formData", + "description" : "None", + "required" : true, + "type" : "number", + "maximum" : 543.2, + "minimum" : 32.1 + }, { + "name" : "float", + "in" : "formData", + "description" : "None", + "required" : false, + "type" : "number", + "maximum" : 987.6, + "format" : "float" + }, { + "name" : "double", + "in" : "formData", + "description" : "None", + "required" : true, + "type" : "number", + "maximum" : 123.4, + "minimum" : 67.8, + "format" : "double" + }, { + "name" : "string", + "in" : "formData", + "description" : "None", + "required" : false, + "type" : "string", + "pattern" : "/[a-z]/i" + }, { + "name" : "pattern_without_delimiter", + "in" : "formData", + "description" : "None", + "required" : true, + "type" : "string", + "pattern" : "^[A-Z].*" + }, { + "name" : "byte", + "in" : "formData", + "description" : "None", + "required" : true, + "type" : "string", + "format" : "byte" + }, { + "name" : "binary", + "in" : "formData", + "description" : "None", + "required" : false, + "type" : "string", + "format" : "binary" + }, { + "name" : "date", + "in" : "formData", + "description" : "None", + "required" : false, + "type" : "string", + "format" : "date" + }, { + "name" : "dateTime", + "in" : "formData", + "description" : "None", + "required" : false, + "type" : "string", + "format" : "date-time" + }, { + "name" : "password", + "in" : "formData", + "description" : "None", + "required" : false, + "type" : "string", + "maxLength" : 64, + "minLength" : 10, + "format" : "password" + }, { + "name" : "callback", + "in" : "formData", + "description" : "None", + "required" : false, + "type" : "string" + } ], + "responses" : { + "400" : { + "description" : "Invalid username supplied" + }, + "404" : { + "description" : "User not found" + } + }, + "security" : [ { + "http_basic_test" : [ ] + } ] + }, + "patch" : { + "tags" : [ "fake" ], + "summary" : "To test \"client\" model", + "description" : "To test \"client\" model", + "operationId" : "testClientModel", + "consumes" : [ "application/json" ], + "produces" : [ "application/json" ], + "parameters" : [ { + "in" : "body", + "name" : "body", + "description" : "client model", + "required" : true, + "schema" : { + "$ref" : "#/definitions/Client" + } + } ], + "responses" : { + "200" : { + "description" : "successful operation", + "schema" : { + "$ref" : "#/definitions/Client" + } + } + } + } + }, + "/fake/outer/number" : { + "post" : { + "tags" : [ "fake" ], + "description" : "Test serialization of outer number types", + "operationId" : "fakeOuterNumberSerialize", + "parameters" : [ { + "in" : "body", + "name" : "body", + "description" : "Input number as post body", + "required" : false, + "schema" : { + "$ref" : "#/definitions/OuterNumber" + } + } ], + "responses" : { + "200" : { + "description" : "Output number", + "schema" : { + "$ref" : "#/definitions/OuterNumber" + } + } + } + } + }, + "/fake/outer/string" : { + "post" : { + "tags" : [ "fake" ], + "description" : "Test serialization of outer string types", + "operationId" : "fakeOuterStringSerialize", + "parameters" : [ { + "in" : "body", + "name" : "body", + "description" : "Input string as post body", + "required" : false, + "schema" : { + "$ref" : "#/definitions/OuterString" + } + } ], + "responses" : { + "200" : { + "description" : "Output string", + "schema" : { + "$ref" : "#/definitions/OuterString" + } + } + } + } + }, + "/fake/outer/boolean" : { + "post" : { + "tags" : [ "fake" ], + "description" : "Test serialization of outer boolean types", + "operationId" : "fakeOuterBooleanSerialize", + "parameters" : [ { + "in" : "body", + "name" : "body", + "description" : "Input boolean as post body", + "required" : false, + "schema" : { + "$ref" : "#/definitions/OuterBoolean" + } + } ], + "responses" : { + "200" : { + "description" : "Output boolean", + "schema" : { + "$ref" : "#/definitions/OuterBoolean" + } + } + } + } + }, + "/fake/outer/composite" : { + "post" : { + "tags" : [ "fake" ], + "description" : "Test serialization of object with outer number type", + "operationId" : "fakeOuterCompositeSerialize", + "parameters" : [ { + "in" : "body", + "name" : "body", + "description" : "Input composite as post body", + "required" : false, + "schema" : { + "$ref" : "#/definitions/OuterComposite" + } + } ], + "responses" : { + "200" : { + "description" : "Output composite", + "schema" : { + "$ref" : "#/definitions/OuterComposite" + } + } + } + } + }, + "/fake/jsonFormData" : { + "get" : { + "tags" : [ "fake" ], + "summary" : "test json serialization of form data", + "description" : "", + "operationId" : "testJsonFormData", + "consumes" : [ "application/json" ], + "parameters" : [ { + "name" : "param", + "in" : "formData", + "description" : "field1", + "required" : true, + "type" : "string" + }, { + "name" : "param2", + "in" : "formData", + "description" : "field2", + "required" : true, + "type" : "string" + } ], + "responses" : { + "200" : { + "description" : "successful operation" + } + } + } + }, + "/fake/inline-additionalProperties" : { + "post" : { + "tags" : [ "fake" ], + "summary" : "test inline additionalProperties", + "description" : "", + "operationId" : "testInlineAdditionalProperties", + "consumes" : [ "application/json" ], + "parameters" : [ { + "in" : "body", + "name" : "param", + "description" : "request body", + "required" : true, + "schema" : { + "type" : "object", + "additionalProperties" : { + "type" : "string" + } + } + } ], + "responses" : { + "200" : { + "description" : "successful operation" + } + } + } + }, + "/another-fake/dummy" : { + "patch" : { + "tags" : [ "$another-fake?" ], + "summary" : "To test special tags", + "description" : "To test special tags", + "operationId" : "test_special_tags", + "consumes" : [ "application/json" ], + "produces" : [ "application/json" ], + "parameters" : [ { + "in" : "body", + "name" : "body", + "description" : "client model", + "required" : true, + "schema" : { + "$ref" : "#/definitions/Client" + } + } ], + "responses" : { + "200" : { + "description" : "successful operation", + "schema" : { + "$ref" : "#/definitions/Client" + } + } + } + } + } + }, + "securityDefinitions" : { + "petstore_auth" : { + "type" : "oauth2", + "authorizationUrl" : "http://petstore.swagger.io/api/oauth/dialog", + "flow" : "implicit", + "scopes" : { + "write:pets" : "modify pets in your account", + "read:pets" : "read your pets" + } + }, + "api_key" : { + "type" : "apiKey", + "name" : "api_key", + "in" : "header" + }, + "api_key_query" : { + "type" : "apiKey", + "name" : "api_key_query", + "in" : "query" + }, + "http_basic_test" : { + "type" : "basic" + } + }, + "definitions" : { + "Order" : { + "type" : "object", + "properties" : { + "id" : { + "type" : "integer", + "format" : "int64" + }, + "petId" : { + "type" : "integer", + "format" : "int64" + }, + "quantity" : { + "type" : "integer", + "format" : "int32" + }, + "shipDate" : { + "type" : "string", + "format" : "date-time" + }, + "status" : { + "type" : "string", + "description" : "Order Status", + "enum" : [ "placed", "approved", "delivered" ] + }, + "complete" : { + "type" : "boolean", + "default" : false + } + }, + "xml" : { + "name" : "Order" + } + }, + "Category" : { + "type" : "object", + "properties" : { + "id" : { + "type" : "integer", + "format" : "int64" + }, + "name" : { + "type" : "string" + } + }, + "xml" : { + "name" : "Category" + } + }, + "User" : { + "type" : "object", + "properties" : { + "id" : { + "type" : "integer", + "format" : "int64", + "x-is-unique" : true + }, + "username" : { + "type" : "string" + }, + "firstName" : { + "type" : "string" + }, + "lastName" : { + "type" : "string" + }, + "email" : { + "type" : "string" + }, + "password" : { + "type" : "string" + }, + "phone" : { + "type" : "string" + }, + "userStatus" : { + "type" : "integer", + "format" : "int32", + "description" : "User Status" + } + }, + "xml" : { + "name" : "User" + } + }, + "Tag" : { + "type" : "object", + "properties" : { + "id" : { + "type" : "integer", + "format" : "int64" + }, + "name" : { + "type" : "string" + } + }, + "xml" : { + "name" : "Tag" + } + }, + "Pet" : { + "type" : "object", + "required" : [ "name", "photoUrls" ], + "properties" : { + "id" : { + "type" : "integer", + "format" : "int64", + "x-is-unique" : true + }, + "category" : { + "$ref" : "#/definitions/Category" + }, + "name" : { + "type" : "string", + "example" : "doggie" + }, + "photoUrls" : { + "type" : "array", + "xml" : { + "name" : "photoUrl", + "wrapped" : true + }, + "items" : { + "type" : "string" + } + }, + "tags" : { + "type" : "array", + "xml" : { + "name" : "tag", + "wrapped" : true + }, + "items" : { + "$ref" : "#/definitions/Tag" + } + }, + "status" : { + "type" : "string", + "description" : "pet status in the store", + "enum" : [ "available", "pending", "sold" ] + } + }, + "xml" : { + "name" : "Pet" + } + }, + "ApiResponse" : { + "type" : "object", + "properties" : { + "code" : { + "type" : "integer", + "format" : "int32" + }, + "type" : { + "type" : "string" + }, + "message" : { + "type" : "string" + } + } + }, + "$special[model.name]" : { + "properties" : { + "$special[property.name]" : { + "type" : "integer", + "format" : "int64" + } + }, + "xml" : { + "name" : "$special[model.name]" + } + }, + "Return" : { + "properties" : { + "return" : { + "type" : "integer", + "format" : "int32" + } + }, + "description" : "Model for testing reserved words", + "xml" : { + "name" : "Return" + } + }, + "Name" : { + "required" : [ "name" ], + "properties" : { + "name" : { + "type" : "integer", + "format" : "int32" + }, + "snake_case" : { + "type" : "integer", + "format" : "int32", + "readOnly" : true + }, + "property" : { + "type" : "string" + }, + "123Number" : { + "type" : "integer", + "readOnly" : true + } + }, + "description" : "Model for testing model name same as property name", + "xml" : { + "name" : "Name" + } + }, + "200_response" : { + "properties" : { + "name" : { + "type" : "integer", + "format" : "int32" + }, + "class" : { + "type" : "string" + } + }, + "description" : "Model for testing model name starting with number", + "xml" : { + "name" : "Name" + } + }, + "ClassModel" : { + "properties" : { + "_class" : { + "type" : "string" + } + }, + "description" : "Model for testing model with \"_class\" property" + }, + "Dog" : { + "allOf" : [ { + "$ref" : "#/definitions/Animal" + }, { + "type" : "object", + "properties" : { + "breed" : { + "type" : "string" + } + } + } ] + }, + "Cat" : { + "allOf" : [ { + "$ref" : "#/definitions/Animal" + }, { + "type" : "object", + "properties" : { + "declawed" : { + "type" : "boolean" + } + } + } ] + }, + "Animal" : { + "type" : "object", + "required" : [ "className" ], + "discriminator" : "className", + "properties" : { + "className" : { + "type" : "string" + }, + "color" : { + "type" : "string", + "default" : "red" + } + } + }, + "AnimalFarm" : { + "type" : "array", + "items" : { + "$ref" : "#/definitions/Animal" + } + }, + "format_test" : { + "type" : "object", + "required" : [ "byte", "date", "number", "password" ], + "properties" : { + "integer" : { + "type" : "integer", + "minimum" : 10, + "maximum" : 100 + }, + "int32" : { + "type" : "integer", + "format" : "int32", + "minimum" : 20, + "maximum" : 200 + }, + "int64" : { + "type" : "integer", + "format" : "int64" + }, + "number" : { + "type" : "number", + "minimum" : 32.1, + "maximum" : 543.2 + }, + "float" : { + "type" : "number", + "format" : "float", + "minimum" : 54.3, + "maximum" : 987.6 + }, + "double" : { + "type" : "number", + "format" : "double", + "minimum" : 67.8, + "maximum" : 123.4 + }, + "string" : { + "type" : "string", + "pattern" : "/[a-z]/i" + }, + "byte" : { + "type" : "string", + "format" : "byte", + "pattern" : "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$" + }, + "binary" : { + "type" : "string", + "format" : "binary" + }, + "date" : { + "type" : "string", + "format" : "date" + }, + "dateTime" : { + "type" : "string", + "format" : "date-time" + }, + "uuid" : { + "type" : "string", + "format" : "uuid" + }, + "password" : { + "type" : "string", + "format" : "password", + "minLength" : 10, + "maxLength" : 64 + } + } + }, + "EnumClass" : { + "type" : "string", + "enum" : [ "_abc", "-efg", "(xyz)" ], + "default" : "-efg" + }, + "Enum_Test" : { + "type" : "object", + "properties" : { + "enum_string" : { + "type" : "string", + "enum" : [ "UPPER", "lower", "" ] + }, + "enum_integer" : { + "type" : "integer", + "format" : "int32", + "enum" : [ 1, -1 ] + }, + "enum_number" : { + "type" : "number", + "format" : "double", + "enum" : [ 1.1, -1.2 ] + }, + "outerEnum" : { + "$ref" : "#/definitions/OuterEnum" + } + } + }, + "AdditionalPropertiesClass" : { + "type" : "object", + "properties" : { + "map_property" : { + "type" : "object", + "additionalProperties" : { + "type" : "string" + } + }, + "map_of_map_property" : { + "type" : "object", + "additionalProperties" : { + "type" : "object", + "additionalProperties" : { + "type" : "string" + } + } + } + } + }, + "MixedPropertiesAndAdditionalPropertiesClass" : { + "type" : "object", + "properties" : { + "uuid" : { + "type" : "string", + "format" : "uuid" + }, + "dateTime" : { + "type" : "string", + "format" : "date-time" + }, + "map" : { + "type" : "object", + "additionalProperties" : { + "$ref" : "#/definitions/Animal" + } + } + } + }, + "List" : { + "type" : "object", + "properties" : { + "123-list" : { + "type" : "string" + } + } + }, + "Client" : { + "type" : "object", + "properties" : { + "client" : { + "type" : "string" + } + } + }, + "ReadOnlyFirst" : { + "type" : "object", + "properties" : { + "bar" : { + "type" : "string", + "readOnly" : true + }, + "baz" : { + "type" : "string" + } + } + }, + "hasOnlyReadOnly" : { + "type" : "object", + "properties" : { + "bar" : { + "type" : "string", + "readOnly" : true + }, + "foo" : { + "type" : "string", + "readOnly" : true + } + } + }, + "Capitalization" : { + "type" : "object", + "properties" : { + "smallCamel" : { + "type" : "string" + }, + "CapitalCamel" : { + "type" : "string" + }, + "small_Snake" : { + "type" : "string" + }, + "Capital_Snake" : { + "type" : "string" + }, + "SCA_ETH_Flow_Points" : { + "type" : "string" + }, + "ATT_NAME" : { + "type" : "string", + "description" : "Name of the pet\n" + } + } + }, + "MapTest" : { + "type" : "object", + "properties" : { + "map_map_of_string" : { + "type" : "object", + "additionalProperties" : { + "type" : "object", + "additionalProperties" : { + "type" : "string" + } + } + }, + "map_of_enum_string" : { + "type" : "object", + "additionalProperties" : { + "type" : "string", + "enum" : [ "UPPER", "lower" ] + } + } + } + }, + "ArrayTest" : { + "type" : "object", + "properties" : { + "array_of_string" : { + "type" : "array", + "items" : { + "type" : "string" + } + }, + "array_array_of_integer" : { + "type" : "array", + "items" : { + "type" : "array", + "items" : { + "type" : "integer", + "format" : "int64" + } + } + }, + "array_array_of_model" : { + "type" : "array", + "items" : { + "type" : "array", + "items" : { + "$ref" : "#/definitions/ReadOnlyFirst" + } + } + } + } + }, + "NumberOnly" : { + "type" : "object", + "properties" : { + "JustNumber" : { + "type" : "number" + } + } + }, + "ArrayOfNumberOnly" : { + "type" : "object", + "properties" : { + "ArrayNumber" : { + "type" : "array", + "items" : { + "type" : "number" + } + } + } + }, + "ArrayOfArrayOfNumberOnly" : { + "type" : "object", + "properties" : { + "ArrayArrayNumber" : { + "type" : "array", + "items" : { + "type" : "array", + "items" : { + "type" : "number" + } + } + } + } + }, + "EnumArrays" : { + "type" : "object", + "properties" : { + "just_symbol" : { + "type" : "string", + "enum" : [ ">=", "$" ] + }, + "array_enum" : { + "type" : "array", + "items" : { + "type" : "string", + "enum" : [ "fish", "crab" ] + } + } + } + }, + "OuterEnum" : { + "type" : "string", + "enum" : [ "placed", "approved", "delivered" ] + }, + "OuterComposite" : { + "type" : "object", + "properties" : { + "my_number" : { + "$ref" : "#/definitions/OuterNumber" + }, + "my_string" : { + "$ref" : "#/definitions/OuterString" + }, + "my_boolean" : { + "$ref" : "#/definitions/OuterBoolean" + } + } + }, + "OuterNumber" : { + "type" : "number" + }, + "OuterString" : { + "type" : "string" + }, + "OuterBoolean" : { + "type" : "boolean" + } + }, + "externalDocs" : { + "description" : "Find out more about Swagger", + "url" : "http://swagger.io" + } +} \ No newline at end of file diff --git a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/io/swagger/model/EnumArrays.java b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/io/swagger/model/EnumArrays.java index 595f687217d4..0ed8a2bf521c 100644 --- a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/io/swagger/model/EnumArrays.java +++ b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/io/swagger/model/EnumArrays.java @@ -31,10 +31,12 @@ public String value() { } @Override + @JsonValue public String toString() { return String.valueOf(value); } + @JsonCreator public static JustSymbolEnum fromValue(String v) { for (JustSymbolEnum b : JustSymbolEnum.values()) { if (String.valueOf(b.value).equals(v)) { @@ -63,10 +65,12 @@ public String value() { } @Override + @JsonValue public String toString() { return String.valueOf(value); } + @JsonCreator public static ArrayEnumEnum fromValue(String v) { for (ArrayEnumEnum b : ArrayEnumEnum.values()) { if (String.valueOf(b.value).equals(v)) { diff --git a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/io/swagger/model/EnumTest.java b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/io/swagger/model/EnumTest.java index d704287dd95e..7fdc1ad96d7b 100644 --- a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/io/swagger/model/EnumTest.java +++ b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/io/swagger/model/EnumTest.java @@ -30,10 +30,12 @@ public String value() { } @Override + @JsonValue public String toString() { return String.valueOf(value); } + @JsonCreator public static EnumStringEnum fromValue(String v) { for (EnumStringEnum b : EnumStringEnum.values()) { if (String.valueOf(b.value).equals(v)) { @@ -62,10 +64,12 @@ public String value() { } @Override + @JsonValue public String toString() { return String.valueOf(value); } + @JsonCreator public static EnumIntegerEnum fromValue(String v) { for (EnumIntegerEnum b : EnumIntegerEnum.values()) { if (String.valueOf(b.value).equals(v)) { @@ -94,10 +98,12 @@ public String value() { } @Override + @JsonValue public String toString() { return String.valueOf(value); } + @JsonCreator public static EnumNumberEnum fromValue(String v) { for (EnumNumberEnum b : EnumNumberEnum.values()) { if (String.valueOf(b.value).equals(v)) { diff --git a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/io/swagger/model/MapTest.java b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/io/swagger/model/MapTest.java index 54abae05490f..6a11ab8cbf65 100644 --- a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/io/swagger/model/MapTest.java +++ b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/io/swagger/model/MapTest.java @@ -33,10 +33,12 @@ public String value() { } @Override + @JsonValue public String toString() { return String.valueOf(value); } + @JsonCreator public static InnerEnum fromValue(String v) { for (InnerEnum b : InnerEnum.values()) { if (String.valueOf(b.value).equals(v)) { diff --git a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/io/swagger/model/Order.java b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/io/swagger/model/Order.java index f7665f15a54c..393f06ff0397 100644 --- a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/io/swagger/model/Order.java +++ b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/io/swagger/model/Order.java @@ -34,10 +34,12 @@ public String value() { } @Override + @JsonValue public String toString() { return String.valueOf(value); } + @JsonCreator public static StatusEnum fromValue(String v) { for (StatusEnum b : StatusEnum.values()) { if (String.valueOf(b.value).equals(v)) { diff --git a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/io/swagger/model/Pet.java b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/io/swagger/model/Pet.java index fc8a6796b795..1c9f88d1401d 100644 --- a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/io/swagger/model/Pet.java +++ b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/io/swagger/model/Pet.java @@ -38,10 +38,12 @@ public String value() { } @Override + @JsonValue public String toString() { return String.valueOf(value); } + @JsonCreator public static StatusEnum fromValue(String v) { for (StatusEnum b : StatusEnum.values()) { if (String.valueOf(b.value).equals(v)) {