Merge pull request #2497 from swagger-api/issue-2496

sanitize tags, update generation timestamp
This commit is contained in:
Tony Tam 2016-04-05 07:40:11 -07:00
commit a1c978751a
47 changed files with 492 additions and 526 deletions

View File

@ -26,6 +26,6 @@ fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l java -o samples/client/petstore/java/default"
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l java -o samples/client/petstore/java/default -DhideGenerationTimestamp=true"
java $JAVA_OPTS -jar $executable $ags

View File

@ -26,6 +26,6 @@ fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaJaxRS -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l jaxrs-cxf -o samples/server/petstore/jaxrs-cxf"
ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaJaxRS -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l jaxrs-cxf -o samples/server/petstore/jaxrs-cxf -DhideGenerationTimestamp=true"
java $JAVA_OPTS -jar $executable $ags

View File

@ -26,6 +26,6 @@ fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaJaxRS -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l jaxrs -o samples/server/petstore/jaxrs"
ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaJaxRS -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l jaxrs -o samples/server/petstore/jaxrs -DhideGenerationTimestamp=true"
java $JAVA_OPTS -jar $executable $ags

View File

@ -26,6 +26,6 @@ fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaJaxRS -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l jaxrs-resteasy -o samples/server/petstore/jaxrs-resteasy"
ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaJaxRS -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l jaxrs-resteasy -o samples/server/petstore/jaxrs-resteasy -DhideGenerationTimestamp=true"
java $JAVA_OPTS -jar $executable $ags

View File

@ -26,6 +26,6 @@ fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaJaxRS -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l jaxrs -o samples/server/petstore/jersey2 --library=jersey2"
ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaJaxRS -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l jaxrs -o samples/server/petstore/jersey2 --library=jersey2 -DhideGenerationTimestamp=true"
java $JAVA_OPTS -jar $executable $ags

View File

@ -26,6 +26,6 @@ fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l nodejs-server -o samples/server/petstore/nodejs"
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l nodejs-server -o samples/server/petstore/nodejs"
java $JAVA_OPTS -Dservice -jar $executable $ags

View File

@ -42,6 +42,8 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig {
protected Boolean serializableModel = false;
protected boolean serializeBigDecimalAsString = false;
protected boolean useRxJava = false;
protected boolean hideGenerationTimestamp = false;
public JavaClientCodegen() {
super();
@ -99,6 +101,7 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig {
.SERIALIZE_BIG_DECIMAL_AS_STRING_DESC));
cliOptions.add(CliOption.newBoolean(FULL_JAVA_UTIL, "whether to use fully qualified name for classes under java.util"));
cliOptions.add(CliOption.newBoolean(USE_RX_JAVA, "Whether to use the RxJava adapter with the retrofit2 library."));
cliOptions.add(new CliOption("hideGenerationTimestamp", "hides the timestamp when files were generated"));
supportedLibraries.put(DEFAULT_LIBRARY, "HTTP client: Jersey client 1.18. JSON processing: Jackson 2.4.2");
supportedLibraries.put("feign", "HTTP client: Netflix Feign 8.1.1");

View File

@ -7,8 +7,6 @@ import java.io.File;
import java.util.*;
public class JavaJerseyServerCodegen extends AbstractJavaJAXRSServerCodegen {
boolean showGenerationTimestamp = false;
public JavaJerseyServerCodegen() {
super();
@ -48,7 +46,6 @@ public class JavaJerseyServerCodegen extends AbstractJavaJAXRSServerCodegen {
cliOptions.add(library);
cliOptions.add(new CliOption(CodegenConstants.IMPL_FOLDER, CodegenConstants.IMPL_FOLDER_DESC));
cliOptions.add(new CliOption("title", "a title describing the application"));
cliOptions.add(new CliOption("showGenerationTimestamp", "shows the timestamp when files were generated"));
}
@Override
@ -152,7 +149,7 @@ public class JavaJerseyServerCodegen extends AbstractJavaJAXRSServerCodegen {
co.baseName = basePath;
}
public void showGenerationTimestamp(boolean showGenerationTimestamp) {
this.showGenerationTimestamp = showGenerationTimestamp;
public void hideGenerationTimestamp(boolean hideGenerationTimestamp) {
this.hideGenerationTimestamp = hideGenerationTimestamp;
}
}

View File

@ -278,7 +278,9 @@ public class NodeJSServerCodegen extends DefaultCodegen implements CodegenConfig
if(operation.getOperationId() == null) {
operation.setOperationId(getOrGenerateOperationId(operation, pathname, method.toString()));
}
operation.getVendorExtensions().put("x-swagger-router-controller", toApiName(tag));
if(operation.getVendorExtensions().get("x-swagger-router-controller") == null) {
operation.getVendorExtensions().put("x-swagger-router-controller", sanitizeTag(tag));
}
}
}
}

View File

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

View File

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

View File

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

View File

