diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java
index 0aa51ccb845..40b676149a2 100644
--- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java
+++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java
@@ -143,7 +143,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
for (String templateName : config.modelTemplateFiles().keySet()) {
String suffix = config.modelTemplateFiles().get(templateName);
String filename = config.modelFileFolder() + File.separator + config.toModelFilename(name) + suffix;
- if ( new File(filename).exists() && !config.shouldOverwrite(filename)) {
+ if (!config.shouldOverwrite(filename)) {
continue;
}
String templateFile = getFullTemplateFile(config, templateName);
@@ -195,7 +195,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
for (String templateName : config.apiTemplateFiles().keySet()) {
String filename = config.apiFilename(templateName, tag);
- if( new File( filename ).exists() && !config.shouldOverwrite(filename)) {
+ if (!config.shouldOverwrite(filename) && new File(filename).exists()) {
continue;
}
@@ -267,7 +267,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
of.mkdirs();
}
String outputFilename = outputFolder + File.separator + support.destinationFilename;
- if (new File( outputFilename ).exists() && !config.shouldOverwrite(outputFilename)) {
+ if (!config.shouldOverwrite(outputFilename)) {
continue;
}
diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JaxRSServerCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JaxRSServerCodegen.java
index 6d83ff56a3c..df320797515 100644
--- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JaxRSServerCodegen.java
+++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JaxRSServerCodegen.java
@@ -5,15 +5,11 @@ import io.swagger.codegen.CodegenOperation;
import io.swagger.codegen.CodegenType;
import io.swagger.codegen.SupportingFile;
import io.swagger.models.Operation;
-import io.swagger.models.Swagger;
import io.swagger.models.properties.ArrayProperty;
import io.swagger.models.properties.MapProperty;
import io.swagger.models.properties.Property;
-import io.swagger.util.Json;
import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
@@ -21,7 +17,6 @@ import java.util.List;
import java.util.Map;
public class JaxRSServerCodegen extends JavaClientCodegen implements CodegenConfig {
- public static final String DEFAULT_IMPL_SOURCE_FOLDER = "src/main/java";
protected String invokerPackage = "io.swagger.api";
protected String groupId = "io.swagger";
protected String artifactId = "swagger-jaxrs-server";
@@ -31,9 +26,9 @@ public class JaxRSServerCodegen extends JavaClientCodegen implements CodegenConf
public JaxRSServerCodegen() {
super.processOpts();
- sourceFolder = "target/generated-sources";
+ sourceFolder = "src/gen/java";
- outputFolder = System.getProperty("swagger.codegen.jaxrs.genfolder", "target/generated-sources");
+ outputFolder = System.getProperty("swagger.codegen.jaxrs.genfolder", "generated-code/javaJaxRS");
modelTemplateFiles.put("model.mustache", ".java");
apiTemplateFiles.put("api.mustache", ".java");
apiTemplateFiles.put("apiService.mustache", ".java");
@@ -174,7 +169,7 @@ public class JaxRSServerCodegen extends JavaClientCodegen implements CodegenConf
int ix = result.lastIndexOf('/');
result = result.substring(0, ix) + "/impl" + result.substring(ix, result.length() - 5) + "ServiceImpl.java";
- String output = System.getProperty("swagger.codegen.jaxrs.impl.source", DEFAULT_IMPL_SOURCE_FOLDER);
+ String output = System.getProperty("swagger.codegen.jaxrs.impl.source");
if (output != null) {
result = result.replace(apiFileFolder(), implFileFolder(output));
}
@@ -182,7 +177,7 @@ public class JaxRSServerCodegen extends JavaClientCodegen implements CodegenConf
int ix = result.lastIndexOf('/');
result = result.substring(0, ix) + "/factories" + result.substring(ix, result.length() - 5) + "ServiceFactory.java";
- String output = System.getProperty("swagger.codegen.jaxrs.impl.source", DEFAULT_IMPL_SOURCE_FOLDER);
+ String output = System.getProperty("swagger.codegen.jaxrs.impl.source");
if (output != null) {
result = result.replace(apiFileFolder(), implFileFolder(output));
}
@@ -194,31 +189,11 @@ public class JaxRSServerCodegen extends JavaClientCodegen implements CodegenConf
return result;
}
- @Override
- public void processSwagger(Swagger swagger) {
- super.processSwagger(swagger);
-
- try {
- File file = new File( outputFolder + "/src/main/resources/swagger.json" );
- file.getParentFile().mkdirs();
-
- FileWriter swaggerFile = new FileWriter(file);
- swaggerFile.write( Json.pretty(swagger));
- swaggerFile.flush();
- swaggerFile.close();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
private String implFileFolder(String output) {
return outputFolder + "/" + output + "/" + apiPackage().replace('.', File.separatorChar);
}
public boolean shouldOverwrite(String filename) {
- return filename.startsWith( outputFolder + File.separatorChar + sourceFolder);
-
-// return super.shouldOverwrite(filename) && !filename.endsWith("ServiceImpl.java")
-// && !filename.endsWith("ServiceFactory.java");
+ return super.shouldOverwrite(filename) && !filename.endsWith("ServiceImpl.java") && !filename.endsWith("ServiceFactory.java");
}
}
diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/README.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/README.mustache
index a5281c3eac3..3ffa01fb257 100644
--- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/README.mustache
+++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/README.mustache
@@ -1,5 +1,10 @@
# Swagger generated server
## Overview
-This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project using the
-JAX-RS template.
+This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the
+[swagger-spec](https://github.com/swagger-api/swagger-core/wiki) from a remote server, you can easily generate a server stub. This
+is an example of building a swagger-enabled scalatra server.
+
+This example uses the [scalatra](http://scalatra.org/) framework. To see how to make this your own, look here:
+
+[README](https://github.com/swagger-api/swagger-codegen/tree/master/samples/server-generator/scalatra)
\ No newline at end of file
diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/pom.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/pom.mustache
index c68c755a571..708ca6cac4d 100644
--- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/pom.mustache
+++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/pom.mustache
@@ -50,6 +50,7 @@
0
+ true
@@ -74,29 +75,12 @@
- target/generated-sources
+ src/gen/java
-
- io.swagger
- swagger-codegen-maven-plugin
- 2.1.3-SNAPSHOT
-
-
-
- generate
-
-
- src/main/resources/swagger.json
- jaxrs
-
-
-
-
-
@@ -164,7 +148,7 @@
- 1.5.1-SNAPSHOT
+ 1.5.0
9.2.9.v20150224
1.13
1.6.3
diff --git a/modules/swagger-generator/src/main/java/io/swagger/generator/online/Generator.java b/modules/swagger-generator/src/main/java/io/swagger/generator/online/Generator.java
index d59060f39ef..2faef30744b 100644
--- a/modules/swagger-generator/src/main/java/io/swagger/generator/online/Generator.java
+++ b/modules/swagger-generator/src/main/java/io/swagger/generator/online/Generator.java
@@ -37,7 +37,7 @@ public class Generator {
throw new BadRequestException(400, "No swagger specification was supplied");
}
} else {
- swagger = new SwaggerParser().read(node);
+ swagger = new SwaggerParser().read(node, true);
}
if (swagger == null) {
throw new BadRequestException(400, "The swagger specification supplied was not valid");
@@ -97,7 +97,7 @@ public class Generator {
throw new BadRequestException(400, "No swagger specification was supplied");
}
} else {
- swagger = new SwaggerParser().read(node);
+ swagger = new SwaggerParser().read(node, true);
}
if (swagger == null) {
throw new BadRequestException(400, "The swagger specification supplied was not valid");
diff --git a/samples/server/petstore/java-inflector/README.md b/samples/server/petstore/java-inflector/README.md
deleted file mode 100644
index c1309670c5a..00000000000
--- a/samples/server/petstore/java-inflector/README.md
+++ /dev/null
@@ -1,8 +0,0 @@
-# Swagger Inflector
-
-Run with
-
-```
-mvn package jetty:run
-``
-
diff --git a/samples/server/petstore/java-inflector/inflector.yaml b/samples/server/petstore/java-inflector/inflector.yaml
deleted file mode 100644
index 25ec6dde3f2..00000000000
--- a/samples/server/petstore/java-inflector/inflector.yaml
+++ /dev/null
@@ -1,10 +0,0 @@
-controllerPackage: io.swagger.handler
-modelPackage: io.swagger.model
-swaggerUrl: ./src/main/swagger/swagger.json
-modelMappings:
- User : io.swagger.model.User
- Category : io.swagger.model.Category
- Pet : io.swagger.model.Pet
- Tag : io.swagger.model.Tag
- Order : io.swagger.model.Order
-
diff --git a/samples/server/petstore/java-inflector/pom.xml b/samples/server/petstore/java-inflector/pom.xml
deleted file mode 100644
index 6d7dee18a58..00000000000
--- a/samples/server/petstore/java-inflector/pom.xml
+++ /dev/null
@@ -1,174 +0,0 @@
-
-
- org.sonatype.oss
- oss-parent
- 5
-
- 4.0.0
- io.swagger
- swagger-inflector-server
- jar
- swagger-inflector-server
- 1.0.0
-
- 2.2.0
-
-
-
- install
- target
- ${project.artifactId}-${project.version}
-
-
- maven-dependency-plugin
-
-
- package
-
- copy-dependencies
-
-
- ${project.build.directory}/lib
-
-
-
-
-
- org.apache.maven.plugins
- maven-jar-plugin
- 2.4
-
-
- **/logback.xml
-
-
-
- development
- ${project.url}
- ${project.version}
- io.swagger
-
-
-
-
-
- org.eclipse.jetty
- jetty-maven-plugin
- ${jetty-version}
-
- .
-
- inflector.yaml
- src/main/swagger/swagger.yaml
-
- 1
-
- /
-
-
- 8080
- 60000
-
-
-
-
-
-
-
-
- com.fasterxml.jackson.core
- jackson-core
- ${jackson-version}
-
-
- com.fasterxml.jackson.core
- jackson-annotations
- 2.4.0
-
-
- com.fasterxml.jackson.core
- jackson-databind
- ${jackson-version}
-
-
- com.fasterxml.jackson.datatype
- jackson-datatype-joda
- ${jackson-version}
-
-
-
- org.glassfish.jersey.containers
- jersey-container-servlet-core
- ${jersey2-version}
-
-
- org.glassfish.jersey.media
- jersey-media-multipart
- ${jersey2-version}
-
-
- org.glassfish.jersey.core
- jersey-client
- ${jersey2-version}
-
-
- javax.servlet
- servlet-api
- ${servlet-api-version}
- provided
-
-
-
- ch.qos.logback
- logback-classic
- ${logback-version}
-
-
- ch.qos.logback
- logback-core
- ${logback-version}
-
-
- org.slf4j
- slf4j-ext
- ${slf4j-version}
-
-
- org.slf4j
- slf4j-api
- ${slf4j-version}
-
-
-
-
- commons-lang
- commons-lang
- ${commons-lang-version}
-
-
-
-
- io.swagger
- swagger-inflector
- 1.0.0-SNAPSHOT
-
-
-
-
- 1.0.0
- 1.5.0
- 1.0.8
- 2.4.2
- 2.2
- 1.2
- 9.2.9.v20150224
- 2.6
- 2.5
- 2.4
- 2.4
- 1.1
- 1.0.1
- 4.8.2
- 1.6.3
-
-
\ No newline at end of file
diff --git a/samples/server/petstore/java-inflector/src/main/java/io/swagger/handler/PetController.java b/samples/server/petstore/java-inflector/src/main/java/io/swagger/handler/PetController.java
deleted file mode 100644
index 69325871d16..00000000000
--- a/samples/server/petstore/java-inflector/src/main/java/io/swagger/handler/PetController.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package io.swagger.handler;
-
-import io.swagger.inflector.models.RequestContext;
-import io.swagger.inflector.models.ResponseContext;
-import javax.ws.rs.core.Response.Status;
-
-import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
-import java.io.File;
-import java.util.List;
-
-import io.swagger.model.*;
-
-import io.swagger.model.Pet;
-import java.io.File;
-
-public class PetController {
-
- public ResponseContext updatePet(RequestContext request ,Pet body)
- {
- return new ResponseContext().status(Status.INTERNAL_SERVER_ERROR).entity( "Not implemented" );
- }
- public ResponseContext addPet(RequestContext request ,Pet body)
- {
- return new ResponseContext().status(Status.INTERNAL_SERVER_ERROR).entity( "Not implemented" );
- }
- public ResponseContext findPetsByStatus(RequestContext request ,List status)
- {
- return new ResponseContext().status(Status.INTERNAL_SERVER_ERROR).entity( "Not implemented" );
- }
- public ResponseContext findPetsByTags(RequestContext request ,List tags)
- {
- return new ResponseContext().status(Status.INTERNAL_SERVER_ERROR).entity( "Not implemented" );
- }
- public ResponseContext getPetById(RequestContext request ,Long petId)
- {
- return new ResponseContext().status(Status.INTERNAL_SERVER_ERROR).entity( "Not implemented" );
- }
- public ResponseContext updatePetWithForm(RequestContext request ,String petId,String name,String status)
- {
- return new ResponseContext().status(Status.INTERNAL_SERVER_ERROR).entity( "Not implemented" );
- }
- public ResponseContext deletePet(RequestContext request ,Long petId,String apiKey)
- {
- return new ResponseContext().status(Status.INTERNAL_SERVER_ERROR).entity( "Not implemented" );
- }
- public ResponseContext uploadFile(RequestContext request ,Long petId,String additionalMetadata,FormDataContentDisposition fileDetail)
- {
- return new ResponseContext().status(Status.INTERNAL_SERVER_ERROR).entity( "Not implemented" );
- }
-}
-
diff --git a/samples/server/petstore/java-inflector/src/main/java/io/swagger/handler/StoreController.java b/samples/server/petstore/java-inflector/src/main/java/io/swagger/handler/StoreController.java
deleted file mode 100644
index 9afb704b726..00000000000
--- a/samples/server/petstore/java-inflector/src/main/java/io/swagger/handler/StoreController.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package io.swagger.handler;
-
-import io.swagger.inflector.models.RequestContext;
-import io.swagger.inflector.models.ResponseContext;
-import javax.ws.rs.core.Response.Status;
-
-import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
-import java.io.File;
-import java.util.List;
-
-import io.swagger.model.*;
-
-import java.util.Map;
-import io.swagger.model.Order;
-
-public class StoreController {
-
- public ResponseContext getInventory(RequestContext request )
- {
- return new ResponseContext().status(Status.INTERNAL_SERVER_ERROR).entity( "Not implemented" );
- }
- public ResponseContext placeOrder(RequestContext request ,Order body)
- {
- return new ResponseContext().status(Status.INTERNAL_SERVER_ERROR).entity( "Not implemented" );
- }
- public ResponseContext getOrderById(RequestContext request ,String orderId)
- {
- return new ResponseContext().status(Status.INTERNAL_SERVER_ERROR).entity( "Not implemented" );
- }
- public ResponseContext deleteOrder(RequestContext request ,String orderId)
- {
- return new ResponseContext().status(Status.INTERNAL_SERVER_ERROR).entity( "Not implemented" );
- }
-}
-
diff --git a/samples/server/petstore/java-inflector/src/main/java/io/swagger/handler/UserController.java b/samples/server/petstore/java-inflector/src/main/java/io/swagger/handler/UserController.java
deleted file mode 100644
index da907dc9fa3..00000000000
--- a/samples/server/petstore/java-inflector/src/main/java/io/swagger/handler/UserController.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package io.swagger.handler;
-
-import io.swagger.inflector.models.RequestContext;
-import io.swagger.inflector.models.ResponseContext;
-import javax.ws.rs.core.Response.Status;
-
-import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
-import java.io.File;
-import java.util.List;
-
-import io.swagger.model.*;
-
-import io.swagger.model.User;
-import java.util.*;
-
-public class UserController {
-
- public ResponseContext createUser(RequestContext request ,User body)
- {
- return new ResponseContext().status(Status.INTERNAL_SERVER_ERROR).entity( "Not implemented" );
- }
- public ResponseContext createUsersWithArrayInput(RequestContext request ,List body)
- {
- return new ResponseContext().status(Status.INTERNAL_SERVER_ERROR).entity( "Not implemented" );
- }
- public ResponseContext createUsersWithListInput(RequestContext request ,List body)
- {
- return new ResponseContext().status(Status.INTERNAL_SERVER_ERROR).entity( "Not implemented" );
- }
- public ResponseContext loginUser(RequestContext request ,String username,String password)
- {
- return new ResponseContext().status(Status.INTERNAL_SERVER_ERROR).entity( "Not implemented" );
- }
- public ResponseContext logoutUser(RequestContext request )
- {
- return new ResponseContext().status(Status.INTERNAL_SERVER_ERROR).entity( "Not implemented" );
- }
- public ResponseContext getUserByName(RequestContext request ,String username)
- {
- return new ResponseContext().status(Status.INTERNAL_SERVER_ERROR).entity( "Not implemented" );
- }
- public ResponseContext updateUser(RequestContext request ,String username,User body)
- {
- return new ResponseContext().status(Status.INTERNAL_SERVER_ERROR).entity( "Not implemented" );
- }
- public ResponseContext deleteUser(RequestContext request ,String username)
- {
- return new ResponseContext().status(Status.INTERNAL_SERVER_ERROR).entity( "Not implemented" );
- }
-}
-
diff --git a/samples/server/petstore/java-inflector/src/main/swagger/swagger.json b/samples/server/petstore/java-inflector/src/main/swagger/swagger.json
deleted file mode 100644
index 5ca489f0929..00000000000
--- a/samples/server/petstore/java-inflector/src/main/swagger/swagger.json
+++ /dev/null
@@ -1,762 +0,0 @@
-{
- "swagger" : "2.0",
- "info" : {
- "description" : "This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters",
- "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",
- "basePath" : "/v2",
- "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/json", "application/xml" ],
- "parameters" : [ {
- "in" : "body",
- "name" : "body",
- "description" : "Pet object that needs to be added to the store",
- "required" : false,
- "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/json", "application/xml" ],
- "parameters" : [ {
- "in" : "body",
- "name" : "body",
- "description" : "Pet object that needs to be added to the store",
- "required" : false,
- "schema" : {
- "$ref" : "#/definitions/Pet"
- }
- } ],
- "responses" : {
- "405" : {
- "description" : "Validation exception"
- },
- "404" : {
- "description" : "Pet not found"
- },
- "400" : {
- "description" : "Invalid ID supplied"
- }
- },
- "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 seperated strings",
- "operationId" : "findPetsByStatus",
- "produces" : [ "application/json", "application/xml" ],
- "parameters" : [ {
- "name" : "status",
- "in" : "query",
- "description" : "Status values that need to be considered for filter",
- "required" : false,
- "type" : "array",
- "items" : {
- "type" : "string"
- },
- "collectionFormat" : "multi",
- "default" : "available"
- } ],
- "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" : "Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.",
- "operationId" : "findPetsByTags",
- "produces" : [ "application/json", "application/xml" ],
- "parameters" : [ {
- "name" : "tags",
- "in" : "query",
- "description" : "Tags to filter by",
- "required" : false,
- "type" : "array",
- "items" : {
- "type" : "string"
- },
- "collectionFormat" : "multi"
- } ],
- "responses" : {
- "200" : {
- "description" : "successful operation",
- "schema" : {
- "type" : "array",
- "items" : {
- "$ref" : "#/definitions/Pet"
- }
- }
- },
- "400" : {
- "description" : "Invalid tag value"
- }
- },
- "security" : [ {
- "petstore_auth" : [ "write:pets", "read:pets" ]
- } ]
- }
- },
- "/pet/{petId}" : {
- "get" : {
- "tags" : [ "pet" ],
- "summary" : "Find pet by ID",
- "description" : "Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions",
- "operationId" : "getPetById",
- "produces" : [ "application/json", "application/xml" ],
- "parameters" : [ {
- "name" : "petId",
- "in" : "path",
- "description" : "ID of pet that needs to be fetched",
- "required" : true,
- "type" : "integer",
- "format" : "int64"
- } ],
- "responses" : {
- "404" : {
- "description" : "Pet not found"
- },
- "200" : {
- "description" : "successful operation",
- "schema" : {
- "$ref" : "#/definitions/Pet"
- }
- },
- "400" : {
- "description" : "Invalid ID supplied"
- }
- },
- "security" : [ {
- "api_key" : [ ]
- }, {
- "petstore_auth" : [ "write:pets", "read:pets" ]
- } ]
- },
- "post" : {
- "tags" : [ "pet" ],
- "summary" : "Updates a pet in the store with form data",
- "description" : "",
- "operationId" : "updatePetWithForm",
- "consumes" : [ "application/x-www-form-urlencoded" ],
- "produces" : [ "application/json", "application/xml" ],
- "parameters" : [ {
- "name" : "petId",
- "in" : "path",
- "description" : "ID of pet that needs to be updated",
- "required" : true,
- "type" : "string"
- }, {
- "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/json", "application/xml" ],
- "parameters" : [ {
- "name" : "api_key",
- "in" : "header",
- "description" : "",
- "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", "application/xml" ],
- "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" : {
- "default" : {
- "description" : "successful operation"
- }
- },
- "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", "application/xml" ],
- "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/json", "application/xml" ],
- "parameters" : [ {
- "in" : "body",
- "name" : "body",
- "description" : "order placed for purchasing the pet",
- "required" : false,
- "schema" : {
- "$ref" : "#/definitions/Order"
- }
- } ],
- "responses" : {
- "200" : {
- "description" : "successful operation",
- "schema" : {
- "$ref" : "#/definitions/Order"
- }
- },
- "400" : {
- "description" : "Invalid Order"
- }
- }
- }
- },
- "/store/order/{orderId}" : {
- "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/json", "application/xml" ],
- "parameters" : [ {
- "name" : "orderId",
- "in" : "path",
- "description" : "ID of pet that needs to be fetched",
- "required" : true,
- "type" : "string"
- } ],
- "responses" : {
- "404" : {
- "description" : "Order not found"
- },
- "200" : {
- "description" : "successful operation",
- "schema" : {
- "$ref" : "#/definitions/Order"
- }
- },
- "400" : {
- "description" : "Invalid ID supplied"
- }
- }
- },
- "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/json", "application/xml" ],
- "parameters" : [ {
- "name" : "orderId",
- "in" : "path",
- "description" : "ID of the order that needs to be deleted",
- "required" : true,
- "type" : "string"
- } ],
- "responses" : {
- "404" : {
- "description" : "Order not found"
- },
- "400" : {
- "description" : "Invalid ID supplied"
- }
- }
- }
- },
- "/user" : {
- "post" : {
- "tags" : [ "user" ],
- "summary" : "Create user",
- "description" : "This can only be done by the logged in user.",
- "operationId" : "createUser",
- "produces" : [ "application/json", "application/xml" ],
- "parameters" : [ {
- "in" : "body",
- "name" : "body",
- "description" : "Created user object",
- "required" : false,
- "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/json", "application/xml" ],
- "parameters" : [ {
- "in" : "body",
- "name" : "body",
- "description" : "List of user object",
- "required" : false,
- "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/json", "application/xml" ],
- "parameters" : [ {
- "in" : "body",
- "name" : "body",
- "description" : "List of user object",
- "required" : false,
- "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/json", "application/xml" ],
- "parameters" : [ {
- "name" : "username",
- "in" : "query",
- "description" : "The user name for login",
- "required" : false,
- "type" : "string"
- }, {
- "name" : "password",
- "in" : "query",
- "description" : "The password for login in clear text",
- "required" : false,
- "type" : "string"
- } ],
- "responses" : {
- "200" : {
- "description" : "successful operation",
- "schema" : {
- "type" : "string"
- }
- },
- "400" : {
- "description" : "Invalid username/password supplied"
- }
- }
- }
- },
- "/user/logout" : {
- "get" : {
- "tags" : [ "user" ],
- "summary" : "Logs out current logged in user session",
- "description" : "",
- "operationId" : "logoutUser",
- "produces" : [ "application/json", "application/xml" ],
- "parameters" : [ ],
- "responses" : {
- "default" : {
- "description" : "successful operation"
- }
- }
- }
- },
- "/user/{username}" : {
- "get" : {
- "tags" : [ "user" ],
- "summary" : "Get user by user name",
- "description" : "",
- "operationId" : "getUserByName",
- "produces" : [ "application/json", "application/xml" ],
- "parameters" : [ {
- "name" : "username",
- "in" : "path",
- "description" : "The name that needs to be fetched. Use user1 for testing. ",
- "required" : true,
- "type" : "string"
- } ],
- "responses" : {
- "404" : {
- "description" : "User not found"
- },
- "200" : {
- "description" : "successful operation",
- "schema" : {
- "$ref" : "#/definitions/User"
- },
- "examples" : {
- "application/json" : {
- "id" : 1,
- "username" : "johnp",
- "firstName" : "John",
- "lastName" : "Public",
- "email" : "johnp@swagger.io",
- "password" : "-secret-",
- "phone" : "0123456789",
- "userStatus" : 0
- }
- }
- },
- "400" : {
- "description" : "Invalid username supplied"
- }
- }
- },
- "put" : {
- "tags" : [ "user" ],
- "summary" : "Updated user",
- "description" : "This can only be done by the logged in user.",
- "operationId" : "updateUser",
- "produces" : [ "application/json", "application/xml" ],
- "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" : false,
- "schema" : {
- "$ref" : "#/definitions/User"
- }
- } ],
- "responses" : {
- "404" : {
- "description" : "User not found"
- },
- "400" : {
- "description" : "Invalid user supplied"
- }
- }
- },
- "delete" : {
- "tags" : [ "user" ],
- "summary" : "Delete user",
- "description" : "This can only be done by the logged in user.",
- "operationId" : "deleteUser",
- "produces" : [ "application/json", "application/xml" ],
- "parameters" : [ {
- "name" : "username",
- "in" : "path",
- "description" : "The name that needs to be deleted",
- "required" : true,
- "type" : "string"
- } ],
- "responses" : {
- "404" : {
- "description" : "User not found"
- },
- "400" : {
- "description" : "Invalid username supplied"
- }
- }
- }
- }
- },
- "securityDefinitions" : {
- "api_key" : {
- "type" : "apiKey",
- "name" : "api_key",
- "in" : "header"
- },
- "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"
- }
- }
- },
- "definitions" : {
- "User" : {
- "properties" : {
- "id" : {
- "type" : "integer",
- "format" : "int64"
- },
- "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"
- }
- },
- "Category" : {
- "properties" : {
- "id" : {
- "type" : "integer",
- "format" : "int64"
- },
- "name" : {
- "type" : "string"
- }
- },
- "xml" : {
- "name" : "Category"
- }
- },
- "Pet" : {
- "required" : [ "name", "photoUrls" ],
- "properties" : {
- "id" : {
- "type" : "integer",
- "format" : "int64"
- },
- "category" : {
- "$ref" : "#/definitions/Category"
- },
- "name" : {
- "type" : "string",
- "example" : "doggie"
- },
- "photoUrls" : {
- "type" : "array",
- "items" : {
- "type" : "string"
- }
- },
- "tags" : {
- "type" : "array",
- "items" : {
- "$ref" : "#/definitions/Tag"
- }
- },
- "status" : {
- "type" : "string",
- "description" : "pet status in the store",
- "enum" : [ "available", "pending", "sold" ]
- }
- },
- "xml" : {
- "name" : "Pet"
- }
- },
- "Tag" : {
- "properties" : {
- "id" : {
- "type" : "integer",
- "format" : "int64"
- },
- "name" : {
- "type" : "string"
- }
- },
- "xml" : {
- "name" : "Tag"
- }
- },
- "Order" : {
- "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"
- }
- },
- "xml" : {
- "name" : "Order"
- }
- }
- }
-}
\ No newline at end of file
diff --git a/samples/server/petstore/java-inflector/src/main/webapp/WEB-INF/web.xml b/samples/server/petstore/java-inflector/src/main/webapp/WEB-INF/web.xml
deleted file mode 100644
index 34a2eea6bcf..00000000000
--- a/samples/server/petstore/java-inflector/src/main/webapp/WEB-INF/web.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
- swagger-inflector
- org.glassfish.jersey.servlet.ServletContainer
-
- javax.ws.rs.Application
- io.swagger.inflector.SwaggerInflector
-
- 1
-
-
- swagger-inflector
- /*
-
-
- CORSFilter
- io.swagger.inflector.utils.CORSFilter
-
-
- CORSFilter
- /*
-
-
\ No newline at end of file
diff --git a/samples/server/petstore/jaxrs/README.md b/samples/server/petstore/jaxrs/README.md
index a5281c3eac3..3ffa01fb257 100644
--- a/samples/server/petstore/jaxrs/README.md
+++ b/samples/server/petstore/jaxrs/README.md
@@ -1,5 +1,10 @@
# Swagger generated server
## Overview
-This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project using the
-JAX-RS template.
+This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the
+[swagger-spec](https://github.com/swagger-api/swagger-core/wiki) from a remote server, you can easily generate a server stub. This
+is an example of building a swagger-enabled scalatra server.
+
+This example uses the [scalatra](http://scalatra.org/) framework. To see how to make this your own, look here:
+
+[README](https://github.com/swagger-api/swagger-codegen/tree/master/samples/server-generator/scalatra)
\ No newline at end of file
diff --git a/samples/server/petstore/jaxrs/pom.xml b/samples/server/petstore/jaxrs/pom.xml
index 9a7e179cc72..cac2f6daf79 100644
--- a/samples/server/petstore/jaxrs/pom.xml
+++ b/samples/server/petstore/jaxrs/pom.xml
@@ -50,6 +50,7 @@
0
+ true
@@ -74,29 +75,12 @@
- target/generated-sources
+ src/gen/java
-
- io.swagger
- swagger-codegen-maven-plugin
- 2.1.3-SNAPSHOT
-
-
-
- generate
-
-
- src/main/resources/swagger.json
- jaxrs
-
-
-
-
-
@@ -164,7 +148,7 @@
- 1.5.1-SNAPSHOT
+ 1.5.0
9.2.9.v20150224
1.13
1.6.3
diff --git a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/ApiException.java b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/ApiException.java
new file mode 100644
index 00000000000..cae767c0393
--- /dev/null
+++ b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/ApiException.java
@@ -0,0 +1,9 @@
+package io.swagger.api;
+
+public class ApiException extends Exception{
+ private int code;
+ public ApiException (int code, String msg) {
+ super(msg);
+ this.code = code;
+ }
+}
diff --git a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/ApiOriginFilter.java b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/ApiOriginFilter.java
new file mode 100644
index 00000000000..c2eeacf13d3
--- /dev/null
+++ b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/ApiOriginFilter.java
@@ -0,0 +1,26 @@
+package io.swagger.api;
+
+import java.io.IOException;
+
+import javax.servlet.*;
+import javax.servlet.http.HttpServletResponse;
+
+public class ApiOriginFilter implements javax.servlet.Filter {
+ @Override
+ public void doFilter(ServletRequest request, ServletResponse response,
+ FilterChain chain) throws IOException, ServletException {
+ HttpServletResponse res = (HttpServletResponse) response;
+ res.addHeader("Access-Control-Allow-Origin", "*");
+ res.addHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT");
+ res.addHeader("Access-Control-Allow-Headers", "Content-Type");
+ chain.doFilter(request, response);
+ }
+
+ @Override
+ public void destroy() {
+ }
+
+ @Override
+ public void init(FilterConfig filterConfig) throws ServletException {
+ }
+}
\ No newline at end of file
diff --git a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/ApiResponseMessage.java b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/ApiResponseMessage.java
new file mode 100644
index 00000000000..9e5b0ee44e2
--- /dev/null
+++ b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/ApiResponseMessage.java
@@ -0,0 +1,68 @@
+package io.swagger.api;
+
+import javax.xml.bind.annotation.XmlTransient;
+
+@javax.xml.bind.annotation.XmlRootElement
+public class ApiResponseMessage {
+ public static final int ERROR = 1;
+ public static final int WARNING = 2;
+ public static final int INFO = 3;
+ public static final int OK = 4;
+ public static final int TOO_BUSY = 5;
+
+ int code;
+ String type;
+ String message;
+
+ public ApiResponseMessage(){}
+
+ public ApiResponseMessage(int code, String message){
+ this.code = code;
+ switch(code){
+ case ERROR:
+ setType("error");
+ break;
+ case WARNING:
+ setType("warning");
+ break;
+ case INFO:
+ setType("info");
+ break;
+ case OK:
+ setType("ok");
+ break;
+ case TOO_BUSY:
+ setType("too busy");
+ break;
+ default:
+ setType("unknown");
+ break;
+ }
+ this.message = message;
+ }
+
+ @XmlTransient
+ public int getCode() {
+ return code;
+ }
+
+ public void setCode(int code) {
+ this.code = code;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+}
diff --git a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/NotFoundException.java b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/NotFoundException.java
new file mode 100644
index 00000000000..9c8410e47ab
--- /dev/null
+++ b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/NotFoundException.java
@@ -0,0 +1,9 @@
+package io.swagger.api;
+
+public class NotFoundException extends ApiException {
+ private int code;
+ public NotFoundException (int code, String msg) {
+ super(code, msg);
+ this.code = code;
+ }
+}
diff --git a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/PetApi.java b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/PetApi.java
new file mode 100644
index 00000000000..055fa75c80b
--- /dev/null
+++ b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/PetApi.java
@@ -0,0 +1,148 @@
+package io.swagger.api;
+
+import io.swagger.model.*;
+import io.swagger.api.PetApiService;
+import io.swagger.api.factories.PetApiServiceFactory;
+
+import io.swagger.annotations.ApiParam;
+
+import com.sun.jersey.multipart.FormDataParam;
+
+import io.swagger.model.Pet;
+import java.io.File;
+
+import java.util.List;
+import io.swagger.api.NotFoundException;
+
+import java.io.InputStream;
+
+import com.sun.jersey.core.header.FormDataContentDisposition;
+import com.sun.jersey.multipart.FormDataParam;
+
+import javax.ws.rs.core.Response;
+import javax.ws.rs.*;
+
+@Path("/pet")
+
+
+@io.swagger.annotations.Api(value = "/pet", description = "the pet API")
+public class PetApi {
+
+ private final PetApiService delegate = PetApiServiceFactory.getPetApi();
+
+ @PUT
+
+ @Consumes({ "application/json", "application/xml" })
+ @Produces({ "application/json", "application/xml" })
+ @io.swagger.annotations.ApiOperation(value = "Update an existing pet", notes = "", response = Void.class)
+ @io.swagger.annotations.ApiResponses(value = {
+ @io.swagger.annotations.ApiResponse(code = 405, message = "Validation exception"),
+
+ @io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found"),
+
+ @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied") })
+
+ public Response updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ) Pet body)
+ throws NotFoundException {
+ return delegate.updatePet(body);
+ }
+ @POST
+
+ @Consumes({ "application/json", "application/xml" })
+ @Produces({ "application/json", "application/xml" })
+ @io.swagger.annotations.ApiOperation(value = "Add a new pet to the store", notes = "", response = Void.class)
+ @io.swagger.annotations.ApiResponses(value = {
+ @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input") })
+
+ public Response addPet(@ApiParam(value = "Pet object that needs to be added to the store" ) Pet body)
+ throws NotFoundException {
+ return delegate.addPet(body);
+ }
+ @GET
+ @Path("/findByStatus")
+
+ @Produces({ "application/json", "application/xml" })
+ @io.swagger.annotations.ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma seperated strings", response = Pet.class, responseContainer = "List")
+ @io.swagger.annotations.ApiResponses(value = {
+ @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation"),
+
+ @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid status value") })
+
+ public Response findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter", defaultValue="available") @QueryParam("status") List status)
+ throws NotFoundException {
+ return delegate.findPetsByStatus(status);
+ }
+ @GET
+ @Path("/findByTags")
+
+ @Produces({ "application/json", "application/xml" })
+ @io.swagger.annotations.ApiOperation(value = "Finds Pets by tags", notes = "Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.", response = Pet.class, responseContainer = "List")
+ @io.swagger.annotations.ApiResponses(value = {
+ @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation"),
+
+ @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid tag value") })
+
+ public Response findPetsByTags(@ApiParam(value = "Tags to filter by") @QueryParam("tags") List tags)
+ throws NotFoundException {
+ return delegate.findPetsByTags(tags);
+ }
+ @GET
+ @Path("/{petId}")
+
+ @Produces({ "application/json", "application/xml" })
+ @io.swagger.annotations.ApiOperation(value = "Find pet by ID", notes = "Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions", response = Pet.class)
+ @io.swagger.annotations.ApiResponses(value = {
+ @io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found"),
+
+ @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation"),
+
+ @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied") })
+
+ public Response getPetById(@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathParam("petId") Long petId)
+ throws NotFoundException {
+ return delegate.getPetById(petId);
+ }
+ @POST
+ @Path("/{petId}")
+ @Consumes({ "application/x-www-form-urlencoded" })
+ @Produces({ "application/json", "application/xml" })
+ @io.swagger.annotations.ApiOperation(value = "Updates a pet in the store with form data", notes = "", response = Void.class)
+ @io.swagger.annotations.ApiResponses(value = {
+ @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input") })
+
+ public Response updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathParam("petId") String petId,
+ @ApiParam(value = "Updated name of the pet" )@FormParam("name") String name,
+ @ApiParam(value = "Updated status of the pet" )@FormParam("status") String status)
+ throws NotFoundException {
+ return delegate.updatePetWithForm(petId,name,status);
+ }
+ @DELETE
+ @Path("/{petId}")
+
+ @Produces({ "application/json", "application/xml" })
+ @io.swagger.annotations.ApiOperation(value = "Deletes a pet", notes = "", response = Void.class)
+ @io.swagger.annotations.ApiResponses(value = {
+ @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid pet value") })
+
+ public Response deletePet(@ApiParam(value = "" )@HeaderParam("api_key") String apiKey,
+ @ApiParam(value = "Pet id to delete",required=true ) @PathParam("petId") Long petId)
+ throws NotFoundException {
+ return delegate.deletePet(apiKey,petId);
+ }
+ @POST
+ @Path("/{petId}/uploadImage")
+ @Consumes({ "multipart/form-data" })
+ @Produces({ "application/json", "application/xml" })
+ @io.swagger.annotations.ApiOperation(value = "uploads an image", notes = "", response = Void.class)
+ @io.swagger.annotations.ApiResponses(value = {
+ @io.swagger.annotations.ApiResponse(code = 0, message = "successful operation") })
+
+ public Response uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathParam("petId") Long petId,
+ @ApiParam(value = "Additional data to pass to server" )@FormParam("additionalMetadata") String additionalMetadata,
+ @ApiParam(value = "file to upload") @FormDataParam("file") InputStream inputStream,
+ @ApiParam(value = "file detail") @FormDataParam("file") FormDataContentDisposition fileDetail)
+ throws NotFoundException {
+ return delegate.uploadFile(petId,additionalMetadata,fileDetail);
+ }
+}
+
diff --git a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/PetApiService.java b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/PetApiService.java
new file mode 100644
index 00000000000..6e8060269eb
--- /dev/null
+++ b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/PetApiService.java
@@ -0,0 +1,47 @@
+package io.swagger.api;
+
+import io.swagger.api.*;
+import io.swagger.model.*;
+
+import com.sun.jersey.multipart.FormDataParam;
+
+import io.swagger.model.Pet;
+import java.io.File;
+
+import java.util.List;
+import io.swagger.api.NotFoundException;
+
+import java.io.InputStream;
+
+import com.sun.jersey.core.header.FormDataContentDisposition;
+import com.sun.jersey.multipart.FormDataParam;
+
+import javax.ws.rs.core.Response;
+
+public abstract class PetApiService {
+
+ public abstract Response updatePet(Pet body)
+ throws NotFoundException;
+
+ public abstract Response addPet(Pet body)
+ throws NotFoundException;
+
+ public abstract Response findPetsByStatus(List status)
+ throws NotFoundException;
+
+ public abstract Response findPetsByTags(List tags)
+ throws NotFoundException;
+
+ public abstract Response getPetById(Long petId)
+ throws NotFoundException;
+
+ public abstract Response updatePetWithForm(String petId,String name,String status)
+ throws NotFoundException;
+
+ public abstract Response deletePet(String apiKey,Long petId)
+ throws NotFoundException;
+
+ public abstract Response uploadFile(Long petId,String additionalMetadata,FormDataContentDisposition fileDetail)
+ throws NotFoundException;
+
+}
diff --git a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/StoreApi.java b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/StoreApi.java
new file mode 100644
index 00000000000..f5215862ba7
--- /dev/null
+++ b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/StoreApi.java
@@ -0,0 +1,90 @@
+package io.swagger.api;
+
+import io.swagger.model.*;
+import io.swagger.api.StoreApiService;
+import io.swagger.api.factories.StoreApiServiceFactory;
+
+import io.swagger.annotations.ApiParam;
+
+import com.sun.jersey.multipart.FormDataParam;
+
+import java.util.Map;
+import io.swagger.model.Order;
+
+import java.util.List;
+import io.swagger.api.NotFoundException;
+
+import java.io.InputStream;
+
+import com.sun.jersey.core.header.FormDataContentDisposition;
+import com.sun.jersey.multipart.FormDataParam;
+
+import javax.ws.rs.core.Response;
+import javax.ws.rs.*;
+
+@Path("/store")
+
+
+@io.swagger.annotations.Api(value = "/store", description = "the store API")
+public class StoreApi {
+
+ private final StoreApiService delegate = StoreApiServiceFactory.getStoreApi();
+
+ @GET
+ @Path("/inventory")
+
+ @Produces({ "application/json", "application/xml" })
+ @io.swagger.annotations.ApiOperation(value = "Returns pet inventories by status", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "map")
+ @io.swagger.annotations.ApiResponses(value = {
+ @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation") })
+
+ public Response getInventory()
+ throws NotFoundException {
+ return delegate.getInventory();
+ }
+ @POST
+ @Path("/order")
+
+ @Produces({ "application/json", "application/xml" })
+ @io.swagger.annotations.ApiOperation(value = "Place an order for a pet", notes = "", response = Order.class)
+ @io.swagger.annotations.ApiResponses(value = {
+ @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation"),
+
+ @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid Order") })
+
+ public Response placeOrder(@ApiParam(value = "order placed for purchasing the pet" ) Order body)
+ throws NotFoundException {
+ return delegate.placeOrder(body);
+ }
+ @GET
+ @Path("/order/{orderId}")
+
+ @Produces({ "application/json", "application/xml" })
+ @io.swagger.annotations.ApiOperation(value = "Find purchase order by ID", notes = "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", response = Order.class)
+ @io.swagger.annotations.ApiResponses(value = {
+ @io.swagger.annotations.ApiResponse(code = 404, message = "Order not found"),
+
+ @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation"),
+
+ @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied") })
+
+ public Response getOrderById(@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathParam("orderId") String orderId)
+ throws NotFoundException {
+ return delegate.getOrderById(orderId);
+ }
+ @DELETE
+ @Path("/order/{orderId}")
+
+ @Produces({ "application/json", "application/xml" })
+ @io.swagger.annotations.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", response = Void.class)
+ @io.swagger.annotations.ApiResponses(value = {
+ @io.swagger.annotations.ApiResponse(code = 404, message = "Order not found"),
+
+ @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied") })
+
+ public Response deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathParam("orderId") String orderId)
+ throws NotFoundException {
+ return delegate.deleteOrder(orderId);
+ }
+}
+
diff --git a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/StoreApiService.java b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/StoreApiService.java
new file mode 100644
index 00000000000..5566e9c9b57
--- /dev/null
+++ b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/StoreApiService.java
@@ -0,0 +1,35 @@
+package io.swagger.api;
+
+import io.swagger.api.*;
+import io.swagger.model.*;
+
+import com.sun.jersey.multipart.FormDataParam;
+
+import java.util.Map;
+import io.swagger.model.Order;
+
+import java.util.List;
+import io.swagger.api.NotFoundException;
+
+import java.io.InputStream;
+
+import com.sun.jersey.core.header.FormDataContentDisposition;
+import com.sun.jersey.multipart.FormDataParam;
+
+import javax.ws.rs.core.Response;
+
+public abstract class StoreApiService {
+
+ public abstract Response getInventory()
+ throws NotFoundException;
+
+ public abstract Response placeOrder(Order body)
+ throws NotFoundException;
+
+ public abstract Response getOrderById(String orderId)
+ throws NotFoundException;
+
+ public abstract Response deleteOrder(String orderId)
+ throws NotFoundException;
+
+}
diff --git a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/UserApi.java b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/UserApi.java
new file mode 100644
index 00000000000..f904b77746b
--- /dev/null
+++ b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/UserApi.java
@@ -0,0 +1,142 @@
+package io.swagger.api;
+
+import io.swagger.model.*;
+import io.swagger.api.UserApiService;
+import io.swagger.api.factories.UserApiServiceFactory;
+
+import io.swagger.annotations.ApiParam;
+
+import com.sun.jersey.multipart.FormDataParam;
+
+import io.swagger.model.User;
+import java.util.*;
+
+import java.util.List;
+import io.swagger.api.NotFoundException;
+
+import java.io.InputStream;
+
+import com.sun.jersey.core.header.FormDataContentDisposition;
+import com.sun.jersey.multipart.FormDataParam;
+
+import javax.ws.rs.core.Response;
+import javax.ws.rs.*;
+
+@Path("/user")
+
+
+@io.swagger.annotations.Api(value = "/user", description = "the user API")
+public class UserApi {
+
+ private final UserApiService delegate = UserApiServiceFactory.getUserApi();
+
+ @POST
+
+
+ @Produces({ "application/json", "application/xml" })
+ @io.swagger.annotations.ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = Void.class)
+ @io.swagger.annotations.ApiResponses(value = {
+ @io.swagger.annotations.ApiResponse(code = 0, message = "successful operation") })
+
+ public Response createUser(@ApiParam(value = "Created user object" ) User body)
+ throws NotFoundException {
+ return delegate.createUser(body);
+ }
+ @POST
+ @Path("/createWithArray")
+
+ @Produces({ "application/json", "application/xml" })
+ @io.swagger.annotations.ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class)
+ @io.swagger.annotations.ApiResponses(value = {
+ @io.swagger.annotations.ApiResponse(code = 0, message = "successful operation") })
+
+ public Response createUsersWithArrayInput(@ApiParam(value = "List of user object" ) List body)
+ throws NotFoundException {
+ return delegate.createUsersWithArrayInput(body);
+ }
+ @POST
+ @Path("/createWithList")
+
+ @Produces({ "application/json", "application/xml" })
+ @io.swagger.annotations.ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class)
+ @io.swagger.annotations.ApiResponses(value = {
+ @io.swagger.annotations.ApiResponse(code = 0, message = "successful operation") })
+
+ public Response createUsersWithListInput(@ApiParam(value = "List of user object" ) List body)
+ throws NotFoundException {
+ return delegate.createUsersWithListInput(body);
+ }
+ @GET
+ @Path("/login")
+
+ @Produces({ "application/json", "application/xml" })
+ @io.swagger.annotations.ApiOperation(value = "Logs user into the system", notes = "", response = String.class)
+ @io.swagger.annotations.ApiResponses(value = {
+ @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation"),
+
+ @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username/password supplied") })
+
+ public Response loginUser(@ApiParam(value = "The user name for login") @QueryParam("username") String username,
+ @ApiParam(value = "The password for login in clear text") @QueryParam("password") String password)
+ throws NotFoundException {
+ return delegate.loginUser(username,password);
+ }
+ @GET
+ @Path("/logout")
+
+ @Produces({ "application/json", "application/xml" })
+ @io.swagger.annotations.ApiOperation(value = "Logs out current logged in user session", notes = "", response = Void.class)
+ @io.swagger.annotations.ApiResponses(value = {
+ @io.swagger.annotations.ApiResponse(code = 0, message = "successful operation") })
+
+ public Response logoutUser()
+ throws NotFoundException {
+ return delegate.logoutUser();
+ }
+ @GET
+ @Path("/{username}")
+
+ @Produces({ "application/json", "application/xml" })
+ @io.swagger.annotations.ApiOperation(value = "Get user by user name", notes = "", response = User.class)
+ @io.swagger.annotations.ApiResponses(value = {
+ @io.swagger.annotations.ApiResponse(code = 404, message = "User not found"),
+
+ @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation"),
+
+ @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username supplied") })
+
+ public Response getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathParam("username") String username)
+ throws NotFoundException {
+ return delegate.getUserByName(username);
+ }
+ @PUT
+ @Path("/{username}")
+
+ @Produces({ "application/json", "application/xml" })
+ @io.swagger.annotations.ApiOperation(value = "Updated user", notes = "This can only be done by the logged in user.", response = Void.class)
+ @io.swagger.annotations.ApiResponses(value = {
+ @io.swagger.annotations.ApiResponse(code = 404, message = "User not found"),
+
+ @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid user supplied") })
+
+ public Response updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathParam("username") String username,
+ @ApiParam(value = "Updated user object" ) User body)
+ throws NotFoundException {
+ return delegate.updateUser(username,body);
+ }
+ @DELETE
+ @Path("/{username}")
+
+ @Produces({ "application/json", "application/xml" })
+ @io.swagger.annotations.ApiOperation(value = "Delete user", notes = "This can only be done by the logged in user.", response = Void.class)
+ @io.swagger.annotations.ApiResponses(value = {
+ @io.swagger.annotations.ApiResponse(code = 404, message = "User not found"),
+
+ @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username supplied") })
+
+ public Response deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathParam("username") String username)
+ throws NotFoundException {
+ return delegate.deleteUser(username);
+ }
+}
+
diff --git a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/UserApiService.java b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/UserApiService.java
new file mode 100644
index 00000000000..6a09fcd0feb
--- /dev/null
+++ b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/UserApiService.java
@@ -0,0 +1,47 @@
+package io.swagger.api;
+
+import io.swagger.api.*;
+import io.swagger.model.*;
+
+import com.sun.jersey.multipart.FormDataParam;
+
+import io.swagger.model.User;
+import java.util.*;
+
+import java.util.List;
+import io.swagger.api.NotFoundException;
+
+import java.io.InputStream;
+
+import com.sun.jersey.core.header.FormDataContentDisposition;
+import com.sun.jersey.multipart.FormDataParam;
+
+import javax.ws.rs.core.Response;
+
+public abstract class UserApiService {
+
+ public abstract Response createUser(User body)
+ throws NotFoundException;
+
+ public abstract Response createUsersWithArrayInput(List body)
+ throws NotFoundException;
+
+ public abstract Response createUsersWithListInput(List body)
+ throws NotFoundException;
+
+ public abstract Response loginUser(String username,String password)
+ throws NotFoundException;
+
+ public abstract Response logoutUser()
+ throws NotFoundException;
+
+ public abstract Response getUserByName(String username)
+ throws NotFoundException;
+
+ public abstract Response updateUser(String username,User body)
+ throws NotFoundException;
+
+ public abstract Response deleteUser(String username)
+ throws NotFoundException;
+
+}
diff --git a/samples/server/petstore/java-inflector/src/main/java/io/swagger/model/Category.java b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/model/Category.java
similarity index 100%
rename from samples/server/petstore/java-inflector/src/main/java/io/swagger/model/Category.java
rename to samples/server/petstore/jaxrs/src/gen/java/io/swagger/model/Category.java
diff --git a/samples/server/petstore/java-inflector/src/main/java/io/swagger/model/Order.java b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/model/Order.java
similarity index 100%
rename from samples/server/petstore/java-inflector/src/main/java/io/swagger/model/Order.java
rename to samples/server/petstore/jaxrs/src/gen/java/io/swagger/model/Order.java
diff --git a/samples/server/petstore/java-inflector/src/main/java/io/swagger/model/Pet.java b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/model/Pet.java
similarity index 95%
rename from samples/server/petstore/java-inflector/src/main/java/io/swagger/model/Pet.java
rename to samples/server/petstore/jaxrs/src/gen/java/io/swagger/model/Pet.java
index 9c233d08289..076a8cf8142 100644
--- a/samples/server/petstore/java-inflector/src/main/java/io/swagger/model/Pet.java
+++ b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/model/Pet.java
@@ -1,8 +1,8 @@
package io.swagger.model;
import io.swagger.model.Category;
-import io.swagger.model.Tag;
import java.util.*;
+import io.swagger.model.Tag;
import io.swagger.annotations.*;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -14,8 +14,8 @@ public class Pet {
private Long id = null;
private Category category = null;
private String name = null;
- private List photoUrls = new ArrayList();
- private List tags = new ArrayList();
+ private List photoUrls = new ArrayList() ;
+ private List tags = new ArrayList() ;
public enum StatusEnum {
available, pending, sold,
};
diff --git a/samples/server/petstore/java-inflector/src/main/java/io/swagger/model/Tag.java b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/model/Tag.java
similarity index 100%
rename from samples/server/petstore/java-inflector/src/main/java/io/swagger/model/Tag.java
rename to samples/server/petstore/jaxrs/src/gen/java/io/swagger/model/Tag.java
diff --git a/samples/server/petstore/java-inflector/src/main/java/io/swagger/model/User.java b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/model/User.java
similarity index 100%
rename from samples/server/petstore/java-inflector/src/main/java/io/swagger/model/User.java
rename to samples/server/petstore/jaxrs/src/gen/java/io/swagger/model/User.java
diff --git a/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/factories/PetApiServiceFactory.java b/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/factories/PetApiServiceFactory.java
index 56ad64c3212..fb0bb2bc3de 100644
--- a/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/factories/PetApiServiceFactory.java
+++ b/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/factories/PetApiServiceFactory.java
@@ -5,10 +5,9 @@ import io.swagger.api.impl.PetApiServiceImpl;
public class PetApiServiceFactory {
- private final static PetApiService service = new PetApiServiceImpl();
+ private final static PetApiService service = new PetApiServiceImpl();
- public static PetApiService getPetApi()
- {
- return service;
- }
+ public static PetApiService getPetApi() {
+ return service;
+ }
}
diff --git a/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/factories/StoreApiServiceFactory.java b/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/factories/StoreApiServiceFactory.java
index d60aa7d8660..325f5ba7ae0 100644
--- a/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/factories/StoreApiServiceFactory.java
+++ b/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/factories/StoreApiServiceFactory.java
@@ -5,10 +5,9 @@ import io.swagger.api.impl.StoreApiServiceImpl;
public class StoreApiServiceFactory {
- private final static StoreApiService service = new StoreApiServiceImpl();
+ private final static StoreApiService service = new StoreApiServiceImpl();
- public static StoreApiService getStoreApi()
- {
- return service;
- }
+ public static StoreApiService getStoreApi() {
+ return service;
+ }
}
diff --git a/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/factories/UserApiServiceFactory.java b/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/factories/UserApiServiceFactory.java
index 5db4914a878..9a802740e2c 100644
--- a/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/factories/UserApiServiceFactory.java
+++ b/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/factories/UserApiServiceFactory.java
@@ -5,10 +5,9 @@ import io.swagger.api.impl.UserApiServiceImpl;
public class UserApiServiceFactory {
- private final static UserApiService service = new UserApiServiceImpl();
+ private final static UserApiService service = new UserApiServiceImpl();
- public static UserApiService getUserApi()
- {
- return service;
- }
+ public static UserApiService getUserApi() {
+ return service;
+ }
}
diff --git a/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/impl/PetApiServiceImpl.java b/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/impl/PetApiServiceImpl.java
index a330f65530c..3af5a9cd420 100644
--- a/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/impl/PetApiServiceImpl.java
+++ b/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/impl/PetApiServiceImpl.java
@@ -1,79 +1,69 @@
package io.swagger.api.impl;
-import io.swagger.api.*;
-import io.swagger.model.*;
-
-import com.sun.jersey.multipart.FormDataParam;
-
-import io.swagger.model.Pet;
-import java.io.File;
-
-import java.util.List;
-import io.swagger.api.NotFoundException;
-
-import java.io.InputStream;
-
import com.sun.jersey.core.header.FormDataContentDisposition;
-import com.sun.jersey.multipart.FormDataParam;
+import io.swagger.api.*;
+import io.swagger.api.NotFoundException;
+import io.swagger.model.Pet;
import javax.ws.rs.core.Response;
+import java.util.List;
public class PetApiServiceImpl extends PetApiService {
-
- @Override
- public Response updatePet(Pet body)
- throws NotFoundException {
- // do some magic!
- return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
- }
-
- @Override
- public Response addPet(Pet body)
- throws NotFoundException {
- // do some magic!
- return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
- }
-
- @Override
- public Response findPetsByStatus(List status)
- throws NotFoundException {
- // do some magic!
- return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
- }
-
- @Override
- public Response findPetsByTags(List tags)
- throws NotFoundException {
- // do some magic!
- return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
- }
-
- @Override
- public Response getPetById(Long petId)
- throws NotFoundException {
- // do some magic!
- return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
- }
-
- @Override
- public Response updatePetWithForm(String petId,String name,String status)
- throws NotFoundException {
- // do some magic!
- return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
- }
-
- @Override
- public Response deletePet(Long petId,String apiKey)
- throws NotFoundException {
- // do some magic!
- return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
- }
-
- @Override
- public Response uploadFile(Long petId,String additionalMetadata,FormDataContentDisposition fileDetail)
- throws NotFoundException {
- // do some magic!
- return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
- }
-
+
+ @Override
+ public Response updatePet(Pet body)
+ throws NotFoundException {
+ // do some magic!
+ return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
+ }
+
+ @Override
+ public Response addPet(Pet body)
+ throws NotFoundException {
+ // do some magic!
+ return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
+ }
+
+ @Override
+ public Response findPetsByStatus(List status)
+ throws NotFoundException {
+ // do some magic!
+ return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
+ }
+
+ @Override
+ public Response findPetsByTags(List tags)
+ throws NotFoundException {
+ // do some magic!
+ return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
+ }
+
+ @Override
+ public Response getPetById(Long petId)
+ throws NotFoundException {
+ // do some magic!
+ return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
+ }
+
+ @Override
+ public Response updatePetWithForm(String petId, String name, String status)
+ throws NotFoundException {
+ // do some magic!
+ return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
+ }
+
+ @Override
+ public Response deletePet(String apiKey, Long petId)
+ throws NotFoundException {
+ // do some magic!
+ return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
+ }
+
+ @Override
+ public Response uploadFile(Long petId, String additionalMetadata, FormDataContentDisposition fileDetail)
+ throws NotFoundException {
+ // do some magic!
+ return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
+ }
+
}
diff --git a/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/impl/StoreApiServiceImpl.java b/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/impl/StoreApiServiceImpl.java
index 84e8938f2f9..9494c3adc89 100644
--- a/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/impl/StoreApiServiceImpl.java
+++ b/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/impl/StoreApiServiceImpl.java
@@ -1,51 +1,39 @@
package io.swagger.api.impl;
import io.swagger.api.*;
-import io.swagger.model.*;
-
-import com.sun.jersey.multipart.FormDataParam;
-
-import java.util.Map;
-import io.swagger.model.Order;
-
-import java.util.List;
import io.swagger.api.NotFoundException;
-
-import java.io.InputStream;
-
-import com.sun.jersey.core.header.FormDataContentDisposition;
-import com.sun.jersey.multipart.FormDataParam;
+import io.swagger.model.Order;
import javax.ws.rs.core.Response;
public class StoreApiServiceImpl extends StoreApiService {
-
- @Override
- public Response getInventory()
- throws NotFoundException {
- // do some magic!
- return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
- }
-
- @Override
- public Response placeOrder(Order body)
- throws NotFoundException {
- // do some magic!
- return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
- }
-
- @Override
- public Response getOrderById(String orderId)
- throws NotFoundException {
- // do some magic!
- return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
- }
-
- @Override
- public Response deleteOrder(String orderId)
- throws NotFoundException {
- // do some magic!
- return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
- }
-
+
+ @Override
+ public Response getInventory()
+ throws NotFoundException {
+ // do some magic!
+ return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
+ }
+
+ @Override
+ public Response placeOrder(Order body)
+ throws NotFoundException {
+ // do some magic!
+ return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
+ }
+
+ @Override
+ public Response getOrderById(String orderId)
+ throws NotFoundException {
+ // do some magic!
+ return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
+ }
+
+ @Override
+ public Response deleteOrder(String orderId)
+ throws NotFoundException {
+ // do some magic!
+ return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
+ }
+
}
diff --git a/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/impl/UserApiServiceImpl.java b/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/impl/UserApiServiceImpl.java
index b7735c7ac9e..5a8e7a976c4 100644
--- a/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/impl/UserApiServiceImpl.java
+++ b/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/impl/UserApiServiceImpl.java
@@ -1,79 +1,68 @@
package io.swagger.api.impl;
import io.swagger.api.*;
-import io.swagger.model.*;
-
-import com.sun.jersey.multipart.FormDataParam;
-
-import io.swagger.model.User;
-import java.util.*;
-
-import java.util.List;
import io.swagger.api.NotFoundException;
-
-import java.io.InputStream;
-
-import com.sun.jersey.core.header.FormDataContentDisposition;
-import com.sun.jersey.multipart.FormDataParam;
+import io.swagger.model.User;
import javax.ws.rs.core.Response;
+import java.util.List;
public class UserApiServiceImpl extends UserApiService {
-
- @Override
- public Response createUser(User body)
- throws NotFoundException {
- // do some magic!
- return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
- }
-
- @Override
- public Response createUsersWithArrayInput(List body)
- throws NotFoundException {
- // do some magic!
- return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
- }
-
- @Override
- public Response createUsersWithListInput(List body)
- throws NotFoundException {
- // do some magic!
- return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
- }
-
- @Override
- public Response loginUser(String username,String password)
- throws NotFoundException {
- // do some magic!
- return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
- }
-
- @Override
- public Response logoutUser()
- throws NotFoundException {
- // do some magic!
- return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
- }
-
- @Override
- public Response getUserByName(String username)
- throws NotFoundException {
- // do some magic!
- return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
- }
-
- @Override
- public Response updateUser(String username,User body)
- throws NotFoundException {
- // do some magic!
- return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
- }
-
- @Override
- public Response deleteUser(String username)
- throws NotFoundException {
- // do some magic!
- return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
- }
-
+
+ @Override
+ public Response createUser(User body)
+ throws NotFoundException {
+ // do some magic!
+ return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
+ }
+
+ @Override
+ public Response createUsersWithArrayInput(List body)
+ throws NotFoundException {
+ // do some magic!
+ return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
+ }
+
+ @Override
+ public Response createUsersWithListInput(List body)
+ throws NotFoundException {
+ // do some magic!
+ return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
+ }
+
+ @Override
+ public Response loginUser(String username, String password)
+ throws NotFoundException {
+ // do some magic!
+ return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
+ }
+
+ @Override
+ public Response logoutUser()
+ throws NotFoundException {
+ // do some magic!
+ return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
+ }
+
+ @Override
+ public Response getUserByName(String username)
+ throws NotFoundException {
+ // do some magic!
+ return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
+ }
+
+ @Override
+ public Response updateUser(String username, User body)
+ throws NotFoundException {
+ // do some magic!
+ return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
+ }
+
+ @Override
+ public Response deleteUser(String username)
+ throws NotFoundException {
+ // do some magic!
+ return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
+ }
+
}
diff --git a/samples/server/petstore/jaxrs/src/main/resources/swagger.json b/samples/server/petstore/jaxrs/src/main/resources/swagger.json
deleted file mode 100644
index 5ca489f0929..00000000000
--- a/samples/server/petstore/jaxrs/src/main/resources/swagger.json
+++ /dev/null
@@ -1,762 +0,0 @@
-{
- "swagger" : "2.0",
- "info" : {
- "description" : "This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters",
- "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",
- "basePath" : "/v2",
- "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/json", "application/xml" ],
- "parameters" : [ {
- "in" : "body",
- "name" : "body",
- "description" : "Pet object that needs to be added to the store",
- "required" : false,
- "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/json", "application/xml" ],
- "parameters" : [ {
- "in" : "body",
- "name" : "body",
- "description" : "Pet object that needs to be added to the store",
- "required" : false,
- "schema" : {
- "$ref" : "#/definitions/Pet"
- }
- } ],
- "responses" : {
- "405" : {
- "description" : "Validation exception"
- },
- "404" : {
- "description" : "Pet not found"
- },
- "400" : {
- "description" : "Invalid ID supplied"
- }
- },
- "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 seperated strings",
- "operationId" : "findPetsByStatus",
- "produces" : [ "application/json", "application/xml" ],
- "parameters" : [ {
- "name" : "status",
- "in" : "query",
- "description" : "Status values that need to be considered for filter",
- "required" : false,
- "type" : "array",
- "items" : {
- "type" : "string"
- },
- "collectionFormat" : "multi",
- "default" : "available"
- } ],
- "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" : "Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.",
- "operationId" : "findPetsByTags",
- "produces" : [ "application/json", "application/xml" ],
- "parameters" : [ {
- "name" : "tags",
- "in" : "query",
- "description" : "Tags to filter by",
- "required" : false,
- "type" : "array",
- "items" : {
- "type" : "string"
- },
- "collectionFormat" : "multi"
- } ],
- "responses" : {
- "200" : {
- "description" : "successful operation",
- "schema" : {
- "type" : "array",
- "items" : {
- "$ref" : "#/definitions/Pet"
- }
- }
- },
- "400" : {
- "description" : "Invalid tag value"
- }
- },
- "security" : [ {
- "petstore_auth" : [ "write:pets", "read:pets" ]
- } ]
- }
- },
- "/pet/{petId}" : {
- "get" : {
- "tags" : [ "pet" ],
- "summary" : "Find pet by ID",
- "description" : "Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions",
- "operationId" : "getPetById",
- "produces" : [ "application/json", "application/xml" ],
- "parameters" : [ {
- "name" : "petId",
- "in" : "path",
- "description" : "ID of pet that needs to be fetched",
- "required" : true,
- "type" : "integer",
- "format" : "int64"
- } ],
- "responses" : {
- "404" : {
- "description" : "Pet not found"
- },
- "200" : {
- "description" : "successful operation",
- "schema" : {
- "$ref" : "#/definitions/Pet"
- }
- },
- "400" : {
- "description" : "Invalid ID supplied"
- }
- },
- "security" : [ {
- "api_key" : [ ]
- }, {
- "petstore_auth" : [ "write:pets", "read:pets" ]
- } ]
- },
- "post" : {
- "tags" : [ "pet" ],
- "summary" : "Updates a pet in the store with form data",
- "description" : "",
- "operationId" : "updatePetWithForm",
- "consumes" : [ "application/x-www-form-urlencoded" ],
- "produces" : [ "application/json", "application/xml" ],
- "parameters" : [ {
- "name" : "petId",
- "in" : "path",
- "description" : "ID of pet that needs to be updated",
- "required" : true,
- "type" : "string"
- }, {
- "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/json", "application/xml" ],
- "parameters" : [ {
- "name" : "api_key",
- "in" : "header",
- "description" : "",
- "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", "application/xml" ],
- "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" : {
- "default" : {
- "description" : "successful operation"
- }
- },
- "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", "application/xml" ],
- "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/json", "application/xml" ],
- "parameters" : [ {
- "in" : "body",
- "name" : "body",
- "description" : "order placed for purchasing the pet",
- "required" : false,
- "schema" : {
- "$ref" : "#/definitions/Order"
- }
- } ],
- "responses" : {
- "200" : {
- "description" : "successful operation",
- "schema" : {
- "$ref" : "#/definitions/Order"
- }
- },
- "400" : {
- "description" : "Invalid Order"
- }
- }
- }
- },
- "/store/order/{orderId}" : {
- "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/json", "application/xml" ],
- "parameters" : [ {
- "name" : "orderId",
- "in" : "path",
- "description" : "ID of pet that needs to be fetched",
- "required" : true,
- "type" : "string"
- } ],
- "responses" : {
- "404" : {
- "description" : "Order not found"
- },
- "200" : {
- "description" : "successful operation",
- "schema" : {
- "$ref" : "#/definitions/Order"
- }
- },
- "400" : {
- "description" : "Invalid ID supplied"
- }
- }
- },
- "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/json", "application/xml" ],
- "parameters" : [ {
- "name" : "orderId",
- "in" : "path",
- "description" : "ID of the order that needs to be deleted",
- "required" : true,
- "type" : "string"
- } ],
- "responses" : {
- "404" : {
- "description" : "Order not found"
- },
- "400" : {
- "description" : "Invalid ID supplied"
- }
- }
- }
- },
- "/user" : {
- "post" : {
- "tags" : [ "user" ],
- "summary" : "Create user",
- "description" : "This can only be done by the logged in user.",
- "operationId" : "createUser",
- "produces" : [ "application/json", "application/xml" ],
- "parameters" : [ {
- "in" : "body",
- "name" : "body",
- "description" : "Created user object",
- "required" : false,
- "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/json", "application/xml" ],
- "parameters" : [ {
- "in" : "body",
- "name" : "body",
- "description" : "List of user object",
- "required" : false,
- "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/json", "application/xml" ],
- "parameters" : [ {
- "in" : "body",
- "name" : "body",
- "description" : "List of user object",
- "required" : false,
- "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/json", "application/xml" ],
- "parameters" : [ {
- "name" : "username",
- "in" : "query",
- "description" : "The user name for login",
- "required" : false,
- "type" : "string"
- }, {
- "name" : "password",
- "in" : "query",
- "description" : "The password for login in clear text",
- "required" : false,
- "type" : "string"
- } ],
- "responses" : {
- "200" : {
- "description" : "successful operation",
- "schema" : {
- "type" : "string"
- }
- },
- "400" : {
- "description" : "Invalid username/password supplied"
- }
- }
- }
- },
- "/user/logout" : {
- "get" : {
- "tags" : [ "user" ],
- "summary" : "Logs out current logged in user session",
- "description" : "",
- "operationId" : "logoutUser",
- "produces" : [ "application/json", "application/xml" ],
- "parameters" : [ ],
- "responses" : {
- "default" : {
- "description" : "successful operation"
- }
- }
- }
- },
- "/user/{username}" : {
- "get" : {
- "tags" : [ "user" ],
- "summary" : "Get user by user name",
- "description" : "",
- "operationId" : "getUserByName",
- "produces" : [ "application/json", "application/xml" ],
- "parameters" : [ {
- "name" : "username",
- "in" : "path",
- "description" : "The name that needs to be fetched. Use user1 for testing. ",
- "required" : true,
- "type" : "string"
- } ],
- "responses" : {
- "404" : {
- "description" : "User not found"
- },
- "200" : {
- "description" : "successful operation",
- "schema" : {
- "$ref" : "#/definitions/User"
- },
- "examples" : {
- "application/json" : {
- "id" : 1,
- "username" : "johnp",
- "firstName" : "John",
- "lastName" : "Public",
- "email" : "johnp@swagger.io",
- "password" : "-secret-",
- "phone" : "0123456789",
- "userStatus" : 0
- }
- }
- },
- "400" : {
- "description" : "Invalid username supplied"
- }
- }
- },
- "put" : {
- "tags" : [ "user" ],
- "summary" : "Updated user",
- "description" : "This can only be done by the logged in user.",
- "operationId" : "updateUser",
- "produces" : [ "application/json", "application/xml" ],
- "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" : false,
- "schema" : {
- "$ref" : "#/definitions/User"
- }
- } ],
- "responses" : {
- "404" : {
- "description" : "User not found"
- },
- "400" : {
- "description" : "Invalid user supplied"
- }
- }
- },
- "delete" : {
- "tags" : [ "user" ],
- "summary" : "Delete user",
- "description" : "This can only be done by the logged in user.",
- "operationId" : "deleteUser",
- "produces" : [ "application/json", "application/xml" ],
- "parameters" : [ {
- "name" : "username",
- "in" : "path",
- "description" : "The name that needs to be deleted",
- "required" : true,
- "type" : "string"
- } ],
- "responses" : {
- "404" : {
- "description" : "User not found"
- },
- "400" : {
- "description" : "Invalid username supplied"
- }
- }
- }
- }
- },
- "securityDefinitions" : {
- "api_key" : {
- "type" : "apiKey",
- "name" : "api_key",
- "in" : "header"
- },
- "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"
- }
- }
- },
- "definitions" : {
- "User" : {
- "properties" : {
- "id" : {
- "type" : "integer",
- "format" : "int64"
- },
- "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"
- }
- },
- "Category" : {
- "properties" : {
- "id" : {
- "type" : "integer",
- "format" : "int64"
- },
- "name" : {
- "type" : "string"
- }
- },
- "xml" : {
- "name" : "Category"
- }
- },
- "Pet" : {
- "required" : [ "name", "photoUrls" ],
- "properties" : {
- "id" : {
- "type" : "integer",
- "format" : "int64"
- },
- "category" : {
- "$ref" : "#/definitions/Category"
- },
- "name" : {
- "type" : "string",
- "example" : "doggie"
- },
- "photoUrls" : {
- "type" : "array",
- "items" : {
- "type" : "string"
- }
- },
- "tags" : {
- "type" : "array",
- "items" : {
- "$ref" : "#/definitions/Tag"
- }
- },
- "status" : {
- "type" : "string",
- "description" : "pet status in the store",
- "enum" : [ "available", "pending", "sold" ]
- }
- },
- "xml" : {
- "name" : "Pet"
- }
- },
- "Tag" : {
- "properties" : {
- "id" : {
- "type" : "integer",
- "format" : "int64"
- },
- "name" : {
- "type" : "string"
- }
- },
- "xml" : {
- "name" : "Tag"
- }
- },
- "Order" : {
- "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"
- }
- },
- "xml" : {
- "name" : "Order"
- }
- }
- }
-}
\ No newline at end of file