@ -1,11 +1,9 @@
package io.swagger.codegen.options;
import io.swagger.codegen.Codegen;
import com.google.common.collect.ImmutableMap;
import io.swagger.codegen.CodegenConstants;
import io.swagger.codegen.languages.JavaClientCodegen;
import com.google.common.collect.ImmutableMap;
import java.util.Map;
public class JavaOptionsProvider implements OptionsProvider {
@ -46,6 +44,7 @@ public class JavaOptionsProvider implements OptionsProvider {
.put(CodegenConstants.SERIALIZE_BIG_DECIMAL_AS_STRING, "true")
.put(JavaClientCodegen.USE_RX_JAVA, "false")
.put(JavaClientCodegen.DATE_LIBRARY, "joda")
.put("hideGenerationTimestamp", "true")
.build();
}

View File

@ -27,8 +27,7 @@ public class JaxRSServerOptionsProvider extends JavaOptionsProvider {
builder.putAll(options)
.put(CodegenConstants.IMPL_FOLDER, IMPL_FOLDER_VALUE)
//.put(JavaJaxRSJersey1ServerCodegen.DATE_LIBRARY, "joda") //java.lang.IllegalArgumentException: Multiple entries with same key: dateLibrary=joda and dateLibrary=joda
.put("title", "Test title")
.put("showGenerationTimestamp", "true");
.put("title", "Test title");
return builder.build();
}

View File

@ -3,7 +3,7 @@ package io.swagger.client;
import java.util.Map;
import java.util.List;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-17T10:45:51.189+08:00")
public class ApiException extends Exception {
private int code = 0;
private Map<String, List<String>> responseHeaders = null;

View File

@ -1,6 +1,6 @@
package io.swagger.client;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-17T10:45:51.189+08:00")
public class Configuration {
private static ApiClient defaultApiClient = new ApiClient();

View File

@ -1,6 +1,6 @@
package io.swagger.client;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-17T10:45:51.189+08:00")
public class Pair {
private String name = "";
private String value = "";

View File

@ -1,6 +1,6 @@
package io.swagger.client;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-17T10:45:51.189+08:00")
public class StringUtil {
/**
* Check if the given array contains the given value (with case-insensitive comparison).

View File

@ -16,7 +16,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-17T16:01:11.428+08:00")
public class PetApi {
private ApiClient apiClient;
@ -294,7 +294,7 @@ public class PetApi {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "petstore_auth", "api_key" };
String[] localVarAuthNames = new String[] { "api_key", "petstore_auth" };
GenericType<Pet> localVarReturnType = new GenericType<Pet>() {};
@ -342,7 +342,7 @@ public class PetApi {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "petstore_auth", "api_key" };
String[] localVarAuthNames = new String[] { "api_key", "petstore_auth" };
GenericType<InlineResponse200> localVarReturnType = new GenericType<InlineResponse200>() {};
@ -390,7 +390,7 @@ public class PetApi {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "petstore_auth", "api_key" };
String[] localVarAuthNames = new String[] { "api_key", "petstore_auth" };
GenericType<byte[]> localVarReturnType = new GenericType<byte[]>() {};

View File

@ -14,7 +14,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-17T16:01:11.428+08:00")
public class StoreApi {
private ApiClient apiClient;
@ -247,7 +247,7 @@ public class StoreApi {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "test_api_key_query", "test_api_key_header" };
String[] localVarAuthNames = new String[] { "test_api_key_header", "test_api_key_query" };
GenericType<Order> localVarReturnType = new GenericType<Order>() {};

View File

@ -14,7 +14,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-17T16:01:11.428+08:00")
public class UserApi {
private ApiClient apiClient;
@ -204,7 +204,7 @@ public class UserApi {
/**
* Get user by user name
*
* @param username The name that needs to be fetched. Use user1 for testing. (required)
* @param username The name that needs to be fetched. Use user1 for testing. (required)
* @return User
* @throws ApiException if fails to make API call
*/

View File

@ -5,7 +5,7 @@ import io.swagger.client.Pair;
import java.util.Map;
import java.util.List;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-17T10:45:51.189+08:00")
public class ApiKeyAuth implements Authentication {
private final String location;
private final String paramName;

View File

@ -9,7 +9,7 @@ import java.util.List;
import java.io.UnsupportedEncodingException;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-17T10:45:51.189+08:00")
public class HttpBasicAuth implements Authentication {
private String username;
private String password;

View File

@ -5,7 +5,7 @@ import io.swagger.client.Pair;
import java.util.Map;
import java.util.List;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-17T10:45:51.189+08:00")
public class OAuth implements Authentication {
private String accessToken;

View File

@ -9,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-17T10:45:51.189+08:00")
public class Category {
private Long id = null;

View File

@ -13,7 +13,7 @@ import java.util.List;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-17T10:45:51.189+08:00")
public class InlineResponse200 {
private List<Tag> tags = new ArrayList<Tag>();

View File

@ -9,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-17T10:45:51.189+08:00")
public class Model200Response {
private Integer name = null;

View File

@ -9,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-17T10:45:51.189+08:00")
public class ModelReturn {
private Integer _return = null;

View File

@ -9,10 +9,11 @@ import io.swagger.annotations.ApiModelProperty;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-17T10:45:51.189+08:00")
public class Name {
private Integer name = null;
private Integer snakeCase = null;
/**
@ -32,6 +33,23 @@ public class Name {
}
/**
**/
public Name snakeCase(Integer snakeCase) {
this.snakeCase = snakeCase;
return this;
}
@ApiModelProperty(example = "null", value = "")
@JsonProperty("snake_case")
public Integer getSnakeCase() {
return snakeCase;
}
public void setSnakeCase(Integer snakeCase) {
this.snakeCase = snakeCase;
}
@Override
public boolean equals(java.lang.Object o) {
@ -42,12 +60,13 @@ public class Name {
return false;
}
Name name = (Name) o;
return Objects.equals(this.name, name.name);
return Objects.equals(this.name, name.name) &&
Objects.equals(this.snakeCase, name.snakeCase);
}
@Override
public int hashCode() {
return Objects.hash(name);
return Objects.hash(name, snakeCase);
}
@Override
@ -56,6 +75,7 @@ public class Name {
sb.append("class Name {\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" snakeCase: ").append(toIndentedString(snakeCase)).append("\n");
sb.append("}");
return sb.toString();
}

View File

@ -11,7 +11,7 @@ import java.util.Date;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-17T10:45:51.189+08:00")
public class Order {
private Long id = null;

View File

@ -14,7 +14,7 @@ import java.util.List;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-17T10:45:51.189+08:00")
public class Pet {
private Long id = null;

View File

@ -9,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-17T10:45:51.189+08:00")
public class SpecialModelName {
private Long specialPropertyName = null;

View File

@ -9,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-17T10:45:51.189+08:00")
public class Tag {
private Long id = null;

View File

@ -9,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-17T10:45:51.189+08:00")
public class User {
private Long id = null;

View File

@ -1,7 +1,7 @@
package io.swagger.api;
import io.swagger.model.Pet;
import io.swagger.model.InlineResponse200;
import io.swagger.model.ApiResponse;
import java.io.File;
import javax.ws.rs.*;
@ -14,57 +14,42 @@ public interface PetApi {
@POST
@Path("/pet")
@Consumes({ "application/json", "application/xml" })
@Produces({ "application/json", "application/xml" })
@Produces({ "application/xml", "application/json" })
public Response addPet(Pet body);
@POST
@Path("/pet?testing_byte_array=true")
@Consumes({ "application/json", "application/xml" })
@Produces({ "application/json", "application/xml" })
public Response addPetUsingByteArray(byte[] body);
@DELETE
@Path("/pet/{petId}")
@Produces({ "application/json", "application/xml" })
@Produces({ "application/xml", "application/json" })
public Response deletePet(@PathParam("petId") Long petId,@HeaderParam("api_key") String apiKey);
@GET
@Path("/pet/findByStatus")
@Produces({ "application/json", "application/xml" })
@Produces({ "application/xml", "application/json" })
public Response findPetsByStatus(@QueryParam("status") List<String> status);
@GET
@Path("/pet/findByTags")
@Produces({ "application/json", "application/xml" })
@Produces({ "application/xml", "application/json" })
public Response findPetsByTags(@QueryParam("tags") List<String> tags);
@GET
@Path("/pet/{petId}")
@Produces({ "application/json", "application/xml" })
@Produces({ "application/xml", "application/json" })
public Response getPetById(@PathParam("petId") Long petId);
@GET
@Path("/pet/{petId}?response=inline_arbitrary_object")
@Produces({ "application/json", "application/xml" })
public Response getPetByIdInObject(@PathParam("petId") Long petId);
@GET
@Path("/pet/{petId}?testing_byte_array=true")
@Produces({ "application/json", "application/xml" })
public Response petPetIdtestingByteArraytrueGet(@PathParam("petId") Long petId);
@PUT
@Path("/pet")
@Consumes({ "application/json", "application/xml" })
@Produces({ "application/json", "application/xml" })
@Produces({ "application/xml", "application/json" })
public Response updatePet(Pet body);
@POST
@Path("/pet/{petId}")
@Consumes({ "application/x-www-form-urlencoded" })
@Produces({ "application/json", "application/xml" })
public Response updatePetWithForm(@PathParam("petId") String petId,@Multipart(value = "name", required = false) String name,@Multipart(value = "status", required = false) String status);
@Produces({ "application/xml", "application/json" })
public Response updatePetWithForm(@PathParam("petId") Long petId,@Multipart(value = "name", required = false) String name,@Multipart(value = "status", required = false) String status);
@POST
@Path("/pet/{petId}/uploadImage")
@Consumes({ "multipart/form-data" })
@Produces({ "application/json", "application/xml" })
@Produces({ "application/json" })
public Response uploadFile(@PathParam("petId") Long petId,@Multipart(value = "additionalMetadata", required = false) String additionalMetadata, @Multipart(value = "file", required = false) InputStream fileInputStream,
@Multipart(value = "file" , required = false) Attachment fileDetail);
}

View File

@ -1,7 +1,7 @@
package io.swagger.api;
import io.swagger.model.Order;
import java.util.Map;
import io.swagger.model.Order;
import javax.ws.rs.*;
import javax.ws.rs.core.Response;
@ -13,32 +13,22 @@ public interface StoreApi {
@DELETE
@Path("/store/order/{orderId}")
@Produces({ "application/json", "application/xml" })
public Response deleteOrder(@PathParam("orderId") String orderId);
@GET
@Path("/store/findByStatus")
@Produces({ "application/json", "application/xml" })
public Response findOrdersByStatus(@QueryParam("status") String status);
@Produces({ "application/xml", "application/json" })
public Response deleteOrder(@PathParam("orderId") Long orderId);
@GET
@Path("/store/inventory")
@Produces({ "application/json", "application/xml" })
@Produces({ "application/json" })
public Response getInventory();
@GET
@Path("/store/inventory?response=arbitrary_object")
@Produces({ "application/json", "application/xml" })
public Response getInventoryInObject();
@GET
@Path("/store/order/{orderId}")
@Produces({ "application/json", "application/xml" })
public Response getOrderById(@PathParam("orderId") String orderId);
@Produces({ "application/xml", "application/json" })
public Response getOrderById(@PathParam("orderId") Long orderId);
@POST
@Path("/store/order")
@Produces({ "application/json", "application/xml" })
@Produces({ "application/xml", "application/json" })
public Response placeOrder(Order body);
}

View File

@ -13,42 +13,42 @@ public interface UserApi {
@POST
@Path("/user")
@Produces({ "application/json", "application/xml" })
@Produces({ "application/xml", "application/json" })
public Response createUser(User body);
@POST
@Path("/user/createWithArray")
@Produces({ "application/json", "application/xml" })
@Produces({ "application/xml", "application/json" })
public Response createUsersWithArrayInput(List<User> body);
@POST
@Path("/user/createWithList")
@Produces({ "application/json", "application/xml" })
@Produces({ "application/xml", "application/json" })
public Response createUsersWithListInput(List<User> body);
@DELETE
@Path("/user/{username}")
@Produces({ "application/json", "application/xml" })
@Produces({ "application/xml", "application/json" })
public Response deleteUser(@PathParam("username") String username);
@GET
@Path("/user/{username}")
@Produces({ "application/json", "application/xml" })
@Produces({ "application/xml", "application/json" })
public Response getUserByName(@PathParam("username") String username);
@GET
@Path("/user/login")
@Produces({ "application/json", "application/xml" })
@Produces({ "application/xml", "application/json" })
public Response loginUser(@QueryParam("username") String username,@QueryParam("password") String password);
@GET
@Path("/user/logout")
@Produces({ "application/json", "application/xml" })
@Produces({ "application/xml", "application/json" })
public Response logoutUser();
@PUT
@Path("/user/{username}")
@Produces({ "application/json", "application/xml" })
@Produces({ "application/xml", "application/json" })
public Response updateUser(@PathParam("username") String username,User body);
}

View File

@ -45,7 +45,7 @@ public enum Order {
private StatusEnum status = null;
private Boolean complete = null;
private Boolean complete = false;
/**

View File

@ -0,0 +1,31 @@
package io.swagger.api;
import io.swagger.jaxrs.config.SwaggerContextService;
import io.swagger.models.*;
import io.swagger.models.auth.*;
import javax.servlet.http.HttpServlet;
import javax.servlet.ServletContext;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
public class Bootstrap extends HttpServlet {
@Override
public void init(ServletConfig config) throws ServletException {
Info info = new Info()
.title("Swagger Server")
.description("This is a sample server Petstore server. You can find out more about\nSwagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/).\nFor this sample, you can use the api key `special-key` to test the authorization filters.\n")
.termsOfService("http://swagger.io/terms/")
.contact(new Contact()
.email("apiteam@swagger.io"))
.license(new License()
.name("Apache 2.0")
.url("http://www.apache.org/licenses/LICENSE-2.0.html"));
ServletContext context = config.getServletContext();
Swagger swagger = new Swagger().info(info);
new SwaggerContextService().withServletConfig(config).updateSwagger(swagger);
}
}

View File

@ -1,10 +1,10 @@
---
swagger: "2.0"
info:
description: "This is a sample server Petstore server. You can find out more about\
\ Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net,\
\ #swagger. For this sample, you can use the api key \"special-key\" to test\
\ the authorization filters"
description: "This is a sample server Petstore server. You can find out more about\n\
Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/).\n\
For this sample, you can use the api key `special-key` to test the authorization\
\ filters.\n"
version: "1.0.0"
title: "Swagger Petstore"
termsOfService: "http://swagger.io/terms/"
@ -15,6 +15,19 @@ info:
url: "http://www.apache.org/licenses/LICENSE-2.0.html"
host: "petstore.swagger.io"
basePath: "/v2"
tags:
- name: "pet"
description: "Everything about your Pets"
externalDocs:
description: "Find out more"
url: "http://swagger.io"
- name: "store"
description: "Access to Petstore orders"
- name: "user"
description: "Operations about user"
externalDocs:
description: "Find out more about our store"
url: "http://swagger.io"
schemes:
- "http"
paths:
@ -23,19 +36,18 @@ paths:
tags:
- "pet"
summary: "Add a new pet to the store"
description: ""
operationId: "addPet"
consumes:
- "application/json"
- "application/xml"
produces:
- "application/json"
- "application/xml"
- "application/json"
parameters:
- in: "body"
name: "body"
description: "Pet object that needs to be added to the store"
required: false
required: true
schema:
$ref: "#/definitions/Pet"
responses:
@ -45,23 +57,23 @@ paths:
- petstore_auth:
- "write:pets"
- "read:pets"
x-swagger-router-controller: "Pet"
put:
tags:
- "pet"
summary: "Update an existing pet"
description: ""
operationId: "updatePet"
consumes:
- "application/json"
- "application/xml"
produces:
- "application/json"
- "application/xml"
- "application/json"
parameters:
- in: "body"
name: "body"
description: "Pet object that needs to be added to the store"
required: false
required: true
schema:
$ref: "#/definitions/Pet"
responses:
@ -75,26 +87,31 @@ paths:
- petstore_auth:
- "write:pets"
- "read:pets"
x-swagger-router-controller: "Pet"
/pet/findByStatus:
get:
tags:
- "pet"
summary: "Finds Pets by status"
description: "Multiple status values can be provided with comma seperated strings"
description: "Multiple status values can be provided with comma separated strings"
operationId: "findPetsByStatus"
produces:
- "application/json"
- "application/xml"
- "application/json"
parameters:
- name: "status"
in: "query"
description: "Status values that need to be considered for filter"
required: false
required: true
type: "array"
items:
type: "string"
default: "available"
enum:
- "available"
- "pending"
- "sold"
collectionFormat: "multi"
default: "available"
responses:
200:
description: "successful operation"
@ -108,22 +125,23 @@ paths:
- petstore_auth:
- "write:pets"
- "read:pets"
x-swagger-router-controller: "Pet"
/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."
description: "Muliple tags can be provided with comma separated strings. Use\n\
tag1, tag2, tag3 for testing.\n"
operationId: "findPetsByTags"
produces:
- "application/json"
- "application/xml"
- "application/json"
parameters:
- name: "tags"
in: "query"
description: "Tags to filter by"
required: false
required: true
type: "array"
items:
type: "string"
@ -141,21 +159,22 @@ paths:
- petstore_auth:
- "write:pets"
- "read:pets"
deprecated: true
x-swagger-router-controller: "Pet"
/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"
description: "Returns a single pet"
operationId: "getPetById"
produces:
- "application/json"
- "application/xml"
- "application/json"
parameters:
- name: "petId"
in: "path"
description: "ID of pet that needs to be fetched"
description: "ID of pet to return"
required: true
type: "integer"
format: "int64"
@ -170,26 +189,25 @@ paths:
description: "Pet not found"
security:
- api_key: []
- petstore_auth:
- "write:pets"
- "read:pets"
x-swagger-router-controller: "Pet"
post:
tags:
- "pet"
summary: "Updates a pet in the store with form data"
description: ""
description: "null"
operationId: "updatePetWithForm"
consumes:
- "application/x-www-form-urlencoded"
produces:
- "application/json"
- "application/xml"
- "application/json"
parameters:
- name: "petId"
in: "path"
description: "ID of pet that needs to be updated"
required: true
type: "string"
type: "integer"
format: "int64"
- name: "name"
in: "formData"
description: "Updated name of the pet"
@ -207,19 +225,18 @@ paths:
- petstore_auth:
- "write:pets"
- "read:pets"
x-swagger-router-controller: "Pet"
delete:
tags:
- "pet"
summary: "Deletes a pet"
description: ""
operationId: "deletePet"
produces:
- "application/json"
- "application/xml"
- "application/json"
parameters:
- name: "api_key"
in: "header"
description: ""
required: false
type: "string"
- name: "petId"
@ -230,23 +247,24 @@ paths:
format: "int64"
responses:
400:
description: "Invalid pet value"
description: "Invalid ID supplied"
404:
description: "Pet not found"
security:
- petstore_auth:
- "write:pets"
- "read:pets"
x-swagger-router-controller: "Pet"
/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"
@ -264,75 +282,16 @@ paths:
description: "file to upload"
required: false
type: "file"
responses:
default:
description: "successful operation"
security:
- petstore_auth:
- "write:pets"
- "read:pets"
/pet/{petId}?testing_byte_array=true:
get:
tags:
- "pet"
summary: "Fake endpoint to test byte array return by 'Find pet by ID'"
description: "Returns a pet when ID < 10. ID > 10 or nonintegers will simulate\
\ API error conditions"
operationId: "getPetByIdWithByteArray"
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:
200:
description: "successful operation"
schema:
type: "string"
format: "binary"
400:
description: "Invalid ID supplied"
404:
description: "Pet not found"
security:
- api_key: []
- petstore_auth:
- "write:pets"
- "read:pets"
/pet?testing_byte_array=true:
post:
tags:
- "pet"
summary: "Fake endpoint to test byte array in body parameter for adding a new\
\ pet to the store"
description: ""
operationId: "addPetUsingByteArray"
consumes:
- "application/json"
- "application/xml"
produces:
- "application/json"
- "application/xml"
parameters:
- in: "body"
name: "body"
description: "Pet object in the form of byte array"
required: false
schema:
type: "string"
format: "binary"
responses:
405:
description: "Invalid input"
$ref: "#/definitions/ApiResponse"
security:
- petstore_auth:
- "write:pets"
- "read:pets"
x-swagger-router-controller: "Pet"
/store/inventory:
get:
tags:
@ -342,7 +301,6 @@ paths:
operationId: "getInventory"
produces:
- "application/json"
- "application/xml"
parameters: []
responses:
200:
@ -354,21 +312,21 @@ paths:
format: "int32"
security:
- api_key: []
x-swagger-router-controller: "Store"
/store/order:
post:
tags:
- "store"
summary: "Place an order for a pet"
description: ""
operationId: "placeOrder"
produces:
- "application/json"
- "application/xml"
- "application/json"
parameters:
- in: "body"
name: "body"
description: "order placed for purchasing the pet"
required: false
required: true
schema:
$ref: "#/definitions/Order"
responses:
@ -378,23 +336,27 @@ paths:
$ref: "#/definitions/Order"
400:
description: "Invalid Order"
x-swagger-router-controller: "Store"
/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"
description: "For valid response try integer IDs with value >= 1 and <= 10.\n\
Other values will generated exceptions\n"
operationId: "getOrderById"
produces:
- "application/json"
- "application/xml"
- "application/json"
parameters:
- name: "orderId"
in: "path"
description: "ID of pet that needs to be fetched"
required: true
type: "string"
type: "integer"
maximum: 10
minimum: 1
format: "int64"
responses:
200:
description: "successful operation"
@ -404,27 +366,31 @@ paths:
description: "Invalid ID supplied"
404:
description: "Order not found"
x-swagger-router-controller: "Store"
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"
description: "For valid response try integer IDs with positive integer value.\\\
\ \\ Negative or non-integer values will generate API errors"
operationId: "deleteOrder"
produces:
- "application/json"
- "application/xml"
- "application/json"
parameters:
- name: "orderId"
in: "path"
description: "ID of the order that needs to be deleted"
required: true
type: "string"
type: "integer"
minimum: 1
format: "int64"
responses:
400:
description: "Invalid ID supplied"
404:
description: "Order not found"
x-swagger-router-controller: "Store"
/user:
post:
tags:
@ -433,33 +399,33 @@ paths:
description: "This can only be done by the logged in user."
operationId: "createUser"
produces:
- "application/json"
- "application/xml"
- "application/json"
parameters:
- in: "body"
name: "body"
description: "Created user object"
required: false
required: true
schema:
$ref: "#/definitions/User"
responses:
default:
description: "successful operation"
x-swagger-router-controller: "User"
/user/createWithArray:
post:
tags:
- "user"
summary: "Creates list of users with given input array"
description: ""
operationId: "createUsersWithArrayInput"
produces:
- "application/json"
- "application/xml"
- "application/json"
parameters:
- in: "body"
name: "body"
description: "List of user object"
required: false
required: true
schema:
type: "array"
items:
@ -467,21 +433,21 @@ paths:
responses:
default:
description: "successful operation"
x-swagger-router-controller: "User"
/user/createWithList:
post:
tags:
- "user"
summary: "Creates list of users with given input array"
description: ""
operationId: "createUsersWithListInput"
produces:
- "application/json"
- "application/xml"
- "application/json"
parameters:
- in: "body"
name: "body"
description: "List of user object"
required: false
required: true
schema:
type: "array"
items:
@ -489,62 +455,72 @@ paths:
responses:
default:
description: "successful operation"
x-swagger-router-controller: "User"
/user/login:
get:
tags:
- "user"
summary: "Logs user into the system"
description: ""
operationId: "loginUser"
produces:
- "application/json"
- "application/xml"
- "application/json"
parameters:
- name: "username"
in: "query"
description: "The user name for login"
required: false
required: true
type: "string"
- name: "password"
in: "query"
description: "The password for login in clear text"
required: false
required: true
type: "string"
responses:
200:
description: "successful operation"
schema:
type: "string"
headers:
X-Rate-Limit:
type: "integer"
format: "int32"
description: "calls per hour allowed by the user"
X-Expires-After:
type: "string"
format: "date-time"
description: "date in UTC when token expires"
400:
description: "Invalid username/password supplied"
x-swagger-router-controller: "User"
/user/logout:
get:
tags:
- "user"
summary: "Logs out current logged in user session"
description: ""
description: "null"
operationId: "logoutUser"
produces:
- "application/json"
- "application/xml"
- "application/json"
parameters: []
responses:
default:
description: "successful operation"
x-swagger-router-controller: "User"
/user/{username}:
get:
tags:
- "user"
summary: "Get user by user name"
description: ""
operationId: "getUserByName"
produces:
- "application/json"
- "application/xml"
- "application/json"
parameters:
- name: "username"
in: "path"
description: "The name that needs to be fetched. Use user1 for testing. "
description: "The name that needs to be fetched. Use user1 for testing."
required: true
type: "string"
responses:
@ -552,20 +528,11 @@ paths:
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"
404:
description: "User not found"
x-swagger-router-controller: "User"
put:
tags:
- "user"
@ -573,18 +540,18 @@ paths:
description: "This can only be done by the logged in user."
operationId: "updateUser"
produces:
- "application/json"
- "application/xml"
- "application/json"
parameters:
- name: "username"
in: "path"
description: "name that need to be deleted"
description: "name that need to be updated"
required: true
type: "string"
- in: "body"
name: "body"
description: "Updated user object"
required: false
required: true
schema:
$ref: "#/definitions/User"
responses:
@ -592,6 +559,7 @@ paths:
description: "Invalid user supplied"
404:
description: "User not found"
x-swagger-router-controller: "User"
delete:
tags:
- "user"
@ -599,8 +567,8 @@ paths:
description: "This can only be done by the logged in user."
operationId: "deleteUser"
produces:
- "application/json"
- "application/xml"
- "application/json"
parameters:
- name: "username"
in: "path"
@ -612,6 +580,7 @@ paths:
description: "Invalid username supplied"
404:
description: "User not found"
x-swagger-router-controller: "User"
securityDefinitions:
api_key:
type: "apiKey"
@ -619,13 +588,41 @@ securityDefinitions:
in: "header"
petstore_auth:
type: "oauth2"
authorizationUrl: "http://petstore.swagger.io/api/oauth/dialog"
authorizationUrl: "http://petstore.swagger.io/oauth/dialog"
flow: "implicit"
scopes:
write:pets: "modify pets in your account"
read:pets: "read your pets"
definitions:
Order:
type: "object"
properties:
id:
type: "integer"
format: "int64"
petId:
type: "integer"
format: "int64"
quantity:
type: "integer"
format: "int32"
shipDate:
type: "string"
format: "date-time"
status:
type: "string"
description: "Order Status"
enum:
- "placed"
- "approved"
- "delivered"
complete:
type: "boolean"
default: false
xml:
name: "Order"
User:
type: "object"
properties:
id:
type: "integer"
@ -649,6 +646,7 @@ definitions:
xml:
name: "User"
Category:
type: "object"
properties:
id:
type: "integer"
@ -657,7 +655,18 @@ definitions:
type: "string"
xml:
name: "Category"
Tag:
type: "object"
properties:
id:
type: "integer"
format: "int64"
name:
type: "string"
xml:
name: "Tag"
Pet:
type: "object"
required:
- "name"
- "photoUrls"
@ -693,37 +702,16 @@ definitions:
- "sold"
xml:
name: "Pet"
Tag:
ApiResponse:
type: "object"
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:
code:
type: "integer"
format: "int32"
shipDate:
type:
type: "string"
format: "date-time"
status:
message:
type: "string"
description: "Order Status"
enum:
- "placed"
- "approved"
- "delivered"
complete:
type: "boolean"
xml:
name: "Order"
externalDocs:
description: "Find out more about Swagger"
url: "http://swagger.io"

View File

@ -6,14 +6,14 @@ var url = require('url');
var Pet = require('./PetService');
module.exports.updatePet = function updatePet (req, res, next) {
Pet.updatePet(req.swagger.params, res, next);
};
module.exports.addPet = function addPet (req, res, next) {
Pet.addPet(req.swagger.params, res, next);
};
module.exports.deletePet = function deletePet (req, res, next) {
Pet.deletePet(req.swagger.params, res, next);
};
module.exports.findPetsByStatus = function findPetsByStatus (req, res, next) {
Pet.findPetsByStatus(req.swagger.params, res, next);
};
@ -26,22 +26,14 @@ module.exports.getPetById = function getPetById (req, res, next) {
Pet.getPetById(req.swagger.params, res, next);
};
module.exports.updatePetWithForm = function updatePetWithForm (req, res, next) {
Pet.updatePetWithForm(req.swagger.params, res, next);
module.exports.updatePet = function updatePet (req, res, next) {
Pet.updatePet(req.swagger.params, res, next);
};
module.exports.deletePet = function deletePet (req, res, next) {
Pet.deletePet(req.swagger.params, res, next);
module.exports.updatePetWithForm = function updatePetWithForm (req, res, next) {
Pet.updatePetWithForm(req.swagger.params, res, next);
};
module.exports.uploadFile = function uploadFile (req, res, next) {
Pet.uploadFile(req.swagger.params, res, next);
};
module.exports.getPetByIdWithByteArray = function getPetByIdWithByteArray (req, res, next) {
Pet.getPetByIdWithByteArray(req.swagger.params, res, next);
};
module.exports.addPetUsingByteArray = function addPetUsingByteArray (req, res, next) {
Pet.addPetUsingByteArray(req.swagger.params, res, next);
};

View File

@ -1,37 +1,36 @@
'use strict';
exports.updatePet = function(args, res, next) {
/**
* parameters expected in the args:
* body (Pet)
**/
var examples = {};
res.end();
}
exports.addPet = function(args, res, next) {
/**
* parameters expected in the args:
* body (Pet)
**/
var examples = {};
* body (Pet)
**/
// no response value expected for this operation
res.end();
}
exports.deletePet = function(args, res, next) {
/**
* parameters expected in the args:
* petId (Long)
* apiKey (String)
**/
// no response value expected for this operation
res.end();
}
exports.findPetsByStatus = function(args, res, next) {
/**
* parameters expected in the args:
* status (List)
**/
var examples = {};
* status (List)
**/
var examples = {};
examples['application/json'] = [ {
"tags" : [ {
"id" : 123456789,
@ -47,8 +46,6 @@ var examples = {};
"photoUrls" : [ "aeiou" ]
} ];
if(Object.keys(examples).length > 0) {
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(examples[Object.keys(examples)[0]] || {}, null, 2));
@ -59,14 +56,15 @@ var examples = {};
}
exports.findPetsByTags = function(args, res, next) {
/**
* parameters expected in the args:
* tags (List)
**/
var examples = {};
* tags (List)
**/
var examples = {};
examples['application/json'] = [ {
"tags" : [ {
"id" : 123456789,
@ -82,8 +80,6 @@ var examples = {};
"photoUrls" : [ "aeiou" ]
} ];
if(Object.keys(examples).length > 0) {
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(examples[Object.keys(examples)[0]] || {}, null, 2));
@ -94,14 +90,15 @@ var examples = {};
}
exports.getPetById = function(args, res, next) {
/**
* parameters expected in the args:
* petId (Long)
**/
var examples = {};
* petId (Long)
**/
var examples = {};
examples['application/json'] = {
"tags" : [ {
"id" : 123456789,
@ -117,8 +114,6 @@ var examples = {};
"photoUrls" : [ "aeiou" ]
};
if(Object.keys(examples).length > 0) {
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(examples[Object.keys(examples)[0]] || {}, null, 2));
@ -129,58 +124,46 @@ var examples = {};
}
exports.updatePet = function(args, res, next) {
/**
* parameters expected in the args:
* body (Pet)
**/
// no response value expected for this operation
res.end();
}
exports.updatePetWithForm = function(args, res, next) {
/**
* parameters expected in the args:
* petId (String)
* name (String)
* status (String)
**/
var examples = {};
* petId (Long)
* name (String)
* status (String)
**/
// no response value expected for this operation
res.end();
}
exports.deletePet = function(args, res, next) {
/**
* parameters expected in the args:
* petId (Long)
* apiKey (String)
**/
var examples = {};
res.end();
}
exports.uploadFile = function(args, res, next) {
/**
* parameters expected in the args:
* petId (Long)
* additionalMetadata (String)
* file (file)
**/
var examples = {};
* petId (Long)
* additionalMetadata (String)
* file (file)
**/
res.end();
}
exports.getPetByIdWithByteArray = function(args, res, next) {
/**
* parameters expected in the args:
* petId (Long)
**/
var examples = {};
examples['application/json'] = "";
var examples = {};
examples['application/json'] = {
"message" : "aeiou",
"code" : 123,
"type" : "aeiou"
};
if(Object.keys(examples).length > 0) {
res.setHeader('Content-Type', 'application/json');
@ -192,15 +175,4 @@ var examples = {};
}
exports.addPetUsingByteArray = function(args, res, next) {
/**
* parameters expected in the args:
* body (byte[])
**/
var examples = {};
res.end();
}

View File

@ -6,18 +6,18 @@ var url = require('url');
var Store = require('./StoreService');
module.exports.getInventory = function getInventory (req, res, next) {
Store.getInventory(req.swagger.params, res, next);
module.exports.deleteOrder = function deleteOrder (req, res, next) {
Store.deleteOrder(req.swagger.params, res, next);
};
module.exports.placeOrder = function placeOrder (req, res, next) {
Store.placeOrder(req.swagger.params, res, next);
module.exports.getInventory = function getInventory (req, res, next) {
Store.getInventory(req.swagger.params, res, next);
};
module.exports.getOrderById = function getOrderById (req, res, next) {
Store.getOrderById(req.swagger.params, res, next);
};
module.exports.deleteOrder = function deleteOrder (req, res, next) {
Store.deleteOrder(req.swagger.params, res, next);
module.exports.placeOrder = function placeOrder (req, res, next) {
Store.placeOrder(req.swagger.params, res, next);
};

View File

@ -1,18 +1,27 @@
'use strict';
exports.deleteOrder = function(args, res, next) {
/**
* parameters expected in the args:
* orderId (Long)
**/
// no response value expected for this operation
res.end();
}
exports.getInventory = function(args, res, next) {
/**
* parameters expected in the args:
**/
var examples = {};
**/
var examples = {};
examples['application/json'] = {
"key" : 123
};
if(Object.keys(examples).length > 0) {
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(examples[Object.keys(examples)[0]] || {}, null, 2));
@ -23,54 +32,24 @@ var examples = {};
}
exports.placeOrder = function(args, res, next) {
/**
* parameters expected in the args:
* body (Order)
**/
var examples = {};
examples['application/json'] = {
"id" : 123456789,
"petId" : 123456789,
"complete" : true,
"status" : "aeiou",
"quantity" : 123,
"shipDate" : "2016-01-24T14:07:57.768+0000"
};
if(Object.keys(examples).length > 0) {
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(examples[Object.keys(examples)[0]] || {}, null, 2));
}
else {
res.end();
}
}
exports.getOrderById = function(args, res, next) {
/**
* parameters expected in the args:
* orderId (String)
**/
var examples = {};
* orderId (Long)
**/
var examples = {};
examples['application/json'] = {
"id" : 123456789,
"petId" : 123456789,
"complete" : true,
"status" : "aeiou",
"quantity" : 123,
"shipDate" : "2016-01-24T14:07:57.780+0000"
"shipDate" : "2000-01-23T04:56:07.000+0000"
};
if(Object.keys(examples).length > 0) {
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(examples[Object.keys(examples)[0]] || {}, null, 2));
@ -81,15 +60,32 @@ var examples = {};
}
exports.deleteOrder = function(args, res, next) {
exports.placeOrder = function(args, res, next) {
/**
* parameters expected in the args:
* orderId (String)
**/
var examples = {};
* body (Order)
**/
var examples = {};
examples['application/json'] = {
"id" : 123456789,
"petId" : 123456789,
"complete" : true,
"status" : "aeiou",
"quantity" : 123,
"shipDate" : "2000-01-23T04:56:07.000+0000"
};
if(Object.keys(examples).length > 0) {
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(examples[Object.keys(examples)[0]] || {}, null, 2));
}
else {
res.end();
}
res.end();
}

View File

@ -18,6 +18,14 @@ module.exports.createUsersWithListInput = function createUsersWithListInput (req
User.createUsersWithListInput(req.swagger.params, res, next);
};
module.exports.deleteUser = function deleteUser (req, res, next) {
User.deleteUser(req.swagger.params, res, next);
};
module.exports.getUserByName = function getUserByName (req, res, next) {
User.getUserByName(req.swagger.params, res, next);
};
module.exports.loginUser = function loginUser (req, res, next) {
User.loginUser(req.swagger.params, res, next);
};
@ -26,14 +34,6 @@ module.exports.logoutUser = function logoutUser (req, res, next) {
User.logoutUser(req.swagger.params, res, next);
};
module.exports.getUserByName = function getUserByName (req, res, next) {
User.getUserByName(req.swagger.params, res, next);
};
module.exports.updateUser = function updateUser (req, res, next) {
User.updateUser(req.swagger.params, res, next);
};
module.exports.deleteUser = function deleteUser (req, res, next) {
User.deleteUser(req.swagger.params, res, next);
};

View File

@ -3,126 +3,118 @@
exports.createUser = function(args, res, next) {
/**
* parameters expected in the args:
* body (User)
**/
var examples = {};
* body (User)
**/
// no response value expected for this operation
res.end();
}
exports.createUsersWithArrayInput = function(args, res, next) {
/**
* parameters expected in the args:
* body (List)
**/
var examples = {};
* body (List)
**/
// no response value expected for this operation
res.end();
}
exports.createUsersWithListInput = function(args, res, next) {
/**
* parameters expected in the args:
* body (List)
**/
var examples = {};
* body (List)
**/
// no response value expected for this operation
res.end();
}
exports.loginUser = function(args, res, next) {
/**
* parameters expected in the args:
* username (String)
* password (String)
**/
var examples = {};
examples['application/json'] = "aeiou";
if(Object.keys(examples).length > 0) {
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(examples[Object.keys(examples)[0]] || {}, null, 2));
}
else {
res.end();
}
}
exports.logoutUser = function(args, res, next) {
/**
* parameters expected in the args:
**/
var examples = {};
res.end();
}
exports.getUserByName = function(args, res, next) {
/**
* parameters expected in the args:
* username (String)
**/
var examples = {};
examples['application/json'] = {
"id" : 1,
"username" : "johnp",
"firstName" : "John",
"lastName" : "Public",
"email" : "johnp@swagger.io",
"password" : "-secret-",
"phone" : "0123456789",
"userStatus" : 0
};
if(Object.keys(examples).length > 0) {
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(examples[Object.keys(examples)[0]] || {}, null, 2));
}
else {
res.end();
}
}
exports.updateUser = function(args, res, next) {
/**
* parameters expected in the args:
* username (String)
* body (User)
**/
var examples = {};
res.end();
}
exports.deleteUser = function(args, res, next) {
/**
* parameters expected in the args:
* username (String)
**/
var examples = {};
* username (String)
**/
// no response value expected for this operation
res.end();
}
exports.getUserByName = function(args, res, next) {
/**
* parameters expected in the args:
* username (String)
**/
var examples = {};
examples['application/json'] = {
"id" : 123456789,
"lastName" : "aeiou",
"phone" : "aeiou",
"username" : "aeiou",
"email" : "aeiou",
"userStatus" : 123,
"firstName" : "aeiou",
"password" : "aeiou"
};
if(Object.keys(examples).length > 0) {
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(examples[Object.keys(examples)[0]] || {}, null, 2));
}
else {
res.end();
}
}
exports.loginUser = function(args, res, next) {
/**
* parameters expected in the args:
* username (String)
* password (String)
**/
var examples = {};
examples['application/json'] = "aeiou";
if(Object.keys(examples).length > 0) {
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(examples[Object.keys(examples)[0]] || {}, null, 2));
}
else {
res.end();
}
}
exports.logoutUser = function(args, res, next) {
/**
* parameters expected in the args:
**/
// no response value expected for this operation
res.end();
}
exports.updateUser = function(args, res, next) {
/**
* parameters expected in the args:
* username (String)
* body (User)
**/
// no response value expected for this operation
res.end();
}

View File

@ -1,7 +1,7 @@
{
"name": "swagger-petstore",
"version": "1.0.0",
"description": "This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters",
"description": "This is a sample server Petstore server. You can find out more about\nSwagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/).\nFor this sample, you can use the api key `special-key` to test the authorization filters.\n",
"main": "index.js",
"keywords": [
"swagger"