forked from loafle/openapi-generator-original
Merge pull request #2612 from wing328/server_use_petstore_yaml
Update server generator to use swagger.yaml instead of swagger.json
This commit is contained in:
commit
907664fb6e
@ -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 -l aspnet5 -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -o samples/server/petstore/aspnet5"
|
||||
ags="$@ generate -l aspnet5 -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -o samples/server/petstore/aspnet5"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
@ -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 python-flask -o samples/server/petstore/flaskConnexion "
|
||||
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l python-flask -o samples/server/petstore/flaskConnexion "
|
||||
|
||||
java $JAVA_OPTS -Dservice -jar $executable $ags
|
||||
|
@ -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/JavaInflector -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l inflector -o samples/server/petstore/java-inflector"
|
||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaInflector -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l inflector -o samples/server/petstore/java-inflector"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
@ -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/scalatra -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l scalatra -o samples/server/petstore/scalatra"
|
||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/scalatra -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l scalatra -o samples/server/petstore/scalatra"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
@ -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/silex -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l silex-PHP -o samples/server/petstore/silex"
|
||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/silex -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l silex-PHP -o samples/server/petstore/silex"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
@ -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/slim -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l slim -o samples/server/petstore/slim"
|
||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/slim -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l slim -o samples/server/petstore/slim"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
@ -19,23 +19,6 @@ namespace IO.Swagger.Controllers
|
||||
public class PetApiController : Controller
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Update an existing pet
|
||||
/// </summary>
|
||||
/// <remarks></remarks>
|
||||
/// <param name="body">Pet object that needs to be added to the store</param>
|
||||
/// <response code="400">Invalid ID supplied</response>
|
||||
/// <response code="404">Pet not found</response>
|
||||
/// <response code="405">Validation exception</response>
|
||||
[HttpPut]
|
||||
[Route("/pet")]
|
||||
[SwaggerOperation("UpdatePet")]
|
||||
public void UpdatePet([FromBody]Pet body)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Add a new pet to the store
|
||||
/// </summary>
|
||||
@ -51,93 +34,6 @@ namespace IO.Swagger.Controllers
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Finds Pets by status
|
||||
/// </summary>
|
||||
/// <remarks>Multiple status values can be provided with comma seperated strings</remarks>
|
||||
/// <param name="status">Status values that need to be considered for filter</param>
|
||||
/// <response code="200">successful operation</response>
|
||||
/// <response code="400">Invalid status value</response>
|
||||
[HttpGet]
|
||||
[Route("/pet/findByStatus")]
|
||||
[SwaggerOperation("FindPetsByStatus")]
|
||||
[SwaggerResponse(200, type: typeof(List<Pet>))]
|
||||
public IActionResult FindPetsByStatus([FromQuery]List<string> status)
|
||||
{
|
||||
string exampleJson = null;
|
||||
|
||||
var example = exampleJson != null
|
||||
? JsonConvert.DeserializeObject<List<Pet>>(exampleJson)
|
||||
: default(List<Pet>);
|
||||
|
||||
return new ObjectResult(example);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Finds Pets by tags
|
||||
/// </summary>
|
||||
/// <remarks>Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.</remarks>
|
||||
/// <param name="tags">Tags to filter by</param>
|
||||
/// <response code="200">successful operation</response>
|
||||
/// <response code="400">Invalid tag value</response>
|
||||
[HttpGet]
|
||||
[Route("/pet/findByTags")]
|
||||
[SwaggerOperation("FindPetsByTags")]
|
||||
[SwaggerResponse(200, type: typeof(List<Pet>))]
|
||||
public IActionResult FindPetsByTags([FromQuery]List<string> tags)
|
||||
{
|
||||
string exampleJson = null;
|
||||
|
||||
var example = exampleJson != null
|
||||
? JsonConvert.DeserializeObject<List<Pet>>(exampleJson)
|
||||
: default(List<Pet>);
|
||||
|
||||
return new ObjectResult(example);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Find pet by ID
|
||||
/// </summary>
|
||||
/// <remarks>Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions</remarks>
|
||||
/// <param name="petId">ID of pet that needs to be fetched</param>
|
||||
/// <response code="200">successful operation</response>
|
||||
/// <response code="400">Invalid ID supplied</response>
|
||||
/// <response code="404">Pet not found</response>
|
||||
[HttpGet]
|
||||
[Route("/pet/{petId}")]
|
||||
[SwaggerOperation("GetPetById")]
|
||||
[SwaggerResponse(200, type: typeof(Pet))]
|
||||
public IActionResult GetPetById([FromRoute]long? petId)
|
||||
{
|
||||
string exampleJson = null;
|
||||
|
||||
var example = exampleJson != null
|
||||
? JsonConvert.DeserializeObject<Pet>(exampleJson)
|
||||
: default(Pet);
|
||||
|
||||
return new ObjectResult(example);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Updates a pet in the store with form data
|
||||
/// </summary>
|
||||
/// <remarks></remarks>
|
||||
/// <param name="petId">ID of pet that needs to be updated</param>
|
||||
/// <param name="name">Updated name of the pet</param>
|
||||
/// <param name="status">Updated status of the pet</param>
|
||||
/// <response code="405">Invalid input</response>
|
||||
[HttpPost]
|
||||
[Route("/pet/{petId}")]
|
||||
[SwaggerOperation("UpdatePetWithForm")]
|
||||
public void UpdatePetWithForm([FromRoute]string petId, [FromForm]string name, [FromForm]string status)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a pet
|
||||
/// </summary>
|
||||
@ -154,6 +50,107 @@ namespace IO.Swagger.Controllers
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Finds Pets by status
|
||||
/// </summary>
|
||||
/// <remarks>Multiple status values can be provided with comma separated strings</remarks>
|
||||
/// <param name="status">Status values that need to be considered for filter</param>
|
||||
/// <response code="200">successful operation</response>
|
||||
/// <response code="400">Invalid status value</response>
|
||||
[HttpGet]
|
||||
[Route("/pet/findByStatus")]
|
||||
[SwaggerOperation("FindPetsByStatus")]
|
||||
[SwaggerResponse(200, type: typeof(List<Pet>))]
|
||||
public IActionResult FindPetsByStatus([FromQuery]List<string> status)
|
||||
{
|
||||
string exampleJson = null;
|
||||
|
||||
var example = exampleJson != null
|
||||
? JsonConvert.DeserializeObject<List<Pet>>(exampleJson)
|
||||
: default(List<Pet>);
|
||||
return new ObjectResult(example);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Finds Pets by tags
|
||||
/// </summary>
|
||||
/// <remarks>Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.</remarks>
|
||||
/// <param name="tags">Tags to filter by</param>
|
||||
/// <response code="200">successful operation</response>
|
||||
/// <response code="400">Invalid tag value</response>
|
||||
[HttpGet]
|
||||
[Route("/pet/findByTags")]
|
||||
[SwaggerOperation("FindPetsByTags")]
|
||||
[SwaggerResponse(200, type: typeof(List<Pet>))]
|
||||
public IActionResult FindPetsByTags([FromQuery]List<string> tags)
|
||||
{
|
||||
string exampleJson = null;
|
||||
|
||||
var example = exampleJson != null
|
||||
? JsonConvert.DeserializeObject<List<Pet>>(exampleJson)
|
||||
: default(List<Pet>);
|
||||
return new ObjectResult(example);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Find pet by ID
|
||||
/// </summary>
|
||||
/// <remarks>Returns a single pet</remarks>
|
||||
/// <param name="petId">ID of pet to return</param>
|
||||
/// <response code="200">successful operation</response>
|
||||
/// <response code="400">Invalid ID supplied</response>
|
||||
/// <response code="404">Pet not found</response>
|
||||
[HttpGet]
|
||||
[Route("/pet/{petId}")]
|
||||
[SwaggerOperation("GetPetById")]
|
||||
[SwaggerResponse(200, type: typeof(Pet))]
|
||||
public IActionResult GetPetById([FromRoute]long? petId)
|
||||
{
|
||||
string exampleJson = null;
|
||||
|
||||
var example = exampleJson != null
|
||||
? JsonConvert.DeserializeObject<Pet>(exampleJson)
|
||||
: default(Pet);
|
||||
return new ObjectResult(example);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Update an existing pet
|
||||
/// </summary>
|
||||
/// <remarks></remarks>
|
||||
/// <param name="body">Pet object that needs to be added to the store</param>
|
||||
/// <response code="400">Invalid ID supplied</response>
|
||||
/// <response code="404">Pet not found</response>
|
||||
/// <response code="405">Validation exception</response>
|
||||
[HttpPut]
|
||||
[Route("/pet")]
|
||||
[SwaggerOperation("UpdatePet")]
|
||||
public void UpdatePet([FromBody]Pet body)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Updates a pet in the store with form data
|
||||
/// </summary>
|
||||
/// <remarks></remarks>
|
||||
/// <param name="petId">ID of pet that needs to be updated</param>
|
||||
/// <param name="name">Updated name of the pet</param>
|
||||
/// <param name="status">Updated status of the pet</param>
|
||||
/// <response code="405">Invalid input</response>
|
||||
[HttpPost]
|
||||
[Route("/pet/{petId}")]
|
||||
[SwaggerOperation("UpdatePetWithForm")]
|
||||
public void UpdatePetWithForm([FromRoute]long? petId, [FromForm]string name, [FromForm]string status)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// uploads an image
|
||||
/// </summary>
|
||||
@ -161,52 +158,19 @@ namespace IO.Swagger.Controllers
|
||||
/// <param name="petId">ID of pet to update</param>
|
||||
/// <param name="additionalMetadata">Additional data to pass to server</param>
|
||||
/// <param name="file">file to upload</param>
|
||||
/// <response code="0">successful operation</response>
|
||||
/// <response code="200">successful operation</response>
|
||||
[HttpPost]
|
||||
[Route("/pet/{petId}/uploadImage")]
|
||||
[SwaggerOperation("UploadFile")]
|
||||
public void UploadFile([FromRoute]long? petId, [FromForm]string additionalMetadata, [FromForm]Stream file)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Fake endpoint to test byte array return by 'Find pet by ID'
|
||||
/// </summary>
|
||||
/// <remarks>Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions</remarks>
|
||||
/// <param name="petId">ID of pet that needs to be fetched</param>
|
||||
/// <response code="200">successful operation</response>
|
||||
/// <response code="400">Invalid ID supplied</response>
|
||||
/// <response code="404">Pet not found</response>
|
||||
[HttpGet]
|
||||
[Route("/pet/{petId}/testing_byte_array=true")]
|
||||
[SwaggerOperation("GetPetByIdWithByteArray")]
|
||||
[SwaggerResponse(200, type: typeof(byte[]))]
|
||||
public IActionResult GetPetByIdWithByteArray([FromRoute]long? petId)
|
||||
[SwaggerResponse(200, type: typeof(ApiResponse))]
|
||||
public IActionResult UploadFile([FromRoute]long? petId, [FromForm]string additionalMetadata, [FromForm]System.IO.Stream file)
|
||||
{
|
||||
string exampleJson = null;
|
||||
|
||||
var example = exampleJson != null
|
||||
? JsonConvert.DeserializeObject<byte[]>(exampleJson)
|
||||
: default(byte[]);
|
||||
|
||||
? JsonConvert.DeserializeObject<ApiResponse>(exampleJson)
|
||||
: default(ApiResponse);
|
||||
return new ObjectResult(example);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Fake endpoint to test byte array in body parameter for adding a new pet to the store
|
||||
/// </summary>
|
||||
/// <remarks></remarks>
|
||||
/// <param name="body">Pet object in the form of byte array</param>
|
||||
/// <response code="405">Invalid input</response>
|
||||
[HttpPost]
|
||||
[Route("/pet/testing_byte_array=true")]
|
||||
[SwaggerOperation("AddPetUsingByteArray")]
|
||||
public void AddPetUsingByteArray([FromBody]byte[] body)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,22 @@ namespace IO.Swagger.Controllers
|
||||
public class StoreApiController : Controller
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Delete purchase order by ID
|
||||
/// </summary>
|
||||
/// <remarks>For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors</remarks>
|
||||
/// <param name="orderId">ID of the order that needs to be deleted</param>
|
||||
/// <response code="400">Invalid ID supplied</response>
|
||||
/// <response code="404">Order not found</response>
|
||||
[HttpDelete]
|
||||
[Route("/store/order/{orderId}")]
|
||||
[SwaggerOperation("DeleteOrder")]
|
||||
public void DeleteOrder([FromRoute]string orderId)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns pet inventories by status
|
||||
/// </summary>
|
||||
@ -35,7 +51,29 @@ namespace IO.Swagger.Controllers
|
||||
var example = exampleJson != null
|
||||
? JsonConvert.DeserializeObject<Dictionary<string, int?>>(exampleJson)
|
||||
: default(Dictionary<string, int?>);
|
||||
return new ObjectResult(example);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Find purchase order by ID
|
||||
/// </summary>
|
||||
/// <remarks>For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions</remarks>
|
||||
/// <param name="orderId">ID of pet that needs to be fetched</param>
|
||||
/// <response code="200">successful operation</response>
|
||||
/// <response code="400">Invalid ID supplied</response>
|
||||
/// <response code="404">Order not found</response>
|
||||
[HttpGet]
|
||||
[Route("/store/order/{orderId}")]
|
||||
[SwaggerOperation("GetOrderById")]
|
||||
[SwaggerResponse(200, type: typeof(Order))]
|
||||
public IActionResult GetOrderById([FromRoute]long? orderId)
|
||||
{
|
||||
string exampleJson = null;
|
||||
|
||||
var example = exampleJson != null
|
||||
? JsonConvert.DeserializeObject<Order>(exampleJson)
|
||||
: default(Order);
|
||||
return new ObjectResult(example);
|
||||
}
|
||||
|
||||
@ -58,48 +96,7 @@ namespace IO.Swagger.Controllers
|
||||
var example = exampleJson != null
|
||||
? JsonConvert.DeserializeObject<Order>(exampleJson)
|
||||
: default(Order);
|
||||
|
||||
return new ObjectResult(example);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Find purchase order by ID
|
||||
/// </summary>
|
||||
/// <remarks>For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions</remarks>
|
||||
/// <param name="orderId">ID of pet that needs to be fetched</param>
|
||||
/// <response code="200">successful operation</response>
|
||||
/// <response code="400">Invalid ID supplied</response>
|
||||
/// <response code="404">Order not found</response>
|
||||
[HttpGet]
|
||||
[Route("/store/order/{orderId}")]
|
||||
[SwaggerOperation("GetOrderById")]
|
||||
[SwaggerResponse(200, type: typeof(Order))]
|
||||
public IActionResult GetOrderById([FromRoute]string orderId)
|
||||
{
|
||||
string exampleJson = null;
|
||||
|
||||
var example = exampleJson != null
|
||||
? JsonConvert.DeserializeObject<Order>(exampleJson)
|
||||
: default(Order);
|
||||
|
||||
return new ObjectResult(example);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Delete purchase order by ID
|
||||
/// </summary>
|
||||
/// <remarks>For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors</remarks>
|
||||
/// <param name="orderId">ID of the order that needs to be deleted</param>
|
||||
/// <response code="400">Invalid ID supplied</response>
|
||||
/// <response code="404">Order not found</response>
|
||||
[HttpDelete]
|
||||
[Route("/store/order/{orderId}")]
|
||||
[SwaggerOperation("DeleteOrder")]
|
||||
public void DeleteOrder([FromRoute]string orderId)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -64,6 +64,45 @@ namespace IO.Swagger.Controllers
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Delete user
|
||||
/// </summary>
|
||||
/// <remarks>This can only be done by the logged in user.</remarks>
|
||||
/// <param name="username">The name that needs to be deleted</param>
|
||||
/// <response code="400">Invalid username supplied</response>
|
||||
/// <response code="404">User not found</response>
|
||||
[HttpDelete]
|
||||
[Route("/user/{username}")]
|
||||
[SwaggerOperation("DeleteUser")]
|
||||
public void DeleteUser([FromRoute]string username)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get user by user name
|
||||
/// </summary>
|
||||
/// <remarks></remarks>
|
||||
/// <param name="username">The name that needs to be fetched. Use user1 for testing. </param>
|
||||
/// <response code="200">successful operation</response>
|
||||
/// <response code="400">Invalid username supplied</response>
|
||||
/// <response code="404">User not found</response>
|
||||
[HttpGet]
|
||||
[Route("/user/{username}")]
|
||||
[SwaggerOperation("GetUserByName")]
|
||||
[SwaggerResponse(200, type: typeof(User))]
|
||||
public IActionResult GetUserByName([FromRoute]string username)
|
||||
{
|
||||
string exampleJson = null;
|
||||
|
||||
var example = exampleJson != null
|
||||
? JsonConvert.DeserializeObject<User>(exampleJson)
|
||||
: default(User);
|
||||
return new ObjectResult(example);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Logs user into the system
|
||||
/// </summary>
|
||||
@ -83,7 +122,6 @@ namespace IO.Swagger.Controllers
|
||||
var example = exampleJson != null
|
||||
? JsonConvert.DeserializeObject<string>(exampleJson)
|
||||
: default(string);
|
||||
|
||||
return new ObjectResult(example);
|
||||
}
|
||||
|
||||
@ -102,30 +140,6 @@ namespace IO.Swagger.Controllers
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get user by user name
|
||||
/// </summary>
|
||||
/// <remarks></remarks>
|
||||
/// <param name="username">The name that needs to be fetched. Use user1 for testing.</param>
|
||||
/// <response code="200">successful operation</response>
|
||||
/// <response code="400">Invalid username supplied</response>
|
||||
/// <response code="404">User not found</response>
|
||||
[HttpGet]
|
||||
[Route("/user/{username}")]
|
||||
[SwaggerOperation("GetUserByName")]
|
||||
[SwaggerResponse(200, type: typeof(User))]
|
||||
public IActionResult GetUserByName([FromRoute]string username)
|
||||
{
|
||||
string exampleJson = null;
|
||||
|
||||
var example = exampleJson != null
|
||||
? JsonConvert.DeserializeObject<User>(exampleJson)
|
||||
: default(User);
|
||||
|
||||
return new ObjectResult(example);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Updated user
|
||||
/// </summary>
|
||||
@ -141,21 +155,5 @@ namespace IO.Swagger.Controllers
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Delete user
|
||||
/// </summary>
|
||||
/// <remarks>This can only be done by the logged in user.</remarks>
|
||||
/// <param name="username">The name that needs to be deleted</param>
|
||||
/// <response code="400">Invalid username supplied</response>
|
||||
/// <response code="404">User not found</response>
|
||||
[HttpDelete]
|
||||
[Route("/user/{username}")]
|
||||
[SwaggerOperation("DeleteUser")]
|
||||
public void DeleteUser([FromRoute]string username)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,20 +27,17 @@ namespace IO.Swagger.Models
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Id
|
||||
/// </summary>
|
||||
public long? Id { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Name
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
@ -50,8 +47,7 @@ namespace IO.Swagger.Models
|
||||
var sb = new StringBuilder();
|
||||
sb.Append("class Category {\n");
|
||||
sb.Append(" Id: ").Append(Id).Append("\n");
|
||||
sb.Append(" Name: ").Append(Name).Append("\n");
|
||||
|
||||
sb.Append(" Name: ").Append(Name).Append("\n");
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
@ -113,13 +109,10 @@ namespace IO.Swagger.Models
|
||||
{
|
||||
int hash = 41;
|
||||
// Suitable nullity checks etc, of course :)
|
||||
|
||||
if (this.Id != null)
|
||||
hash = hash * 59 + this.Id.GetHashCode();
|
||||
|
||||
if (this.Name != null)
|
||||
hash = hash * 59 + this.Name.GetHashCode();
|
||||
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ namespace IO.Swagger.Models
|
||||
/// <param name="Quantity">Quantity.</param>
|
||||
/// <param name="ShipDate">ShipDate.</param>
|
||||
/// <param name="Status">Order Status.</param>
|
||||
/// <param name="Complete">Complete.</param>
|
||||
/// <param name="Complete">Complete (default to false).</param>
|
||||
public Order(long? Id = null, long? PetId = null, int? Quantity = null, DateTime? ShipDate = null, string Status = null, bool? Complete = null)
|
||||
{
|
||||
this.Id = Id;
|
||||
@ -31,49 +31,50 @@ namespace IO.Swagger.Models
|
||||
this.Quantity = Quantity;
|
||||
this.ShipDate = ShipDate;
|
||||
this.Status = Status;
|
||||
this.Complete = Complete;
|
||||
// use default value if no "Complete" provided
|
||||
if (Complete == null)
|
||||
{
|
||||
this.Complete = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Complete = Complete;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Id
|
||||
/// </summary>
|
||||
public long? Id { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets PetId
|
||||
/// </summary>
|
||||
public long? PetId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Quantity
|
||||
/// </summary>
|
||||
public int? Quantity { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets ShipDate
|
||||
/// </summary>
|
||||
public DateTime? ShipDate { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Order Status
|
||||
/// </summary>
|
||||
/// <value>Order Status</value>
|
||||
public string Status { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Complete
|
||||
/// </summary>
|
||||
public bool? Complete { get; set; }
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
@ -83,12 +84,11 @@ namespace IO.Swagger.Models
|
||||
var sb = new StringBuilder();
|
||||
sb.Append("class Order {\n");
|
||||
sb.Append(" Id: ").Append(Id).Append("\n");
|
||||
sb.Append(" PetId: ").Append(PetId).Append("\n");
|
||||
sb.Append(" Quantity: ").Append(Quantity).Append("\n");
|
||||
sb.Append(" ShipDate: ").Append(ShipDate).Append("\n");
|
||||
sb.Append(" Status: ").Append(Status).Append("\n");
|
||||
sb.Append(" Complete: ").Append(Complete).Append("\n");
|
||||
|
||||
sb.Append(" PetId: ").Append(PetId).Append("\n");
|
||||
sb.Append(" Quantity: ").Append(Quantity).Append("\n");
|
||||
sb.Append(" ShipDate: ").Append(ShipDate).Append("\n");
|
||||
sb.Append(" Status: ").Append(Status).Append("\n");
|
||||
sb.Append(" Complete: ").Append(Complete).Append("\n");
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
@ -170,25 +170,18 @@ namespace IO.Swagger.Models
|
||||
{
|
||||
int hash = 41;
|
||||
// Suitable nullity checks etc, of course :)
|
||||
|
||||
if (this.Id != null)
|
||||
hash = hash * 59 + this.Id.GetHashCode();
|
||||
|
||||
if (this.PetId != null)
|
||||
hash = hash * 59 + this.PetId.GetHashCode();
|
||||
|
||||
if (this.Quantity != null)
|
||||
hash = hash * 59 + this.Quantity.GetHashCode();
|
||||
|
||||
if (this.ShipDate != null)
|
||||
hash = hash * 59 + this.ShipDate.GetHashCode();
|
||||
|
||||
if (this.Status != null)
|
||||
hash = hash * 59 + this.Status.GetHashCode();
|
||||
|
||||
if (this.Complete != null)
|
||||
hash = hash * 59 + this.Complete.GetHashCode();
|
||||
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
|
@ -51,37 +51,31 @@ namespace IO.Swagger.Models
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Id
|
||||
/// </summary>
|
||||
public long? Id { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Category
|
||||
/// </summary>
|
||||
public Category Category { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Name
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets PhotoUrls
|
||||
/// </summary>
|
||||
public List<string> PhotoUrls { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Tags
|
||||
/// </summary>
|
||||
public List<Tag> Tags { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// pet status in the store
|
||||
/// </summary>
|
||||
@ -89,7 +83,6 @@ namespace IO.Swagger.Models
|
||||
public string Status { get; set; }
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
@ -99,12 +92,11 @@ namespace IO.Swagger.Models
|
||||
var sb = new StringBuilder();
|
||||
sb.Append("class Pet {\n");
|
||||
sb.Append(" Id: ").Append(Id).Append("\n");
|
||||
sb.Append(" Category: ").Append(Category).Append("\n");
|
||||
sb.Append(" Name: ").Append(Name).Append("\n");
|
||||
sb.Append(" PhotoUrls: ").Append(PhotoUrls).Append("\n");
|
||||
sb.Append(" Tags: ").Append(Tags).Append("\n");
|
||||
sb.Append(" Status: ").Append(Status).Append("\n");
|
||||
|
||||
sb.Append(" Category: ").Append(Category).Append("\n");
|
||||
sb.Append(" Name: ").Append(Name).Append("\n");
|
||||
sb.Append(" PhotoUrls: ").Append(PhotoUrls).Append("\n");
|
||||
sb.Append(" Tags: ").Append(Tags).Append("\n");
|
||||
sb.Append(" Status: ").Append(Status).Append("\n");
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
@ -186,25 +178,18 @@ namespace IO.Swagger.Models
|
||||
{
|
||||
int hash = 41;
|
||||
// Suitable nullity checks etc, of course :)
|
||||
|
||||
if (this.Id != null)
|
||||
hash = hash * 59 + this.Id.GetHashCode();
|
||||
|
||||
if (this.Category != null)
|
||||
hash = hash * 59 + this.Category.GetHashCode();
|
||||
|
||||
if (this.Name != null)
|
||||
hash = hash * 59 + this.Name.GetHashCode();
|
||||
|
||||
if (this.PhotoUrls != null)
|
||||
hash = hash * 59 + this.PhotoUrls.GetHashCode();
|
||||
|
||||
if (this.Tags != null)
|
||||
hash = hash * 59 + this.Tags.GetHashCode();
|
||||
|
||||
if (this.Status != null)
|
||||
hash = hash * 59 + this.Status.GetHashCode();
|
||||
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
|
@ -27,20 +27,17 @@ namespace IO.Swagger.Models
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Id
|
||||
/// </summary>
|
||||
public long? Id { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Name
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
@ -50,8 +47,7 @@ namespace IO.Swagger.Models
|
||||
var sb = new StringBuilder();
|
||||
sb.Append("class Tag {\n");
|
||||
sb.Append(" Id: ").Append(Id).Append("\n");
|
||||
sb.Append(" Name: ").Append(Name).Append("\n");
|
||||
|
||||
sb.Append(" Name: ").Append(Name).Append("\n");
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
@ -113,13 +109,10 @@ namespace IO.Swagger.Models
|
||||
{
|
||||
int hash = 41;
|
||||
// Suitable nullity checks etc, of course :)
|
||||
|
||||
if (this.Id != null)
|
||||
hash = hash * 59 + this.Id.GetHashCode();
|
||||
|
||||
if (this.Name != null)
|
||||
hash = hash * 59 + this.Name.GetHashCode();
|
||||
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
|
@ -39,49 +39,41 @@ namespace IO.Swagger.Models
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Id
|
||||
/// </summary>
|
||||
public long? Id { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Username
|
||||
/// </summary>
|
||||
public string Username { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets FirstName
|
||||
/// </summary>
|
||||
public string FirstName { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets LastName
|
||||
/// </summary>
|
||||
public string LastName { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Email
|
||||
/// </summary>
|
||||
public string Email { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Password
|
||||
/// </summary>
|
||||
public string Password { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Phone
|
||||
/// </summary>
|
||||
public string Phone { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// User Status
|
||||
/// </summary>
|
||||
@ -89,7 +81,6 @@ namespace IO.Swagger.Models
|
||||
public int? UserStatus { get; set; }
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
@ -99,14 +90,13 @@ namespace IO.Swagger.Models
|
||||
var sb = new StringBuilder();
|
||||
sb.Append("class User {\n");
|
||||
sb.Append(" Id: ").Append(Id).Append("\n");
|
||||
sb.Append(" Username: ").Append(Username).Append("\n");
|
||||
sb.Append(" FirstName: ").Append(FirstName).Append("\n");
|
||||
sb.Append(" LastName: ").Append(LastName).Append("\n");
|
||||
sb.Append(" Email: ").Append(Email).Append("\n");
|
||||
sb.Append(" Password: ").Append(Password).Append("\n");
|
||||
sb.Append(" Phone: ").Append(Phone).Append("\n");
|
||||
sb.Append(" UserStatus: ").Append(UserStatus).Append("\n");
|
||||
|
||||
sb.Append(" Username: ").Append(Username).Append("\n");
|
||||
sb.Append(" FirstName: ").Append(FirstName).Append("\n");
|
||||
sb.Append(" LastName: ").Append(LastName).Append("\n");
|
||||
sb.Append(" Email: ").Append(Email).Append("\n");
|
||||
sb.Append(" Password: ").Append(Password).Append("\n");
|
||||
sb.Append(" Phone: ").Append(Phone).Append("\n");
|
||||
sb.Append(" UserStatus: ").Append(UserStatus).Append("\n");
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
@ -198,31 +188,22 @@ namespace IO.Swagger.Models
|
||||
{
|
||||
int hash = 41;
|
||||
// Suitable nullity checks etc, of course :)
|
||||
|
||||
if (this.Id != null)
|
||||
hash = hash * 59 + this.Id.GetHashCode();
|
||||
|
||||
if (this.Username != null)
|
||||
hash = hash * 59 + this.Username.GetHashCode();
|
||||
|
||||
if (this.FirstName != null)
|
||||
hash = hash * 59 + this.FirstName.GetHashCode();
|
||||
|
||||
if (this.LastName != null)
|
||||
hash = hash * 59 + this.LastName.GetHashCode();
|
||||
|
||||
if (this.Email != null)
|
||||
hash = hash * 59 + this.Email.GetHashCode();
|
||||
|
||||
if (this.Password != null)
|
||||
hash = hash * 59 + this.Password.GetHashCode();
|
||||
|
||||
if (this.Phone != null)
|
||||
hash = hash * 59 + this.Phone.GetHashCode();
|
||||
|
||||
if (this.UserStatus != null)
|
||||
hash = hash * 59 + this.UserStatus.GetHashCode();
|
||||
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
|
@ -4,5 +4,5 @@ import connexion
|
||||
|
||||
if __name__ == '__main__':
|
||||
app = connexion.App(__name__, specification_dir='./swagger/')
|
||||
app.add_api('swagger.yaml', arguments={'title': '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'})
|
||||
app.add_api('swagger.yaml', arguments={'title': 'This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.'})
|
||||
app.run(port=8080)
|
||||
|
@ -1,29 +1,20 @@
|
||||
|
||||
def add_pet(body = None) -> str:
|
||||
return 'do some magic!'
|
||||
|
||||
def add_pet_using_byte_array(body = None) -> str:
|
||||
def add_pet(body) -> str:
|
||||
return 'do some magic!'
|
||||
|
||||
def delete_pet(petId, apiKey = None) -> str:
|
||||
return 'do some magic!'
|
||||
|
||||
def find_pets_by_status(status = None) -> str:
|
||||
def find_pets_by_status(status) -> str:
|
||||
return 'do some magic!'
|
||||
|
||||
def find_pets_by_tags(tags = None) -> str:
|
||||
def find_pets_by_tags(tags) -> str:
|
||||
return 'do some magic!'
|
||||
|
||||
def get_pet_by_id(petId) -> str:
|
||||
return 'do some magic!'
|
||||
|
||||
def get_pet_by_id_in_object(petId) -> str:
|
||||
return 'do some magic!'
|
||||
|
||||
def pet_pet_idtesting_byte_arraytrue_get(petId) -> str:
|
||||
return 'do some magic!'
|
||||
|
||||
def update_pet(body = None) -> str:
|
||||
def update_pet(body) -> str:
|
||||
return 'do some magic!'
|
||||
|
||||
def update_pet_with_form(petId, name = None, status = None) -> str:
|
||||
@ -35,28 +26,22 @@ def upload_file(petId, additionalMetadata = None, file = None) -> str:
|
||||
def delete_order(orderId) -> str:
|
||||
return 'do some magic!'
|
||||
|
||||
def find_orders_by_status(status = None) -> str:
|
||||
return 'do some magic!'
|
||||
|
||||
def get_inventory() -> str:
|
||||
return 'do some magic!'
|
||||
|
||||
def get_inventory_in_object() -> str:
|
||||
return 'do some magic!'
|
||||
|
||||
def get_order_by_id(orderId) -> str:
|
||||
return 'do some magic!'
|
||||
|
||||
def place_order(body = None) -> str:
|
||||
def place_order(body) -> str:
|
||||
return 'do some magic!'
|
||||
|
||||
def create_user(body = None) -> str:
|
||||
def create_user(body) -> str:
|
||||
return 'do some magic!'
|
||||
|
||||
def create_users_with_array_input(body = None) -> str:
|
||||
def create_users_with_array_input(body) -> str:
|
||||
return 'do some magic!'
|
||||
|
||||
def create_users_with_list_input(body = None) -> str:
|
||||
def create_users_with_list_input(body) -> str:
|
||||
return 'do some magic!'
|
||||
|
||||
def delete_user(username) -> str:
|
||||
@ -65,11 +50,11 @@ def delete_user(username) -> str:
|
||||
def get_user_by_name(username) -> str:
|
||||
return 'do some magic!'
|
||||
|
||||
def login_user(username = None, password = None) -> str:
|
||||
def login_user(username, password) -> str:
|
||||
return 'do some magic!'
|
||||
|
||||
def logout_user() -> str:
|
||||
return 'do some magic!'
|
||||
|
||||
def update_user(username, body = None) -> str:
|
||||
def update_user(username, body) -> str:
|
||||
return 'do some magic!'
|
||||
|
@ -2,9 +2,9 @@
|
||||
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"
|
||||
\ Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/).\
|
||||
\ 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/"
|
||||
@ -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:
|
||||
@ -29,13 +42,13 @@ paths:
|
||||
- "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:
|
||||
@ -57,13 +70,13 @@ paths:
|
||||
- "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:
|
||||
@ -87,26 +100,22 @@ paths:
|
||||
description: "Multiple status values can be provided with comma separated strings"
|
||||
operationId: "controllers.default_controller.find_pets_by_status"
|
||||
produces:
|
||||
- "application/json"
|
||||
- "application/xml"
|
||||
- "application/json"
|
||||
parameters:
|
||||
- name: "status"
|
||||
in: "query"
|
||||
description: "Status values that need to be considered for query"
|
||||
required: false
|
||||
description: "Status values that need to be considered for filter"
|
||||
required: true
|
||||
type: "array"
|
||||
items:
|
||||
type: "string"
|
||||
default: "available"
|
||||
enum:
|
||||
- "available"
|
||||
- "pending"
|
||||
- "sold"
|
||||
collectionFormat: "multi"
|
||||
default: "available"
|
||||
enum:
|
||||
- "available"
|
||||
- "pending"
|
||||
- "sold"
|
||||
collectionFormat: "csv"
|
||||
responses:
|
||||
200:
|
||||
description: "successful operation"
|
||||
@ -127,21 +136,21 @@ paths:
|
||||
tags:
|
||||
- "pet"
|
||||
summary: "Finds Pets by tags"
|
||||
description: "Muliple tags can be provided with comma seperated strings. Use\
|
||||
description: "Multiple tags can be provided with comma separated strings. Use\
|
||||
\ tag1, tag2, tag3 for testing."
|
||||
operationId: "controllers.default_controller.find_pets_by_tags"
|
||||
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"
|
||||
collectionFormat: "multi"
|
||||
collectionFormat: "csv"
|
||||
responses:
|
||||
200:
|
||||
description: "successful operation"
|
||||
@ -162,16 +171,15 @@ paths:
|
||||
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: "controllers.default_controller.get_pet_by_id"
|
||||
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"
|
||||
@ -186,9 +194,6 @@ paths:
|
||||
description: "Pet not found"
|
||||
security:
|
||||
- api_key: []
|
||||
- petstore_auth:
|
||||
- "write:pets"
|
||||
- "read:pets"
|
||||
x-tags:
|
||||
- tag: "pet"
|
||||
post:
|
||||
@ -200,14 +205,15 @@ paths:
|
||||
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"
|
||||
@ -234,12 +240,11 @@ paths:
|
||||
description: ""
|
||||
operationId: "controllers.default_controller.delete_pet"
|
||||
produces:
|
||||
- "application/json"
|
||||
- "application/xml"
|
||||
- "application/json"
|
||||
parameters:
|
||||
- name: "api_key"
|
||||
in: "header"
|
||||
description: ""
|
||||
required: false
|
||||
type: "string"
|
||||
- name: "petId"
|
||||
@ -268,7 +273,6 @@ paths:
|
||||
- "multipart/form-data"
|
||||
produces:
|
||||
- "application/json"
|
||||
- "application/xml"
|
||||
parameters:
|
||||
- name: "petId"
|
||||
in: "path"
|
||||
@ -286,151 +290,17 @@ paths:
|
||||
description: "file to upload"
|
||||
required: false
|
||||
type: "file"
|
||||
responses:
|
||||
default:
|
||||
description: "successful operation"
|
||||
security:
|
||||
- petstore_auth:
|
||||
- "write:pets"
|
||||
- "read:pets"
|
||||
x-tags:
|
||||
- tag: "pet"
|
||||
/pet/{petId}?response=inline_arbitrary_object:
|
||||
get:
|
||||
tags:
|
||||
- "pet"
|
||||
summary: "Fake endpoint to test inline arbitrary object return by 'Find pet\
|
||||
\ by ID'"
|
||||
description: "Returns a pet when ID < 10. ID > 10 or nonintegers will simulate\
|
||||
\ API error conditions"
|
||||
operationId: "controllers.default_controller.get_pet_by_id_in_object"
|
||||
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:
|
||||
$ref: "#/definitions/inline_response_200"
|
||||
400:
|
||||
description: "Invalid ID supplied"
|
||||
404:
|
||||
description: "Pet not found"
|
||||
security:
|
||||
- api_key: []
|
||||
- petstore_auth:
|
||||
- "write:pets"
|
||||
- "read:pets"
|
||||
x-tags:
|
||||
- tag: "pet"
|
||||
/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: "controllers.default_controller.pet_pet_idtesting_byte_arraytrue_get"
|
||||
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"
|
||||
x-tags:
|
||||
- tag: "pet"
|
||||
/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: "controllers.default_controller.add_pet_using_byte_array"
|
||||
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-tags:
|
||||
- tag: "pet"
|
||||
/store/findByStatus:
|
||||
get:
|
||||
tags:
|
||||
- "store"
|
||||
summary: "Finds orders by status"
|
||||
description: "A single status value can be provided as a string"
|
||||
operationId: "controllers.default_controller.find_orders_by_status"
|
||||
produces:
|
||||
- "application/json"
|
||||
- "application/xml"
|
||||
parameters:
|
||||
- name: "status"
|
||||
in: "query"
|
||||
description: "Status value that needs to be considered for query"
|
||||
required: false
|
||||
type: "string"
|
||||
default: "placed"
|
||||
enum:
|
||||
- "placed"
|
||||
- "approved"
|
||||
- "delivered"
|
||||
responses:
|
||||
200:
|
||||
description: "successful operation"
|
||||
schema:
|
||||
type: "array"
|
||||
items:
|
||||
$ref: "#/definitions/Order"
|
||||
400:
|
||||
description: "Invalid status value"
|
||||
security:
|
||||
- test_api_client_secret: []
|
||||
test_api_client_id: []
|
||||
x-tags:
|
||||
- tag: "store"
|
||||
/store/inventory:
|
||||
get:
|
||||
tags:
|
||||
@ -440,7 +310,6 @@ paths:
|
||||
operationId: "controllers.default_controller.get_inventory"
|
||||
produces:
|
||||
- "application/json"
|
||||
- "application/xml"
|
||||
parameters: []
|
||||
responses:
|
||||
200:
|
||||
@ -454,28 +323,6 @@ paths:
|
||||
- api_key: []
|
||||
x-tags:
|
||||
- tag: "store"
|
||||
/store/inventory?response=arbitrary_object:
|
||||
get:
|
||||
tags:
|
||||
- "store"
|
||||
summary: "Fake endpoint to test arbitrary object return by 'Get inventory'"
|
||||
description: "Returns an arbitrary object which is actually a map of status\
|
||||
\ codes to quantities"
|
||||
operationId: "controllers.default_controller.get_inventory_in_object"
|
||||
produces:
|
||||
- "application/json"
|
||||
- "application/xml"
|
||||
parameters: []
|
||||
responses:
|
||||
200:
|
||||
description: "successful operation"
|
||||
schema:
|
||||
type: "object"
|
||||
properties: {}
|
||||
security:
|
||||
- api_key: []
|
||||
x-tags:
|
||||
- tag: "store"
|
||||
/store/order:
|
||||
post:
|
||||
tags:
|
||||
@ -484,13 +331,13 @@ paths:
|
||||
description: ""
|
||||
operationId: "controllers.default_controller.place_order"
|
||||
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:
|
||||
@ -500,9 +347,6 @@ paths:
|
||||
$ref: "#/definitions/Order"
|
||||
400:
|
||||
description: "Invalid Order"
|
||||
security:
|
||||
- test_api_client_secret: []
|
||||
test_api_client_id: []
|
||||
x-tags:
|
||||
- tag: "store"
|
||||
/store/order/{orderId}:
|
||||
@ -514,14 +358,17 @@ paths:
|
||||
\ values will generated exceptions"
|
||||
operationId: "controllers.default_controller.get_order_by_id"
|
||||
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: 5.0
|
||||
minimum: 1.0
|
||||
format: "int64"
|
||||
responses:
|
||||
200:
|
||||
description: "successful operation"
|
||||
@ -531,9 +378,6 @@ paths:
|
||||
description: "Invalid ID supplied"
|
||||
404:
|
||||
description: "Order not found"
|
||||
security:
|
||||
- test_api_key_header: []
|
||||
- test_api_key_query: []
|
||||
x-tags:
|
||||
- tag: "store"
|
||||
delete:
|
||||
@ -544,14 +388,15 @@ paths:
|
||||
\ above 1000 or nonintegers will generate API errors"
|
||||
operationId: "controllers.default_controller.delete_order"
|
||||
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"
|
||||
minimum: 1.0
|
||||
responses:
|
||||
400:
|
||||
description: "Invalid ID supplied"
|
||||
@ -567,13 +412,13 @@ paths:
|
||||
description: "This can only be done by the logged in user."
|
||||
operationId: "controllers.default_controller.create_user"
|
||||
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:
|
||||
@ -589,13 +434,13 @@ paths:
|
||||
description: ""
|
||||
operationId: "controllers.default_controller.create_users_with_array_input"
|
||||
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:
|
||||
@ -613,13 +458,13 @@ paths:
|
||||
description: ""
|
||||
operationId: "controllers.default_controller.create_users_with_list_input"
|
||||
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:
|
||||
@ -637,24 +482,33 @@ paths:
|
||||
description: ""
|
||||
operationId: "controllers.default_controller.login_user"
|
||||
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 toekn expires"
|
||||
400:
|
||||
description: "Invalid username/password supplied"
|
||||
x-tags:
|
||||
@ -667,8 +521,8 @@ paths:
|
||||
description: ""
|
||||
operationId: "controllers.default_controller.logout_user"
|
||||
produces:
|
||||
- "application/json"
|
||||
- "application/xml"
|
||||
- "application/json"
|
||||
parameters: []
|
||||
responses:
|
||||
default:
|
||||
@ -683,8 +537,8 @@ paths:
|
||||
description: ""
|
||||
operationId: "controllers.default_controller.get_user_by_name"
|
||||
produces:
|
||||
- "application/json"
|
||||
- "application/xml"
|
||||
- "application/json"
|
||||
parameters:
|
||||
- name: "username"
|
||||
in: "path"
|
||||
@ -696,16 +550,6 @@ 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:
|
||||
@ -719,8 +563,8 @@ paths:
|
||||
description: "This can only be done by the logged in user."
|
||||
operationId: "controllers.default_controller.update_user"
|
||||
produces:
|
||||
- "application/json"
|
||||
- "application/xml"
|
||||
- "application/json"
|
||||
parameters:
|
||||
- name: "username"
|
||||
in: "path"
|
||||
@ -730,7 +574,7 @@ paths:
|
||||
- in: "body"
|
||||
name: "body"
|
||||
description: "Updated user object"
|
||||
required: false
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/User"
|
||||
responses:
|
||||
@ -747,8 +591,8 @@ paths:
|
||||
description: "This can only be done by the logged in user."
|
||||
operationId: "controllers.default_controller.delete_user"
|
||||
produces:
|
||||
- "application/json"
|
||||
- "application/xml"
|
||||
- "application/json"
|
||||
parameters:
|
||||
- name: "username"
|
||||
in: "path"
|
||||
@ -760,33 +604,13 @@ paths:
|
||||
description: "Invalid username supplied"
|
||||
404:
|
||||
description: "User not found"
|
||||
security:
|
||||
- test_http_basic: []
|
||||
x-tags:
|
||||
- tag: "user"
|
||||
securityDefinitions:
|
||||
test_api_key_header:
|
||||
type: "apiKey"
|
||||
name: "test_api_key_header"
|
||||
in: "header"
|
||||
api_key:
|
||||
type: "apiKey"
|
||||
name: "api_key"
|
||||
in: "header"
|
||||
test_http_basic:
|
||||
type: "basic"
|
||||
test_api_client_secret:
|
||||
type: "apiKey"
|
||||
name: "x-test_api_client_secret"
|
||||
in: "header"
|
||||
test_api_client_id:
|
||||
type: "apiKey"
|
||||
name: "x-test_api_client_id"
|
||||
in: "header"
|
||||
test_api_key_query:
|
||||
type: "apiKey"
|
||||
name: "test_api_key_query"
|
||||
in: "query"
|
||||
petstore_auth:
|
||||
type: "oauth2"
|
||||
authorizationUrl: "http://petstore.swagger.io/api/oauth/dialog"
|
||||
@ -795,7 +619,45 @@ securityDefinitions:
|
||||
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"
|
||||
Category:
|
||||
type: "object"
|
||||
properties:
|
||||
id:
|
||||
type: "integer"
|
||||
format: "int64"
|
||||
name:
|
||||
type: "string"
|
||||
xml:
|
||||
name: "Category"
|
||||
User:
|
||||
type: "object"
|
||||
properties:
|
||||
id:
|
||||
type: "integer"
|
||||
@ -818,7 +680,8 @@ definitions:
|
||||
description: "User Status"
|
||||
xml:
|
||||
name: "User"
|
||||
Category:
|
||||
Tag:
|
||||
type: "object"
|
||||
properties:
|
||||
id:
|
||||
type: "integer"
|
||||
@ -826,8 +689,9 @@ definitions:
|
||||
name:
|
||||
type: "string"
|
||||
xml:
|
||||
name: "Category"
|
||||
name: "Tag"
|
||||
Pet:
|
||||
type: "object"
|
||||
required:
|
||||
- "name"
|
||||
- "photoUrls"
|
||||
@ -863,163 +727,16 @@ definitions:
|
||||
- "sold"
|
||||
xml:
|
||||
name: "Pet"
|
||||
Tag:
|
||||
properties:
|
||||
id:
|
||||
type: "integer"
|
||||
format: "int64"
|
||||
name:
|
||||
type: "string"
|
||||
xml:
|
||||
name: "Tag"
|
||||
Order:
|
||||
properties:
|
||||
id:
|
||||
type: "integer"
|
||||
format: "int64"
|
||||
readOnly: true
|
||||
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"
|
||||
$special[model.name]:
|
||||
properties:
|
||||
$special[property.name]:
|
||||
type: "integer"
|
||||
format: "int64"
|
||||
xml:
|
||||
name: "$special[model.name]"
|
||||
Return:
|
||||
properties:
|
||||
return:
|
||||
type: "integer"
|
||||
format: "int32"
|
||||
description: "Model for testing reserved words"
|
||||
xml:
|
||||
name: "Return"
|
||||
Name:
|
||||
required:
|
||||
- "name"
|
||||
properties:
|
||||
name:
|
||||
type: "integer"
|
||||
format: "int32"
|
||||
snake_case:
|
||||
type: "integer"
|
||||
format: "int32"
|
||||
readOnly: true
|
||||
description: "Model for testing model name same as property name"
|
||||
xml:
|
||||
name: "Name"
|
||||
200_response:
|
||||
properties:
|
||||
name:
|
||||
type: "integer"
|
||||
format: "int32"
|
||||
description: "Model for testing model name starting with number"
|
||||
xml:
|
||||
name: "Name"
|
||||
Dog:
|
||||
allOf:
|
||||
- $ref: "#/definitions/Animal"
|
||||
- type: "object"
|
||||
properties:
|
||||
breed:
|
||||
type: "string"
|
||||
Cat:
|
||||
allOf:
|
||||
- $ref: "#/definitions/Animal"
|
||||
- type: "object"
|
||||
properties:
|
||||
declawed:
|
||||
type: "boolean"
|
||||
Animal:
|
||||
ApiResponse:
|
||||
type: "object"
|
||||
required:
|
||||
- "className"
|
||||
discriminator: "className"
|
||||
properties:
|
||||
className:
|
||||
type: "string"
|
||||
format_test:
|
||||
type: "object"
|
||||
required:
|
||||
- "number"
|
||||
properties:
|
||||
integer:
|
||||
type: "integer"
|
||||
int32:
|
||||
code:
|
||||
type: "integer"
|
||||
format: "int32"
|
||||
int64:
|
||||
type: "integer"
|
||||
format: "int64"
|
||||
number:
|
||||
type: "number"
|
||||
float:
|
||||
type: "number"
|
||||
format: "float"
|
||||
double:
|
||||
type: "number"
|
||||
format: "double"
|
||||
string:
|
||||
type:
|
||||
type: "string"
|
||||
byte:
|
||||
message:
|
||||
type: "string"
|
||||
format: "byte"
|
||||
binary:
|
||||
type: "string"
|
||||
format: "binary"
|
||||
date:
|
||||
type: "string"
|
||||
format: "date"
|
||||
dateTime:
|
||||
type: "string"
|
||||
format: "date-time"
|
||||
password:
|
||||
type: "string"
|
||||
format: "password"
|
||||
inline_response_200:
|
||||
required:
|
||||
- "id"
|
||||
properties:
|
||||
tags:
|
||||
type: "array"
|
||||
items:
|
||||
$ref: "#/definitions/Tag"
|
||||
id:
|
||||
type: "integer"
|
||||
format: "int64"
|
||||
category:
|
||||
type: "object"
|
||||
properties: {}
|
||||
status:
|
||||
type: "string"
|
||||
description: "pet status in the store"
|
||||
enum:
|
||||
- "available"
|
||||
- "pending"
|
||||
- "sold"
|
||||
name:
|
||||
type: "string"
|
||||
example: "doggie"
|
||||
photoUrls:
|
||||
type: "array"
|
||||
items:
|
||||
type: "string"
|
||||
externalDocs:
|
||||
description: "Find out more about Swagger"
|
||||
url: "http://swagger.io"
|
||||
|
@ -2,11 +2,14 @@ controllerPackage: io.swagger.handler
|
||||
modelPackage: io.swagger.model
|
||||
swaggerUrl: ./src/main/swagger/swagger.yaml
|
||||
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
|
||||
# to enable explicit mappings, use this syntax:
|
||||
DefinitionFromSwaggerSpecification: fully.qualified.path.to.Model
|
||||
ApiResponse : io.swagger.model.ApiResponse
|
||||
Category : io.swagger.model.Category
|
||||
Order : io.swagger.model.Order
|
||||
Pet : io.swagger.model.Pet
|
||||
Tag : io.swagger.model.Tag
|
||||
User : io.swagger.model.User
|
||||
|
||||
entityProcessors:
|
||||
- json
|
||||
|
@ -19,6 +19,25 @@
|
||||
<directory>target</directory>
|
||||
<finalName>${project.artifactId}-${project.version}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<version>1.10</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>add-source</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>add-source</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sources>
|
||||
<source>src/gen/java</source>
|
||||
</sources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
@ -78,12 +97,21 @@
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-inflector</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<version>${swagger-inflector-version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>sonatype-snapshots</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
<properties>
|
||||
<maven-plugin-version>1.0.0</maven-plugin-version>
|
||||
<swagger-core-version>1.5.7</swagger-core-version>
|
||||
<swagger-inflector-version>1.0.4</swagger-inflector-version>
|
||||
<jetty-version>9.2.9.v20150224</jetty-version>
|
||||
<logback-version>1.0.1</logback-version>
|
||||
<junit-version>4.8.2</junit-version>
|
||||
|
@ -11,9 +11,10 @@ import java.util.List;
|
||||
import io.swagger.model.*;
|
||||
|
||||
import io.swagger.model.Pet;
|
||||
import io.swagger.model.ApiResponse;
|
||||
import java.io.File;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-01-19T23:33:17.124+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-04-15T17:48:04.458+08:00")
|
||||
public class PetController {
|
||||
/**
|
||||
* Uncomment and implement as you see fit. These operations will map
|
||||
@ -22,13 +23,13 @@ public class PetController {
|
||||
**/
|
||||
|
||||
/*
|
||||
public ResponseContext updatePet(RequestContext request , Pet body) {
|
||||
public ResponseContext addPet(RequestContext request , Pet body) {
|
||||
return new ResponseContext().status(Status.INTERNAL_SERVER_ERROR).entity( "Not implemented" );
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
public ResponseContext addPet(RequestContext request , Pet body) {
|
||||
public ResponseContext deletePet(RequestContext request , Long petId, String apiKey) {
|
||||
return new ResponseContext().status(Status.INTERNAL_SERVER_ERROR).entity( "Not implemented" );
|
||||
}
|
||||
*/
|
||||
@ -52,13 +53,13 @@ public class PetController {
|
||||
*/
|
||||
|
||||
/*
|
||||
public ResponseContext updatePetWithForm(RequestContext request , String petId, String name, String status) {
|
||||
public ResponseContext updatePet(RequestContext request , Pet body) {
|
||||
return new ResponseContext().status(Status.INTERNAL_SERVER_ERROR).entity( "Not implemented" );
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
public ResponseContext deletePet(RequestContext request , Long petId, String apiKey) {
|
||||
public ResponseContext updatePetWithForm(RequestContext request , Long petId, String name, String status) {
|
||||
return new ResponseContext().status(Status.INTERNAL_SERVER_ERROR).entity( "Not implemented" );
|
||||
}
|
||||
*/
|
||||
@ -69,11 +70,5 @@ public class PetController {
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
public ResponseContext getPetByIdWithByteArray(RequestContext request , Long petId) {
|
||||
return new ResponseContext().status(Status.INTERNAL_SERVER_ERROR).entity( "Not implemented" );
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@ import io.swagger.model.*;
|
||||
import java.util.Map;
|
||||
import io.swagger.model.Order;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-01-19T23:33:17.124+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-04-15T17:48:04.458+08:00")
|
||||
public class StoreController {
|
||||
/**
|
||||
* Uncomment and implement as you see fit. These operations will map
|
||||
@ -21,29 +21,29 @@ public class StoreController {
|
||||
* Code allows you to implement logic incrementally, they are disabled.
|
||||
**/
|
||||
|
||||
/*
|
||||
public ResponseContext deleteOrder(RequestContext request , String orderId) {
|
||||
return new ResponseContext().status(Status.INTERNAL_SERVER_ERROR).entity( "Not implemented" );
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
public ResponseContext getInventory(RequestContext request ) {
|
||||
return new ResponseContext().status(Status.INTERNAL_SERVER_ERROR).entity( "Not implemented" );
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
public ResponseContext getOrderById(RequestContext request , Long orderId) {
|
||||
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" );
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
|
@ -11,9 +11,9 @@ import java.util.List;
|
||||
import io.swagger.model.*;
|
||||
|
||||
import io.swagger.model.User;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-01-19T23:33:17.124+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-04-15T17:48:04.458+08:00")
|
||||
public class UserController {
|
||||
/**
|
||||
* Uncomment and implement as you see fit. These operations will map
|
||||
@ -39,6 +39,18 @@ public class UserController {
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
public ResponseContext deleteUser(RequestContext request , String username) {
|
||||
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 loginUser(RequestContext request , String username, String password) {
|
||||
return new ResponseContext().status(Status.INTERNAL_SERVER_ERROR).entity( "Not implemented" );
|
||||
@ -51,23 +63,11 @@ public class UserController {
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
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" );
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,87 +0,0 @@
|
||||
package io.swagger.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-01-19T23:33:17.124+08:00")
|
||||
public class Category {
|
||||
|
||||
private Long id = null;
|
||||
private String name = null;
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
@JsonProperty("id")
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
@JsonProperty("name")
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Category category = (Category) o;
|
||||
return Objects.equals(id, category.id) &&
|
||||
Objects.equals(name, category.name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Category {\n");
|
||||
|
||||
sb.append(" id: ").append(toIndentedString(id)).append("\n");
|
||||
sb.append(" name: ").append(toIndentedString(name)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given object to string with each line indented by 4 spaces
|
||||
* (except the first line).
|
||||
*/
|
||||
private String toIndentedString(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
}
|
||||
|
@ -1,173 +0,0 @@
|
||||
package io.swagger.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-01-19T23:33:17.124+08:00")
|
||||
public class Order {
|
||||
|
||||
private Long id = null;
|
||||
private Long petId = null;
|
||||
private Integer quantity = null;
|
||||
private Date shipDate = null;
|
||||
|
||||
|
||||
public enum StatusEnum {
|
||||
PLACED("placed"),
|
||||
APPROVED("approved"),
|
||||
DELIVERED("delivered");
|
||||
|
||||
private String value;
|
||||
|
||||
StatusEnum(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
private StatusEnum status = null;
|
||||
private Boolean complete = null;
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
@JsonProperty("id")
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
@JsonProperty("petId")
|
||||
public Long getPetId() {
|
||||
return petId;
|
||||
}
|
||||
public void setPetId(Long petId) {
|
||||
this.petId = petId;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
@JsonProperty("quantity")
|
||||
public Integer getQuantity() {
|
||||
return quantity;
|
||||
}
|
||||
public void setQuantity(Integer quantity) {
|
||||
this.quantity = quantity;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
@JsonProperty("shipDate")
|
||||
public Date getShipDate() {
|
||||
return shipDate;
|
||||
}
|
||||
public void setShipDate(Date shipDate) {
|
||||
this.shipDate = shipDate;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Order Status
|
||||
**/
|
||||
|
||||
@ApiModelProperty(value = "Order Status")
|
||||
@JsonProperty("status")
|
||||
public StatusEnum getStatus() {
|
||||
return status;
|
||||
}
|
||||
public void setStatus(StatusEnum status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
@JsonProperty("complete")
|
||||
public Boolean getComplete() {
|
||||
return complete;
|
||||
}
|
||||
public void setComplete(Boolean complete) {
|
||||
this.complete = complete;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Order order = (Order) o;
|
||||
return Objects.equals(id, order.id) &&
|
||||
Objects.equals(petId, order.petId) &&
|
||||
Objects.equals(quantity, order.quantity) &&
|
||||
Objects.equals(shipDate, order.shipDate) &&
|
||||
Objects.equals(status, order.status) &&
|
||||
Objects.equals(complete, order.complete);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, petId, quantity, shipDate, status, complete);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Order {\n");
|
||||
|
||||
sb.append(" id: ").append(toIndentedString(id)).append("\n");
|
||||
sb.append(" petId: ").append(toIndentedString(petId)).append("\n");
|
||||
sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n");
|
||||
sb.append(" shipDate: ").append(toIndentedString(shipDate)).append("\n");
|
||||
sb.append(" status: ").append(toIndentedString(status)).append("\n");
|
||||
sb.append(" complete: ").append(toIndentedString(complete)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given object to string with each line indented by 4 spaces
|
||||
* (except the first line).
|
||||
*/
|
||||
private String toIndentedString(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
}
|
||||
|
@ -1,175 +0,0 @@
|
||||
package io.swagger.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.model.Category;
|
||||
import io.swagger.model.Tag;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-01-19T23:33:17.124+08:00")
|
||||
public class Pet {
|
||||
|
||||
private Long id = null;
|
||||
private Category category = null;
|
||||
private String name = null;
|
||||
private List<String> photoUrls = new ArrayList<String>();
|
||||
private List<Tag> tags = new ArrayList<Tag>();
|
||||
|
||||
|
||||
public enum StatusEnum {
|
||||
AVAILABLE("available"),
|
||||
PENDING("pending"),
|
||||
SOLD("sold");
|
||||
|
||||
private String value;
|
||||
|
||||
StatusEnum(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
private StatusEnum status = null;
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
@JsonProperty("id")
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
@JsonProperty("category")
|
||||
public Category getCategory() {
|
||||
return category;
|
||||
}
|
||||
public void setCategory(Category category) {
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ApiModelProperty(required = true, value = "")
|
||||
@JsonProperty("name")
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ApiModelProperty(required = true, value = "")
|
||||
@JsonProperty("photoUrls")
|
||||
public List<String> getPhotoUrls() {
|
||||
return photoUrls;
|
||||
}
|
||||
public void setPhotoUrls(List<String> photoUrls) {
|
||||
this.photoUrls = photoUrls;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
@JsonProperty("tags")
|
||||
public List<Tag> getTags() {
|
||||
return tags;
|
||||
}
|
||||
public void setTags(List<Tag> tags) {
|
||||
this.tags = tags;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* pet status in the store
|
||||
**/
|
||||
|
||||
@ApiModelProperty(value = "pet status in the store")
|
||||
@JsonProperty("status")
|
||||
public StatusEnum getStatus() {
|
||||
return status;
|
||||
}
|
||||
public void setStatus(StatusEnum status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Pet pet = (Pet) o;
|
||||
return Objects.equals(id, pet.id) &&
|
||||
Objects.equals(category, pet.category) &&
|
||||
Objects.equals(name, pet.name) &&
|
||||
Objects.equals(photoUrls, pet.photoUrls) &&
|
||||
Objects.equals(tags, pet.tags) &&
|
||||
Objects.equals(status, pet.status);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, category, name, photoUrls, tags, status);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Pet {\n");
|
||||
|
||||
sb.append(" id: ").append(toIndentedString(id)).append("\n");
|
||||
sb.append(" category: ").append(toIndentedString(category)).append("\n");
|
||||
sb.append(" name: ").append(toIndentedString(name)).append("\n");
|
||||
sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n");
|
||||
sb.append(" tags: ").append(toIndentedString(tags)).append("\n");
|
||||
sb.append(" status: ").append(toIndentedString(status)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given object to string with each line indented by 4 spaces
|
||||
* (except the first line).
|
||||
*/
|
||||
private String toIndentedString(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
}
|
||||
|
@ -1,87 +0,0 @@
|
||||
package io.swagger.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-01-19T23:33:17.124+08:00")
|
||||
public class Tag {
|
||||
|
||||
private Long id = null;
|
||||
private String name = null;
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
@JsonProperty("id")
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
@JsonProperty("name")
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Tag tag = (Tag) o;
|
||||
return Objects.equals(id, tag.id) &&
|
||||
Objects.equals(name, tag.name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Tag {\n");
|
||||
|
||||
sb.append(" id: ").append(toIndentedString(id)).append("\n");
|
||||
sb.append(" name: ").append(toIndentedString(name)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given object to string with each line indented by 4 spaces
|
||||
* (except the first line).
|
||||
*/
|
||||
private String toIndentedString(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
}
|
||||
|
@ -1,184 +0,0 @@
|
||||
package io.swagger.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-01-19T23:33:17.124+08:00")
|
||||
public class User {
|
||||
|
||||
private Long id = null;
|
||||
private String username = null;
|
||||
private String firstName = null;
|
||||
private String lastName = null;
|
||||
private String email = null;
|
||||
private String password = null;
|
||||
private String phone = null;
|
||||
private Integer userStatus = null;
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
@JsonProperty("id")
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
@JsonProperty("username")
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
@JsonProperty("firstName")
|
||||
public String getFirstName() {
|
||||
return firstName;
|
||||
}
|
||||
public void setFirstName(String firstName) {
|
||||
this.firstName = firstName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
@JsonProperty("lastName")
|
||||
public String getLastName() {
|
||||
return lastName;
|
||||
}
|
||||
public void setLastName(String lastName) {
|
||||
this.lastName = lastName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
@JsonProperty("email")
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
@JsonProperty("password")
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
@JsonProperty("phone")
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* User Status
|
||||
**/
|
||||
|
||||
@ApiModelProperty(value = "User Status")
|
||||
@JsonProperty("userStatus")
|
||||
public Integer getUserStatus() {
|
||||
return userStatus;
|
||||
}
|
||||
public void setUserStatus(Integer userStatus) {
|
||||
this.userStatus = userStatus;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
User user = (User) o;
|
||||
return Objects.equals(id, user.id) &&
|
||||
Objects.equals(username, user.username) &&
|
||||
Objects.equals(firstName, user.firstName) &&
|
||||
Objects.equals(lastName, user.lastName) &&
|
||||
Objects.equals(email, user.email) &&
|
||||
Objects.equals(password, user.password) &&
|
||||
Objects.equals(phone, user.phone) &&
|
||||
Objects.equals(userStatus, user.userStatus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class User {\n");
|
||||
|
||||
sb.append(" id: ").append(toIndentedString(id)).append("\n");
|
||||
sb.append(" username: ").append(toIndentedString(username)).append("\n");
|
||||
sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n");
|
||||
sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n");
|
||||
sb.append(" email: ").append(toIndentedString(email)).append("\n");
|
||||
sb.append(" password: ").append(toIndentedString(password)).append("\n");
|
||||
sb.append(" phone: ").append(toIndentedString(phone)).append("\n");
|
||||
sb.append(" userStatus: ").append(toIndentedString(userStatus)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given object to string with each line indented by 4 spaces
|
||||
* (except the first line).
|
||||
*/
|
||||
private String toIndentedString(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
}
|
||||
|
@ -2,9 +2,9 @@
|
||||
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"
|
||||
\ Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/).\
|
||||
\ 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/"
|
||||
@ -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:
|
||||
@ -29,13 +42,13 @@ paths:
|
||||
- "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:
|
||||
@ -57,13 +70,13 @@ paths:
|
||||
- "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:
|
||||
@ -84,21 +97,25 @@ paths:
|
||||
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"
|
||||
collectionFormat: "multi"
|
||||
default: "available"
|
||||
default: "available"
|
||||
enum:
|
||||
- "available"
|
||||
- "pending"
|
||||
- "sold"
|
||||
collectionFormat: "csv"
|
||||
responses:
|
||||
200:
|
||||
description: "successful operation"
|
||||
@ -119,21 +136,21 @@ paths:
|
||||
tags:
|
||||
- "pet"
|
||||
summary: "Finds Pets by tags"
|
||||
description: "Muliple tags can be provided with comma seperated strings. Use\
|
||||
description: "Multiple tags can be provided with comma separated strings. Use\
|
||||
\ tag1, tag2, tag3 for testing."
|
||||
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"
|
||||
collectionFormat: "multi"
|
||||
collectionFormat: "csv"
|
||||
responses:
|
||||
200:
|
||||
description: "successful operation"
|
||||
@ -154,16 +171,15 @@ paths:
|
||||
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"
|
||||
@ -178,9 +194,6 @@ paths:
|
||||
description: "Pet not found"
|
||||
security:
|
||||
- api_key: []
|
||||
- petstore_auth:
|
||||
- "write:pets"
|
||||
- "read:pets"
|
||||
x-contentType: "application/json"
|
||||
x-accepts: "application/json"
|
||||
post:
|
||||
@ -192,14 +205,15 @@ paths:
|
||||
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"
|
||||
@ -226,12 +240,11 @@ paths:
|
||||
description: ""
|
||||
operationId: "deletePet"
|
||||
produces:
|
||||
- "application/json"
|
||||
- "application/xml"
|
||||
- "application/json"
|
||||
parameters:
|
||||
- name: "api_key"
|
||||
in: "header"
|
||||
description: ""
|
||||
required: false
|
||||
type: "string"
|
||||
- name: "petId"
|
||||
@ -260,7 +273,6 @@ paths:
|
||||
- "multipart/form-data"
|
||||
produces:
|
||||
- "application/json"
|
||||
- "application/xml"
|
||||
parameters:
|
||||
- name: "petId"
|
||||
in: "path"
|
||||
@ -279,80 +291,16 @@ paths:
|
||||
required: false
|
||||
type: "file"
|
||||
responses:
|
||||
default:
|
||||
200:
|
||||
description: "successful operation"
|
||||
schema:
|
||||
$ref: "#/definitions/ApiResponse"
|
||||
security:
|
||||
- petstore_auth:
|
||||
- "write:pets"
|
||||
- "read:pets"
|
||||
x-contentType: "multipart/form-data"
|
||||
x-accepts: "application/json"
|
||||
/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"
|
||||
x-contentType: "application/json"
|
||||
x-accepts: "application/json"
|
||||
/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"
|
||||
security:
|
||||
- petstore_auth:
|
||||
- "write:pets"
|
||||
- "read:pets"
|
||||
x-contentType: "application/json"
|
||||
x-accepts: "application/json"
|
||||
/store/inventory:
|
||||
get:
|
||||
tags:
|
||||
@ -362,7 +310,6 @@ paths:
|
||||
operationId: "getInventory"
|
||||
produces:
|
||||
- "application/json"
|
||||
- "application/xml"
|
||||
parameters: []
|
||||
responses:
|
||||
200:
|
||||
@ -384,13 +331,13 @@ paths:
|
||||
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:
|
||||
@ -411,14 +358,17 @@ paths:
|
||||
\ values will generated exceptions"
|
||||
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: 5.0
|
||||
minimum: 1.0
|
||||
format: "int64"
|
||||
responses:
|
||||
200:
|
||||
description: "successful operation"
|
||||
@ -438,14 +388,15 @@ paths:
|
||||
\ above 1000 or nonintegers 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"
|
||||
minimum: 1.0
|
||||
responses:
|
||||
400:
|
||||
description: "Invalid ID supplied"
|
||||
@ -461,13 +412,13 @@ 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:
|
||||
@ -483,13 +434,13 @@ paths:
|
||||
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:
|
||||
@ -507,13 +458,13 @@ paths:
|
||||
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:
|
||||
@ -531,24 +482,33 @@ paths:
|
||||
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 toekn expires"
|
||||
400:
|
||||
description: "Invalid username/password supplied"
|
||||
x-contentType: "application/json"
|
||||
@ -561,8 +521,8 @@ paths:
|
||||
description: ""
|
||||
operationId: "logoutUser"
|
||||
produces:
|
||||
- "application/json"
|
||||
- "application/xml"
|
||||
- "application/json"
|
||||
parameters: []
|
||||
responses:
|
||||
default:
|
||||
@ -577,8 +537,8 @@ paths:
|
||||
description: ""
|
||||
operationId: "getUserByName"
|
||||
produces:
|
||||
- "application/json"
|
||||
- "application/xml"
|
||||
- "application/json"
|
||||
parameters:
|
||||
- name: "username"
|
||||
in: "path"
|
||||
@ -590,16 +550,6 @@ 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:
|
||||
@ -613,8 +563,8 @@ 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"
|
||||
@ -624,7 +574,7 @@ paths:
|
||||
- in: "body"
|
||||
name: "body"
|
||||
description: "Updated user object"
|
||||
required: false
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/User"
|
||||
responses:
|
||||
@ -641,8 +591,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"
|
||||
@ -669,7 +619,45 @@ securityDefinitions:
|
||||
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"
|
||||
Category:
|
||||
type: "object"
|
||||
properties:
|
||||
id:
|
||||
type: "integer"
|
||||
format: "int64"
|
||||
name:
|
||||
type: "string"
|
||||
xml:
|
||||
name: "Category"
|
||||
User:
|
||||
type: "object"
|
||||
properties:
|
||||
id:
|
||||
type: "integer"
|
||||
@ -692,7 +680,8 @@ definitions:
|
||||
description: "User Status"
|
||||
xml:
|
||||
name: "User"
|
||||
Category:
|
||||
Tag:
|
||||
type: "object"
|
||||
properties:
|
||||
id:
|
||||
type: "integer"
|
||||
@ -700,8 +689,9 @@ definitions:
|
||||
name:
|
||||
type: "string"
|
||||
xml:
|
||||
name: "Category"
|
||||
name: "Tag"
|
||||
Pet:
|
||||
type: "object"
|
||||
required:
|
||||
- "name"
|
||||
- "photoUrls"
|
||||
@ -737,37 +727,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"
|
||||
|
@ -14,7 +14,7 @@ public interface StoreApi {
|
||||
@Path("/store/order/{orderId}")
|
||||
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
public Response deleteOrder(@PathParam("orderId") Long orderId);
|
||||
public Response deleteOrder(@PathParam("orderId") String orderId);
|
||||
@GET
|
||||
@Path("/store/inventory")
|
||||
|
||||
|
@ -24,7 +24,6 @@ public class ApiResponse {
|
||||
|
||||
private String message = null;
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ -34,7 +33,6 @@ public class ApiResponse {
|
||||
public void setCode(Integer code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ -44,7 +42,6 @@ public class ApiResponse {
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ -55,7 +52,6 @@ public class ApiResponse {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
@ -22,7 +22,6 @@ public class Category {
|
||||
|
||||
private String name = null;
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ -32,7 +31,6 @@ public class Category {
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ -43,7 +41,6 @@ public class Category {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
@ -32,7 +32,7 @@ import javax.xml.bind.annotation.XmlType;
|
||||
@XmlType(name="Order")
|
||||
@XmlEnum
|
||||
public enum Order {
|
||||
{values=[placed, approved, delivered], enumVars=[{name=PLACED, value=placed}, {name=APPROVED, value=approved}, {name=DELIVERED, value=delivered}]},
|
||||
{values=[placed, approved, delivered], enumVars=[{name=PLACED, value=placed}, {name=APPROVED, value=approved}, {name=DELIVERED, value=delivered}]},
|
||||
|
||||
public String value() {
|
||||
return name();
|
||||
@ -47,7 +47,6 @@ public enum Order {
|
||||
|
||||
private Boolean complete = false;
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ -57,7 +56,6 @@ public enum Order {
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ -67,7 +65,6 @@ public enum Order {
|
||||
public void setPetId(Long petId) {
|
||||
this.petId = petId;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ -77,7 +74,6 @@ public enum Order {
|
||||
public void setQuantity(Integer quantity) {
|
||||
this.quantity = quantity;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ -87,7 +83,6 @@ public enum Order {
|
||||
public void setShipDate(javax.xml.datatype.XMLGregorianCalendar shipDate) {
|
||||
this.shipDate = shipDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Order Status
|
||||
**/
|
||||
@ -98,7 +93,6 @@ public enum Order {
|
||||
public void setStatus(StatusEnum status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ -109,7 +103,6 @@ public enum Order {
|
||||
this.complete = complete;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
@ -38,7 +38,7 @@ import javax.xml.bind.annotation.XmlType;
|
||||
@XmlType(name="Pet")
|
||||
@XmlEnum
|
||||
public enum Pet {
|
||||
{values=[available, pending, sold], enumVars=[{name=AVAILABLE, value=available}, {name=PENDING, value=pending}, {name=SOLD, value=sold}]},
|
||||
{values=[available, pending, sold], enumVars=[{name=AVAILABLE, value=available}, {name=PENDING, value=pending}, {name=SOLD, value=sold}]},
|
||||
|
||||
public String value() {
|
||||
return name();
|
||||
@ -51,7 +51,6 @@ public enum Pet {
|
||||
|
||||
private StatusEnum status = null;
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ -61,7 +60,6 @@ public enum Pet {
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ -71,7 +69,6 @@ public enum Pet {
|
||||
public void setCategory(Category category) {
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ -81,7 +78,6 @@ public enum Pet {
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ -91,7 +87,6 @@ public enum Pet {
|
||||
public void setPhotoUrls(List<String> photoUrls) {
|
||||
this.photoUrls = photoUrls;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ -101,7 +96,6 @@ public enum Pet {
|
||||
public void setTags(List<Tag> tags) {
|
||||
this.tags = tags;
|
||||
}
|
||||
|
||||
/**
|
||||
* pet status in the store
|
||||
**/
|
||||
@ -113,7 +107,6 @@ public enum Pet {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
@ -22,7 +22,6 @@ public class Tag {
|
||||
|
||||
private String name = null;
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ -32,7 +31,6 @@ public class Tag {
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ -43,7 +41,6 @@ public class Tag {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
@ -34,7 +34,6 @@ public class User {
|
||||
|
||||
private Integer userStatus = null;
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ -44,7 +43,6 @@ public class User {
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ -54,7 +52,6 @@ public class User {
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ -64,7 +61,6 @@ public class User {
|
||||
public void setFirstName(String firstName) {
|
||||
this.firstName = firstName;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ -74,7 +70,6 @@ public class User {
|
||||
public void setLastName(String lastName) {
|
||||
this.lastName = lastName;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ -84,7 +79,6 @@ public class User {
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ -94,7 +88,6 @@ public class User {
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ -104,7 +97,6 @@ public class User {
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
/**
|
||||
* User Status
|
||||
**/
|
||||
@ -116,7 +108,6 @@ public class User {
|
||||
this.userStatus = userStatus;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
@ -1,6 +1,6 @@
|
||||
package io.swagger.api;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-16T14:27:58.108+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-15T18:10:39.667+08:00")
|
||||
public class ApiException extends Exception{
|
||||
private int code;
|
||||
public ApiException (int code, String msg) {
|
||||
|
@ -5,7 +5,7 @@ import java.io.IOException;
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-16T14:27:58.108+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-15T18:10:39.667+08:00")
|
||||
public class ApiOriginFilter implements javax.servlet.Filter {
|
||||
public void doFilter(ServletRequest request, ServletResponse response,
|
||||
FilterChain chain) throws IOException, ServletException {
|
||||
|
@ -3,7 +3,7 @@ package io.swagger.api;
|
||||
import javax.xml.bind.annotation.XmlTransient;
|
||||
|
||||
@javax.xml.bind.annotation.XmlRootElement
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-16T14:27:58.108+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-15T18:10:39.667+08:00")
|
||||
public class ApiResponseMessage {
|
||||
public static final int ERROR = 1;
|
||||
public static final int WARNING = 2;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package io.swagger.api;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-16T14:27:58.108+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-15T18:10:39.667+08:00")
|
||||
public class NotFoundException extends ApiException {
|
||||
private int code;
|
||||
public NotFoundException (int code, String msg) {
|
||||
|
@ -5,7 +5,7 @@ import io.swagger.api.PetApiService;
|
||||
import io.swagger.api.factories.PetApiServiceFactory;
|
||||
|
||||
import io.swagger.model.Pet;
|
||||
import io.swagger.model.InlineResponse200;
|
||||
import io.swagger.model.ApiResponse;
|
||||
import java.io.File;
|
||||
|
||||
import java.util.List;
|
||||
@ -22,14 +22,14 @@ import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput;
|
||||
@Path("/pet")
|
||||
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-16T14:27:58.108+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-15T18:10:39.667+08:00")
|
||||
public class PetApi {
|
||||
private final PetApiService delegate = PetApiServiceFactory.getPetApi();
|
||||
|
||||
@POST
|
||||
|
||||
@Consumes({ "application/json", "application/xml" })
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
public Response addPet( Pet body,@Context SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
return delegate.addPet(body,securityContext);
|
||||
@ -37,7 +37,7 @@ public class PetApi {
|
||||
@DELETE
|
||||
@Path("/{petId}")
|
||||
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
public Response deletePet( @PathParam("petId") Long petId,@HeaderParam("api_key") String apiKey,@Context SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
return delegate.deletePet(petId,apiKey,securityContext);
|
||||
@ -45,7 +45,7 @@ public class PetApi {
|
||||
@GET
|
||||
@Path("/findByStatus")
|
||||
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
public Response findPetsByStatus( @QueryParam("status") List<String> status,@Context SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
return delegate.findPetsByStatus(status,securityContext);
|
||||
@ -53,7 +53,7 @@ public class PetApi {
|
||||
@GET
|
||||
@Path("/findByTags")
|
||||
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
public Response findPetsByTags( @QueryParam("tags") List<String> tags,@Context SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
return delegate.findPetsByTags(tags,securityContext);
|
||||
@ -61,31 +61,15 @@ public class PetApi {
|
||||
@GET
|
||||
@Path("/{petId}")
|
||||
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
public Response getPetById( @PathParam("petId") Long petId,@Context SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
return delegate.getPetById(petId,securityContext);
|
||||
}
|
||||
@GET
|
||||
@Path("/{petId}?response=inline_arbitrary_object")
|
||||
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
public Response getPetByIdInObject( @PathParam("petId") Long petId,@Context SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
return delegate.getPetByIdInObject(petId,securityContext);
|
||||
}
|
||||
@GET
|
||||
@Path("/{petId}?testing_byte_array=true")
|
||||
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
public Response petPetIdtestingByteArraytrueGet( @PathParam("petId") Long petId,@Context SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
return delegate.petPetIdtestingByteArraytrueGet(petId,securityContext);
|
||||
}
|
||||
@PUT
|
||||
|
||||
@Consumes({ "application/json", "application/xml" })
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
public Response updatePet( Pet body,@Context SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
return delegate.updatePet(body,securityContext);
|
||||
@ -93,15 +77,15 @@ public class PetApi {
|
||||
@POST
|
||||
@Path("/{petId}")
|
||||
@Consumes({ "application/x-www-form-urlencoded" })
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
public Response updatePetWithForm( @PathParam("petId") String petId,@FormParam("name") String name,@FormParam("status") String status,@Context SecurityContext securityContext)
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
public Response updatePetWithForm( @PathParam("petId") Long petId,@FormParam("name") String name,@FormParam("status") String status,@Context SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
return delegate.updatePetWithForm(petId,name,status,securityContext);
|
||||
}
|
||||
@POST
|
||||
@Path("/{petId}/uploadImage")
|
||||
@Consumes({ "multipart/form-data" })
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
@Produces({ "application/json" })
|
||||
public Response uploadFile(MultipartFormDataInput input, @PathParam("petId") Long petId,@Context SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
return delegate.uploadFile(input,petId,securityContext);
|
||||
|
@ -6,7 +6,7 @@ import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput;
|
||||
|
||||
|
||||
import io.swagger.model.Pet;
|
||||
import io.swagger.model.InlineResponse200;
|
||||
import io.swagger.model.ApiResponse;
|
||||
import java.io.File;
|
||||
|
||||
import java.util.List;
|
||||
@ -17,37 +17,22 @@ import java.io.InputStream;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.SecurityContext;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-16T14:27:58.108+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-15T18:10:39.667+08:00")
|
||||
public abstract class PetApiService {
|
||||
|
||||
public abstract Response addPet(Pet body,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
|
||||
public abstract Response deletePet(Long petId,String apiKey,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
|
||||
public abstract Response findPetsByStatus(List<String> status,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
|
||||
public abstract Response findPetsByTags(List<String> tags,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
|
||||
public abstract Response getPetById(Long petId,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
|
||||
public abstract Response getPetByIdInObject(Long petId,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
|
||||
public abstract Response petPetIdtestingByteArraytrueGet(Long petId,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
|
||||
public abstract Response updatePet(Pet body,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
|
||||
public abstract Response updatePetWithForm(String petId,String name,String status,SecurityContext securityContext)
|
||||
public abstract Response updatePetWithForm(Long petId,String name,String status,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
|
||||
public abstract Response uploadFile(MultipartFormDataInput input,Long petId,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
|
||||
}
|
||||
|
@ -4,8 +4,8 @@ import io.swagger.model.*;
|
||||
import io.swagger.api.StoreApiService;
|
||||
import io.swagger.api.factories.StoreApiServiceFactory;
|
||||
|
||||
import io.swagger.model.Order;
|
||||
import java.util.Map;
|
||||
import io.swagger.model.Order;
|
||||
|
||||
import java.util.List;
|
||||
import io.swagger.api.NotFoundException;
|
||||
@ -20,54 +20,38 @@ import javax.ws.rs.*;
|
||||
@Path("/store")
|
||||
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-16T14:27:58.108+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-15T18:10:39.667+08:00")
|
||||
public class StoreApi {
|
||||
private final StoreApiService delegate = StoreApiServiceFactory.getStoreApi();
|
||||
|
||||
@DELETE
|
||||
@Path("/order/{orderId}")
|
||||
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
public Response deleteOrder( @PathParam("orderId") String orderId,@Context SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
return delegate.deleteOrder(orderId,securityContext);
|
||||
}
|
||||
@GET
|
||||
@Path("/findByStatus")
|
||||
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
public Response findOrdersByStatus( @QueryParam("status") String status,@Context SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
return delegate.findOrdersByStatus(status,securityContext);
|
||||
}
|
||||
@GET
|
||||
@Path("/inventory")
|
||||
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
@Produces({ "application/json" })
|
||||
public Response getInventory(@Context SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
return delegate.getInventory(securityContext);
|
||||
}
|
||||
@GET
|
||||
@Path("/inventory?response=arbitrary_object")
|
||||
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
public Response getInventoryInObject(@Context SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
return delegate.getInventoryInObject(securityContext);
|
||||
}
|
||||
@GET
|
||||
@Path("/order/{orderId}")
|
||||
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
public Response getOrderById( @PathParam("orderId") String orderId,@Context SecurityContext securityContext)
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
public Response getOrderById( @PathParam("orderId") Long orderId,@Context SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
return delegate.getOrderById(orderId,securityContext);
|
||||
}
|
||||
@POST
|
||||
@Path("/order")
|
||||
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
public Response placeOrder( Order body,@Context SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
return delegate.placeOrder(body,securityContext);
|
||||
|
@ -4,8 +4,8 @@ import io.swagger.api.*;
|
||||
import io.swagger.model.*;
|
||||
|
||||
|
||||
import io.swagger.model.Order;
|
||||
import java.util.Map;
|
||||
import io.swagger.model.Order;
|
||||
|
||||
import java.util.List;
|
||||
import io.swagger.api.NotFoundException;
|
||||
@ -15,25 +15,14 @@ import java.io.InputStream;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.SecurityContext;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-16T14:27:58.108+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-15T18:10:39.667+08:00")
|
||||
public abstract class StoreApiService {
|
||||
|
||||
public abstract Response deleteOrder(String orderId,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
|
||||
public abstract Response findOrdersByStatus(String status,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
|
||||
public abstract Response getInventory(SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
|
||||
public abstract Response getInventoryInObject(SecurityContext securityContext)
|
||||
public abstract Response getOrderById(Long orderId,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
|
||||
public abstract Response getOrderById(String orderId,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
|
||||
public abstract Response placeOrder(Order body,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package io.swagger.api;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-16T14:27:58.108+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-15T18:10:39.667+08:00")
|
||||
public class StringUtil {
|
||||
/**
|
||||
* Check if the given array contains the given value (with case-insensitive comparison).
|
||||
|
@ -20,14 +20,14 @@ import javax.ws.rs.*;
|
||||
@Path("/user")
|
||||
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-16T14:27:58.108+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-15T18:10:39.667+08:00")
|
||||
public class UserApi {
|
||||
private final UserApiService delegate = UserApiServiceFactory.getUserApi();
|
||||
|
||||
@POST
|
||||
|
||||
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
public Response createUser( User body,@Context SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
return delegate.createUser(body,securityContext);
|
||||
@ -35,7 +35,7 @@ public class UserApi {
|
||||
@POST
|
||||
@Path("/createWithArray")
|
||||
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
public Response createUsersWithArrayInput( List<User> body,@Context SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
return delegate.createUsersWithArrayInput(body,securityContext);
|
||||
@ -43,7 +43,7 @@ public class UserApi {
|
||||
@POST
|
||||
@Path("/createWithList")
|
||||
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
public Response createUsersWithListInput( List<User> body,@Context SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
return delegate.createUsersWithListInput(body,securityContext);
|
||||
@ -51,7 +51,7 @@ public class UserApi {
|
||||
@DELETE
|
||||
@Path("/{username}")
|
||||
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
public Response deleteUser( @PathParam("username") String username,@Context SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
return delegate.deleteUser(username,securityContext);
|
||||
@ -59,7 +59,7 @@ public class UserApi {
|
||||
@GET
|
||||
@Path("/{username}")
|
||||
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
public Response getUserByName( @PathParam("username") String username,@Context SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
return delegate.getUserByName(username,securityContext);
|
||||
@ -67,7 +67,7 @@ public class UserApi {
|
||||
@GET
|
||||
@Path("/login")
|
||||
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
public Response loginUser( @QueryParam("username") String username, @QueryParam("password") String password,@Context SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
return delegate.loginUser(username,password,securityContext);
|
||||
@ -75,7 +75,7 @@ public class UserApi {
|
||||
@GET
|
||||
@Path("/logout")
|
||||
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
public Response logoutUser(@Context SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
return delegate.logoutUser(securityContext);
|
||||
@ -83,7 +83,7 @@ public class UserApi {
|
||||
@PUT
|
||||
@Path("/{username}")
|
||||
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
public Response updateUser( @PathParam("username") String username, User body,@Context SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
return delegate.updateUser(username,body,securityContext);
|
||||
|
@ -15,31 +15,22 @@ import java.io.InputStream;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.SecurityContext;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-16T14:27:58.108+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-15T18:10:39.667+08:00")
|
||||
public abstract class UserApiService {
|
||||
|
||||
public abstract Response createUser(User body,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
|
||||
public abstract Response createUsersWithArrayInput(List<User> body,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
|
||||
public abstract Response createUsersWithListInput(List<User> body,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
|
||||
public abstract Response deleteUser(String username,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
|
||||
public abstract Response getUserByName(String username,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
|
||||
public abstract Response loginUser(String username,String password,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
|
||||
public abstract Response logoutUser(SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
|
||||
public abstract Response updateUser(String username,User body,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,94 @@
|
||||
package io.swagger.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.ArrayList;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
|
||||
|
||||
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-15T18:10:39.667+08:00")
|
||||
public class ApiResponse {
|
||||
|
||||
private Integer code = null;
|
||||
private String type = null;
|
||||
private String message = null;
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@JsonProperty("code")
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
public void setCode(Integer code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@JsonProperty("type")
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@JsonProperty("message")
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
ApiResponse apiResponse = (ApiResponse) o;
|
||||
return Objects.equals(code, apiResponse.code) &&
|
||||
Objects.equals(type, apiResponse.type) &&
|
||||
Objects.equals(message, apiResponse.message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(code, type, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class ApiResponse {\n");
|
||||
|
||||
sb.append(" code: ").append(toIndentedString(code)).append("\n");
|
||||
sb.append(" type: ").append(toIndentedString(type)).append("\n");
|
||||
sb.append(" message: ").append(toIndentedString(message)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given object to string with each line indented by 4 spaces
|
||||
* (except the first line).
|
||||
*/
|
||||
private String toIndentedString(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
}
|
||||
|
@ -8,13 +8,12 @@ import com.fasterxml.jackson.annotation.JsonValue;
|
||||
|
||||
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-16T14:27:58.108+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-15T18:10:39.667+08:00")
|
||||
public class Category {
|
||||
|
||||
private Long id = null;
|
||||
private String name = null;
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ -26,7 +25,6 @@ public class Category {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ -39,7 +37,6 @@ public class Category {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
|
@ -9,7 +9,7 @@ import java.util.Date;
|
||||
|
||||
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-16T14:27:58.108+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-15T18:10:39.667+08:00")
|
||||
public class Order {
|
||||
|
||||
private Long id = null;
|
||||
@ -37,8 +37,7 @@ public class Order {
|
||||
}
|
||||
|
||||
private StatusEnum status = null;
|
||||
private Boolean complete = null;
|
||||
|
||||
private Boolean complete = false;
|
||||
|
||||
/**
|
||||
**/
|
||||
@ -51,7 +50,6 @@ public class Order {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ -63,7 +61,6 @@ public class Order {
|
||||
this.petId = petId;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ -75,7 +72,6 @@ public class Order {
|
||||
this.quantity = quantity;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ -87,7 +83,6 @@ public class Order {
|
||||
this.shipDate = shipDate;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Order Status
|
||||
**/
|
||||
@ -100,7 +95,6 @@ public class Order {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ -113,7 +107,6 @@ public class Order {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
|
@ -11,7 +11,7 @@ import java.util.List;
|
||||
|
||||
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-16T14:27:58.108+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-15T18:10:39.667+08:00")
|
||||
public class Pet {
|
||||
|
||||
private Long id = null;
|
||||
@ -41,7 +41,6 @@ public class Pet {
|
||||
|
||||
private StatusEnum status = null;
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ -53,7 +52,6 @@ public class Pet {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ -65,7 +63,6 @@ public class Pet {
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ -77,7 +74,6 @@ public class Pet {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ -89,7 +85,6 @@ public class Pet {
|
||||
this.photoUrls = photoUrls;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ -101,7 +96,6 @@ public class Pet {
|
||||
this.tags = tags;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* pet status in the store
|
||||
**/
|
||||
@ -115,7 +109,6 @@ public class Pet {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
|
@ -8,13 +8,12 @@ import com.fasterxml.jackson.annotation.JsonValue;
|
||||
|
||||
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-16T14:27:58.108+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-15T18:10:39.667+08:00")
|
||||
public class Tag {
|
||||
|
||||
private Long id = null;
|
||||
private String name = null;
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ -26,7 +25,6 @@ public class Tag {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ -39,7 +37,6 @@ public class Tag {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
|
@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonValue;
|
||||
|
||||
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-03-16T14:27:58.108+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-15T18:10:39.667+08:00")
|
||||
public class User {
|
||||
|
||||
private Long id = null;
|
||||
@ -20,7 +20,6 @@ public class User {
|
||||
private String phone = null;
|
||||
private Integer userStatus = null;
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ -32,7 +31,6 @@ public class User {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ -44,7 +42,6 @@ public class User {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ -56,7 +53,6 @@ public class User {
|
||||
this.firstName = firstName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ -68,7 +64,6 @@ public class User {
|
||||
this.lastName = lastName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ -80,7 +75,6 @@ public class User {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ -92,7 +86,6 @@ public class User {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ -104,7 +97,6 @@ public class User {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* User Status
|
||||
**/
|
||||
@ -118,7 +110,6 @@ public class User {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
|
@ -51,14 +51,18 @@ public class PetApiServiceImpl extends PetApiService {
|
||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||
}
|
||||
|
||||
/*
|
||||
* comment out as the method (for testing) does not exit in the original swagger spec
|
||||
* we'll uncomment this code block later if we update the petstore server
|
||||
@Override
|
||||
public Response getPetByIdInObject(Long petId,SecurityContext securityContext) 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,SecurityContext securityContext) throws NotFoundException {
|
||||
public Response updatePetWithForm(Long petId,String name,String status,SecurityContext securityContext) throws NotFoundException {
|
||||
// do some magic!
|
||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||
}
|
||||
@ -75,11 +79,15 @@ public class PetApiServiceImpl extends PetApiService {
|
||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||
}
|
||||
|
||||
/*
|
||||
* comment out as the method (for testing) does not exit in the original swagger spec
|
||||
* we'll uncomment this code block later if we update the petstore server
|
||||
@Override
|
||||
public Response petPetIdtestingByteArraytrueGet(Long petId,SecurityContext securityContext) throws NotFoundException {
|
||||
// do some magic!
|
||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
|
@ -26,11 +26,15 @@ public class StoreApiServiceImpl extends StoreApiService {
|
||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||
}
|
||||
|
||||
/*
|
||||
* * comment out as the method (for testing) does not exit in the original swagger spec
|
||||
* * we'll uncomment this code block later if we update the petstore server
|
||||
@Override
|
||||
public Response getInventoryInObject(SecurityContext securityContext) throws NotFoundException {
|
||||
// do some magic!
|
||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||
}
|
||||
*/
|
||||
|
||||
@Override
|
||||
public Response placeOrder(Order body,SecurityContext securityContext) throws NotFoundException {
|
||||
@ -39,7 +43,7 @@ public class StoreApiServiceImpl extends StoreApiService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Response getOrderById(String orderId,SecurityContext securityContext) throws NotFoundException {
|
||||
public Response getOrderById(Long orderId,SecurityContext securityContext) throws NotFoundException {
|
||||
// do some magic!
|
||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||
}
|
||||
@ -50,11 +54,15 @@ public class StoreApiServiceImpl extends StoreApiService {
|
||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||
}
|
||||
|
||||
/*
|
||||
* * comment out as the method (for testing) does not exit in the original swagger spec
|
||||
* * we'll uncomment this code block later if we update the petstore server
|
||||
@Override
|
||||
public Response findOrdersByStatus(String status, SecurityContext securityContext) throws NotFoundException {
|
||||
// do some magic!
|
||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
|
@ -62,8 +62,7 @@ public class PetApi {
|
||||
})
|
||||
}, tags={ "pet", })
|
||||
@io.swagger.annotations.ApiResponses(value = {
|
||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = void.class),
|
||||
@io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = void.class) })
|
||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid pet value", response = void.class) })
|
||||
public Response deletePet(
|
||||
@ApiParam(value = "Pet id to delete",required=true) @PathParam("petId") Long petId,
|
||||
@ApiParam(value = "" )@HeaderParam("api_key") String apiKey,
|
||||
@ -94,7 +93,7 @@ public class PetApi {
|
||||
@Path("/findByTags")
|
||||
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@io.swagger.annotations.ApiOperation(value = "Finds Pets by tags", notes = "Muliple tags can be provided with comma separated strings. Use\ntag1, tag2, tag3 for testing.\n", response = Pet.class, responseContainer = "List", authorizations = {
|
||||
@io.swagger.annotations.ApiOperation(value = "Finds Pets by tags", notes = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", response = Pet.class, responseContainer = "List", authorizations = {
|
||||
@io.swagger.annotations.Authorization(value = "petstore_auth", scopes = {
|
||||
@io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||
@io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||
@ -150,7 +149,7 @@ public class PetApi {
|
||||
@Path("/{petId}")
|
||||
@Consumes({ "application/x-www-form-urlencoded" })
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@io.swagger.annotations.ApiOperation(value = "Updates a pet in the store with form data", notes = "null", response = void.class, authorizations = {
|
||||
@io.swagger.annotations.ApiOperation(value = "Updates a pet in the store with form data", notes = "", response = void.class, authorizations = {
|
||||
@io.swagger.annotations.Authorization(value = "petstore_auth", scopes = {
|
||||
@io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||
@io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||
|
@ -22,29 +22,20 @@ import javax.ws.rs.core.SecurityContext;
|
||||
|
||||
|
||||
public abstract class PetApiService {
|
||||
|
||||
public abstract Response addPet(Pet body,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
|
||||
public abstract Response deletePet(Long petId,String apiKey,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
|
||||
public abstract Response findPetsByStatus(List<String> status,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
|
||||
public abstract Response findPetsByTags(List<String> tags,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
|
||||
public abstract Response getPetById(Long petId,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
|
||||
public abstract Response updatePet(Pet body,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
|
||||
public abstract Response updatePetWithForm(Long petId,String name,String status,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
|
||||
public abstract Response uploadFile(Long petId,String additionalMetadata,InputStream inputStream, FormDataContentDisposition fileDetail,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
|
||||
}
|
||||
|
@ -36,12 +36,12 @@ public class StoreApi {
|
||||
@Path("/order/{orderId}")
|
||||
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@io.swagger.annotations.ApiOperation(value = "Delete purchase order by ID", notes = "For valid response try integer IDs with positive integer value.\\ \\ Negative or non-integer values will generate API errors", response = void.class, tags={ "store", })
|
||||
@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, tags={ "store", })
|
||||
@io.swagger.annotations.ApiResponses(value = {
|
||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = void.class),
|
||||
@io.swagger.annotations.ApiResponse(code = 404, message = "Order not found", response = void.class) })
|
||||
public Response deleteOrder(
|
||||
@ApiParam(value = "ID of the order that needs to be deleted",required=true) @PathParam("orderId") Long orderId,
|
||||
@ApiParam(value = "ID of the order that needs to be deleted",required=true) @PathParam("orderId") String orderId,
|
||||
@Context SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
return delegate.deleteOrder(orderId,securityContext);
|
||||
@ -64,7 +64,7 @@ public class StoreApi {
|
||||
@Path("/order/{orderId}")
|
||||
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@io.swagger.annotations.ApiOperation(value = "Find purchase order by ID", notes = "For valid response try integer IDs with value >= 1 and <= 10.\nOther values will generated exceptions\n", response = Order.class, tags={ "store", })
|
||||
@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, tags={ "store", })
|
||||
@io.swagger.annotations.ApiResponses(value = {
|
||||
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Order.class),
|
||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Order.class),
|
||||
|
@ -21,17 +21,12 @@ import javax.ws.rs.core.SecurityContext;
|
||||
|
||||
|
||||
public abstract class StoreApiService {
|
||||
|
||||
public abstract Response deleteOrder(Long orderId,SecurityContext securityContext)
|
||||
public abstract Response deleteOrder(String orderId,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
|
||||
public abstract Response getInventory(SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
|
||||
public abstract Response getOrderById(Long orderId,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
|
||||
public abstract Response placeOrder(Order body,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ public class UserApi {
|
||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username supplied", response = User.class),
|
||||
@io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = User.class) })
|
||||
public Response getUserByName(
|
||||
@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.",required=true) @PathParam("username") String username,
|
||||
@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true) @PathParam("username") String username,
|
||||
@Context SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
return delegate.getUserByName(username,securityContext);
|
||||
@ -119,7 +119,7 @@ public class UserApi {
|
||||
@Path("/logout")
|
||||
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@io.swagger.annotations.ApiOperation(value = "Logs out current logged in user session", notes = "null", response = void.class, tags={ "user", })
|
||||
@io.swagger.annotations.ApiOperation(value = "Logs out current logged in user session", notes = "", response = void.class, tags={ "user", })
|
||||
@io.swagger.annotations.ApiResponses(value = {
|
||||
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = void.class) })
|
||||
public Response logoutUser(
|
||||
@ -136,7 +136,7 @@ public class UserApi {
|
||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid user supplied", response = void.class),
|
||||
@io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = void.class) })
|
||||
public Response updateUser(
|
||||
@ApiParam(value = "name that need to be updated",required=true) @PathParam("username") String username,
|
||||
@ApiParam(value = "name that need to be deleted",required=true) @PathParam("username") String username,
|
||||
@ApiParam(value = "Updated user object" ,required=true) User body,
|
||||
@Context SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
|
@ -21,29 +21,20 @@ import javax.ws.rs.core.SecurityContext;
|
||||
|
||||
|
||||
public abstract class UserApiService {
|
||||
|
||||
public abstract Response createUser(User body,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
|
||||
public abstract Response createUsersWithArrayInput(List<User> body,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
|
||||
public abstract Response createUsersWithListInput(List<User> body,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
|
||||
public abstract Response deleteUser(String username,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
|
||||
public abstract Response getUserByName(String username,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
|
||||
public abstract Response loginUser(String username,String password,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
|
||||
public abstract Response logoutUser(SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
|
||||
public abstract Response updateUser(String username,User body,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
|
||||
}
|
||||
|
@ -16,7 +16,6 @@ public class ApiResponse {
|
||||
private String type = null;
|
||||
private String message = null;
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
public ApiResponse code(Integer code) {
|
||||
@ -34,7 +33,6 @@ public class ApiResponse {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
public ApiResponse type(String type) {
|
||||
@ -52,7 +50,6 @@ public class ApiResponse {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
public ApiResponse message(String message) {
|
||||
@ -71,7 +68,6 @@ public class ApiResponse {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
|
@ -15,7 +15,6 @@ public class Category {
|
||||
private Long id = null;
|
||||
private String name = null;
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
public Category id(Long id) {
|
||||
@ -33,7 +32,6 @@ public class Category {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
public Category name(String name) {
|
||||
@ -52,7 +50,6 @@ public class Category {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
|
@ -41,7 +41,6 @@ public class Order {
|
||||
private StatusEnum status = null;
|
||||
private Boolean complete = false;
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
public Order id(Long id) {
|
||||
@ -59,7 +58,6 @@ public class Order {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
public Order petId(Long petId) {
|
||||
@ -77,7 +75,6 @@ public class Order {
|
||||
this.petId = petId;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
public Order quantity(Integer quantity) {
|
||||
@ -95,7 +92,6 @@ public class Order {
|
||||
this.quantity = quantity;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
public Order shipDate(Date shipDate) {
|
||||
@ -113,7 +109,6 @@ public class Order {
|
||||
this.shipDate = shipDate;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Order Status
|
||||
**/
|
||||
@ -132,7 +127,6 @@ public class Order {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
public Order complete(Boolean complete) {
|
||||
@ -151,7 +145,6 @@ public class Order {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
|
@ -44,7 +44,6 @@ public class Pet {
|
||||
|
||||
private StatusEnum status = null;
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
public Pet id(Long id) {
|
||||
@ -62,7 +61,6 @@ public class Pet {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
public Pet category(Category category) {
|
||||
@ -80,7 +78,6 @@ public class Pet {
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
public Pet name(String name) {
|
||||
@ -98,7 +95,6 @@ public class Pet {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
public Pet photoUrls(List<String> photoUrls) {
|
||||
@ -116,7 +112,6 @@ public class Pet {
|
||||
this.photoUrls = photoUrls;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
public Pet tags(List<Tag> tags) {
|
||||
@ -134,7 +129,6 @@ public class Pet {
|
||||
this.tags = tags;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* pet status in the store
|
||||
**/
|
||||
@ -154,7 +148,6 @@ public class Pet {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
|
@ -15,7 +15,6 @@ public class Tag {
|
||||
private Long id = null;
|
||||
private String name = null;
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
public Tag id(Long id) {
|
||||
@ -33,7 +32,6 @@ public class Tag {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
public Tag name(String name) {
|
||||
@ -52,7 +50,6 @@ public class Tag {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
|
@ -21,7 +21,6 @@ public class User {
|
||||
private String phone = null;
|
||||
private Integer userStatus = null;
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
public User id(Long id) {
|
||||
@ -39,7 +38,6 @@ public class User {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
public User username(String username) {
|
||||
@ -57,7 +55,6 @@ public class User {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
public User firstName(String firstName) {
|
||||
@ -75,7 +72,6 @@ public class User {
|
||||
this.firstName = firstName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
public User lastName(String lastName) {
|
||||
@ -93,7 +89,6 @@ public class User {
|
||||
this.lastName = lastName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
public User email(String email) {
|
||||
@ -111,7 +106,6 @@ public class User {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
public User password(String password) {
|
||||
@ -129,7 +123,6 @@ public class User {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
public User phone(String phone) {
|
||||
@ -147,7 +140,6 @@ public class User {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* User Status
|
||||
**/
|
||||
@ -167,7 +159,6 @@ public class User {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
|
@ -15,7 +15,7 @@ public class Bootstrap extends HttpServlet {
|
||||
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")
|
||||
.description("This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.")
|
||||
.termsOfService("http://swagger.io/terms/")
|
||||
.contact(new Contact()
|
||||
.email("apiteam@swagger.io"))
|
||||
|
@ -23,7 +23,7 @@ import javax.ws.rs.core.SecurityContext;
|
||||
public class StoreApiServiceImpl extends StoreApiService {
|
||||
|
||||
@Override
|
||||
public Response deleteOrder(Long orderId, SecurityContext securityContext)
|
||||
public Response deleteOrder(String orderId, SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
// do some magic!
|
||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||
|
@ -1,23 +1,37 @@
|
||||
---
|
||||
swagger: "2.0"
|
||||
info:
|
||||
description: "This is a sample server Petstore server.\n\n[Learn about Swagger](http://swagger.io)\
|
||||
\ or join the IRC channel `#swagger` on irc.freenode.net.\n\nFor this sample,\
|
||||
\ you can use the api key `special-key` to test the authorization filters\n"
|
||||
description: "This is a sample server Petstore server. You can find out more about\
|
||||
\ Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/).\
|
||||
\ 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:
|
||||
name: "apiteam@swagger.io"
|
||||
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"
|
||||
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:
|
||||
/pets:
|
||||
/pet:
|
||||
post:
|
||||
tags:
|
||||
- "pet"
|
||||
@ -28,13 +42,13 @@ paths:
|
||||
- "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:
|
||||
@ -42,8 +56,8 @@ paths:
|
||||
description: "Invalid input"
|
||||
security:
|
||||
- petstore_auth:
|
||||
- "write_pets"
|
||||
- "read_pets"
|
||||
- "write:pets"
|
||||
- "read:pets"
|
||||
x-swagger-router-controller: "Pet"
|
||||
put:
|
||||
tags:
|
||||
@ -55,13 +69,13 @@ paths:
|
||||
- "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:
|
||||
@ -73,28 +87,33 @@ paths:
|
||||
description: "Validation exception"
|
||||
security:
|
||||
- petstore_auth:
|
||||
- "write_pets"
|
||||
- "read_pets"
|
||||
- "write:pets"
|
||||
- "read:pets"
|
||||
x-swagger-router-controller: "Pet"
|
||||
/pets/findByStatus:
|
||||
/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"
|
||||
collectionFormat: "multi"
|
||||
default: "available"
|
||||
enum:
|
||||
- "available"
|
||||
- "pending"
|
||||
- "sold"
|
||||
collectionFormat: "csv"
|
||||
responses:
|
||||
200:
|
||||
description: "successful operation"
|
||||
@ -106,29 +125,29 @@ paths:
|
||||
description: "Invalid status value"
|
||||
security:
|
||||
- petstore_auth:
|
||||
- "write_pets"
|
||||
- "read_pets"
|
||||
- "write:pets"
|
||||
- "read:pets"
|
||||
x-swagger-router-controller: "Pet"
|
||||
/pets/findByTags:
|
||||
/pet/findByTags:
|
||||
get:
|
||||
tags:
|
||||
- "pet"
|
||||
summary: "Finds Pets by tags"
|
||||
description: "Muliple tags can be provided with comma seperated strings. Use\
|
||||
description: "Multiple tags can be provided with comma separated strings. Use\
|
||||
\ tag1, tag2, tag3 for testing."
|
||||
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"
|
||||
collectionFormat: "multi"
|
||||
collectionFormat: "csv"
|
||||
responses:
|
||||
200:
|
||||
description: "successful operation"
|
||||
@ -140,24 +159,23 @@ paths:
|
||||
description: "Invalid tag value"
|
||||
security:
|
||||
- petstore_auth:
|
||||
- "write_pets"
|
||||
- "read_pets"
|
||||
- "write:pets"
|
||||
- "read:pets"
|
||||
x-swagger-router-controller: "Pet"
|
||||
/pets/{petId}:
|
||||
/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"
|
||||
@ -172,9 +190,6 @@ paths:
|
||||
description: "Pet not found"
|
||||
security:
|
||||
- api_key: []
|
||||
- petstore_auth:
|
||||
- "write_pets"
|
||||
- "read_pets"
|
||||
x-swagger-router-controller: "Pet"
|
||||
post:
|
||||
tags:
|
||||
@ -185,31 +200,32 @@ paths:
|
||||
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"
|
||||
required: true
|
||||
required: false
|
||||
type: "string"
|
||||
- name: "status"
|
||||
in: "formData"
|
||||
description: "Updated status of the pet"
|
||||
required: true
|
||||
required: false
|
||||
type: "string"
|
||||
responses:
|
||||
405:
|
||||
description: "Invalid input"
|
||||
security:
|
||||
- petstore_auth:
|
||||
- "write_pets"
|
||||
- "read_pets"
|
||||
- "write:pets"
|
||||
- "read:pets"
|
||||
x-swagger-router-controller: "Pet"
|
||||
delete:
|
||||
tags:
|
||||
@ -218,13 +234,12 @@ paths:
|
||||
description: ""
|
||||
operationId: "deletePet"
|
||||
produces:
|
||||
- "application/json"
|
||||
- "application/xml"
|
||||
- "application/json"
|
||||
parameters:
|
||||
- name: "api_key"
|
||||
in: "header"
|
||||
description: ""
|
||||
required: true
|
||||
required: false
|
||||
type: "string"
|
||||
- name: "petId"
|
||||
in: "path"
|
||||
@ -237,10 +252,69 @@ paths:
|
||||
description: "Invalid pet value"
|
||||
security:
|
||||
- petstore_auth:
|
||||
- "write_pets"
|
||||
- "read_pets"
|
||||
- "write:pets"
|
||||
- "read:pets"
|
||||
x-swagger-router-controller: "Pet"
|
||||
/stores/order:
|
||||
/pet/{petId}/uploadImage:
|
||||
post:
|
||||
tags:
|
||||
- "pet"
|
||||
summary: "uploads an image"
|
||||
description: ""
|
||||
operationId: "uploadFile"
|
||||
consumes:
|
||||
- "multipart/form-data"
|
||||
produces:
|
||||
- "application/json"
|
||||
parameters:
|
||||
- name: "petId"
|
||||
in: "path"
|
||||
description: "ID of pet to update"
|
||||
required: true
|
||||
type: "integer"
|
||||
format: "int64"
|
||||
- name: "additionalMetadata"
|
||||
in: "formData"
|
||||
description: "Additional data to pass to server"
|
||||
required: false
|
||||
type: "string"
|
||||
- name: "file"
|
||||
in: "formData"
|
||||
description: "file to upload"
|
||||
required: false
|
||||
type: "file"
|
||||
responses:
|
||||
200:
|
||||
description: "successful operation"
|
||||
schema:
|
||||
$ref: "#/definitions/ApiResponse"
|
||||
security:
|
||||
- petstore_auth:
|
||||
- "write:pets"
|
||||
- "read:pets"
|
||||
x-swagger-router-controller: "Pet"
|
||||
/store/inventory:
|
||||
get:
|
||||
tags:
|
||||
- "store"
|
||||
summary: "Returns pet inventories by status"
|
||||
description: "Returns a map of status codes to quantities"
|
||||
operationId: "getInventory"
|
||||
produces:
|
||||
- "application/json"
|
||||
parameters: []
|
||||
responses:
|
||||
200:
|
||||
description: "successful operation"
|
||||
schema:
|
||||
type: "object"
|
||||
additionalProperties:
|
||||
type: "integer"
|
||||
format: "int32"
|
||||
security:
|
||||
- api_key: []
|
||||
x-swagger-router-controller: "Store"
|
||||
/store/order:
|
||||
post:
|
||||
tags:
|
||||
- "store"
|
||||
@ -248,13 +322,13 @@ paths:
|
||||
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:
|
||||
@ -265,7 +339,7 @@ paths:
|
||||
400:
|
||||
description: "Invalid Order"
|
||||
x-swagger-router-controller: "Store"
|
||||
/stores/order/{orderId}:
|
||||
/store/order/{orderId}:
|
||||
get:
|
||||
tags:
|
||||
- "store"
|
||||
@ -274,14 +348,17 @@ paths:
|
||||
\ values will generated exceptions"
|
||||
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: 5
|
||||
minimum: 1
|
||||
format: "int64"
|
||||
responses:
|
||||
200:
|
||||
description: "successful operation"
|
||||
@ -300,21 +377,22 @@ paths:
|
||||
\ above 1000 or nonintegers 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"
|
||||
minimum: 1
|
||||
responses:
|
||||
400:
|
||||
description: "Invalid ID supplied"
|
||||
404:
|
||||
description: "Order not found"
|
||||
x-swagger-router-controller: "Store"
|
||||
/users:
|
||||
/user:
|
||||
post:
|
||||
tags:
|
||||
- "user"
|
||||
@ -322,20 +400,20 @@ 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"
|
||||
/users/createWithArray:
|
||||
/user/createWithArray:
|
||||
post:
|
||||
tags:
|
||||
- "user"
|
||||
@ -343,13 +421,13 @@ paths:
|
||||
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:
|
||||
@ -358,7 +436,7 @@ paths:
|
||||
default:
|
||||
description: "successful operation"
|
||||
x-swagger-router-controller: "User"
|
||||
/users/createWithList:
|
||||
/user/createWithList:
|
||||
post:
|
||||
tags:
|
||||
- "user"
|
||||
@ -366,13 +444,13 @@ paths:
|
||||
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:
|
||||
@ -381,7 +459,7 @@ paths:
|
||||
default:
|
||||
description: "successful operation"
|
||||
x-swagger-router-controller: "User"
|
||||
/users/login:
|
||||
/user/login:
|
||||
get:
|
||||
tags:
|
||||
- "user"
|
||||
@ -389,28 +467,37 @@ paths:
|
||||
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 toekn expires"
|
||||
400:
|
||||
description: "Invalid username/password supplied"
|
||||
x-swagger-router-controller: "User"
|
||||
/users/logout:
|
||||
/user/logout:
|
||||
get:
|
||||
tags:
|
||||
- "user"
|
||||
@ -418,14 +505,14 @@ paths:
|
||||
description: ""
|
||||
operationId: "logoutUser"
|
||||
produces:
|
||||
- "application/json"
|
||||
- "application/xml"
|
||||
- "application/json"
|
||||
parameters: []
|
||||
responses:
|
||||
default:
|
||||
description: "successful operation"
|
||||
x-swagger-router-controller: "User"
|
||||
/users/{username}:
|
||||
/user/{username}:
|
||||
get:
|
||||
tags:
|
||||
- "user"
|
||||
@ -433,12 +520,12 @@ paths:
|
||||
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:
|
||||
@ -458,8 +545,8 @@ 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"
|
||||
@ -469,7 +556,7 @@ paths:
|
||||
- in: "body"
|
||||
name: "body"
|
||||
description: "Updated user object"
|
||||
required: false
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/User"
|
||||
responses:
|
||||
@ -485,8 +572,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"
|
||||
@ -509,9 +596,46 @@ securityDefinitions:
|
||||
authorizationUrl: "http://petstore.swagger.io/api/oauth/dialog"
|
||||
flow: "implicit"
|
||||
scopes:
|
||||
write_pets: "modify pets in your account"
|
||||
read_pets: "read your pets"
|
||||
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"
|
||||
Category:
|
||||
type: "object"
|
||||
properties:
|
||||
id:
|
||||
type: "integer"
|
||||
format: "int64"
|
||||
name:
|
||||
type: "string"
|
||||
xml:
|
||||
name: "Category"
|
||||
User:
|
||||
type: "object"
|
||||
properties:
|
||||
@ -534,7 +658,9 @@ definitions:
|
||||
type: "integer"
|
||||
format: "int32"
|
||||
description: "User Status"
|
||||
Category:
|
||||
xml:
|
||||
name: "User"
|
||||
Tag:
|
||||
type: "object"
|
||||
properties:
|
||||
id:
|
||||
@ -542,6 +668,8 @@ definitions:
|
||||
format: "int64"
|
||||
name:
|
||||
type: "string"
|
||||
xml:
|
||||
name: "Tag"
|
||||
Pet:
|
||||
type: "object"
|
||||
required:
|
||||
@ -558,40 +686,37 @@ definitions:
|
||||
example: "doggie"
|
||||
photoUrls:
|
||||
type: "array"
|
||||
xml:
|
||||
name: "photoUrl"
|
||||
wrapped: true
|
||||
items:
|
||||
type: "string"
|
||||
tags:
|
||||
type: "array"
|
||||
xml:
|
||||
name: "tag"
|
||||
wrapped: true
|
||||
items:
|
||||
$ref: "#/definitions/Tag"
|
||||
status:
|
||||
type: "string"
|
||||
description: "pet status in the store"
|
||||
Tag:
|
||||
enum:
|
||||
- "available"
|
||||
- "pending"
|
||||
- "sold"
|
||||
xml:
|
||||
name: "Pet"
|
||||
ApiResponse:
|
||||
type: "object"
|
||||
properties:
|
||||
id:
|
||||
type: "integer"
|
||||
format: "int64"
|
||||
name:
|
||||
type: "string"
|
||||
Order:
|
||||
type: "object"
|
||||
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"
|
||||
complete:
|
||||
type: "boolean"
|
||||
externalDocs:
|
||||
description: "Find out more about Swagger"
|
||||
url: "http://swagger.io"
|
||||
|
@ -33,3 +33,7 @@ module.exports.updatePet = function updatePet (req, 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);
|
||||
};
|
||||
|
@ -12,8 +12,8 @@ exports.addPet = function(args, res, next) {
|
||||
exports.deletePet = function(args, res, next) {
|
||||
/**
|
||||
* parameters expected in the args:
|
||||
* apiKey (String)
|
||||
* petId (Long)
|
||||
* apiKey (String)
|
||||
**/
|
||||
// no response value expected for this operation
|
||||
res.end();
|
||||
@ -121,7 +121,7 @@ exports.updatePet = function(args, res, next) {
|
||||
exports.updatePetWithForm = function(args, res, next) {
|
||||
/**
|
||||
* parameters expected in the args:
|
||||
* petId (String)
|
||||
* petId (Long)
|
||||
* name (String)
|
||||
* status (String)
|
||||
**/
|
||||
@ -129,3 +129,26 @@ exports.updatePetWithForm = function(args, res, next) {
|
||||
res.end();
|
||||
}
|
||||
|
||||
exports.uploadFile = function(args, res, next) {
|
||||
/**
|
||||
* parameters expected in the args:
|
||||
* petId (Long)
|
||||
* additionalMetadata (String)
|
||||
* file (file)
|
||||
**/
|
||||
var examples = {};
|
||||
examples['application/json'] = {
|
||||
"message" : "aeiou",
|
||||
"code" : 123,
|
||||
"type" : "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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -10,6 +10,10 @@ module.exports.deleteOrder = function deleteOrder (req, res, next) {
|
||||
Store.deleteOrder(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);
|
||||
};
|
||||
|
@ -9,10 +9,28 @@ exports.deleteOrder = function(args, res, next) {
|
||||
res.end();
|
||||
}
|
||||
|
||||
exports.getInventory = function(args, res, next) {
|
||||
/**
|
||||
* parameters expected in the args:
|
||||
**/
|
||||
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));
|
||||
}
|
||||
else {
|
||||
res.end();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.getOrderById = function(args, res, next) {
|
||||
/**
|
||||
* parameters expected in the args:
|
||||
* orderId (String)
|
||||
* orderId (Long)
|
||||
**/
|
||||
var examples = {};
|
||||
examples['application/json'] = {
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "swagger-petstore",
|
||||
"version": "1.0.0",
|
||||
"description": "This is a sample server Petstore server.\n\n[Learn about Swagger](http://swagger.io) or join the IRC channel `#swagger` on irc.freenode.net.\n\nFor this sample, you can use the api key `special-key` to test the authorization filters\n",
|
||||
"description": "This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.",
|
||||
"main": "index.js",
|
||||
"keywords": [
|
||||
"swagger"
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
## Overview
|
||||
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
|
||||
[OpenAPI-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:
|
||||
|
@ -1,6 +1,6 @@
|
||||
import com.wordnik.client.api._
|
||||
import akka.actor.ActorSystem
|
||||
import io.swagger.app.{ResourcesApp, SwaggerApp}
|
||||
import io.swagger.app.{ ResourcesApp, SwaggerApp }
|
||||
import javax.servlet.ServletContext
|
||||
import org.scalatra.LifeCycle
|
||||
|
||||
@ -10,9 +10,9 @@ class ScalatraBootstrap extends LifeCycle {
|
||||
override def init(context: ServletContext) {
|
||||
implicit val system = ActorSystem("appActorSystem")
|
||||
try {
|
||||
context mount (new UserApi, "/User/*")
|
||||
context mount (new PetApi, "/Pet/*")
|
||||
context mount (new StoreApi, "/Store/*")
|
||||
context mount (new UserApi, "/User/*")
|
||||
|
||||
context mount (new ResourcesApp, "/api-docs/*")
|
||||
} catch {
|
||||
|
@ -3,26 +3,26 @@ package io.swagger.app
|
||||
import _root_.akka.actor.ActorSystem
|
||||
|
||||
import org.scalatra.swagger.{ ApiInfo, SwaggerWithAuth, Swagger }
|
||||
import org.scalatra.swagger.{JacksonSwaggerBase, Swagger}
|
||||
import org.scalatra.swagger.{ JacksonSwaggerBase, Swagger }
|
||||
import org.scalatra.ScalatraServlet
|
||||
import org.json4s.{DefaultFormats, Formats}
|
||||
import org.json4s.{ DefaultFormats, Formats }
|
||||
|
||||
class ResourcesApp(implicit protected val system: ActorSystem, val swagger: SwaggerApp)
|
||||
extends ScalatraServlet with JacksonSwaggerBase {
|
||||
extends ScalatraServlet with JacksonSwaggerBase {
|
||||
before() {
|
||||
response.headers += ("Access-Control-Allow-Origin" -> "*")
|
||||
}
|
||||
|
||||
protected def buildFullUrl(path: String) = if (path.startsWith("http")) path else {
|
||||
val port = request.getServerPort
|
||||
val h = request.getServerName
|
||||
val prot = if (port == 443) "https" else "http"
|
||||
val (proto, host) = if (port != 80 && port != 443) ("http", h+":"+port.toString) else (prot, h)
|
||||
"%s://%s%s%s".format(
|
||||
proto,
|
||||
host,
|
||||
request.getContextPath,
|
||||
path)
|
||||
val port = request.getServerPort
|
||||
val h = request.getServerName
|
||||
val prot = if (port == 443) "https" else "http"
|
||||
val (proto, host) = if (port != 80 && port != 443) ("http", h + ":" + port.toString) else (prot, h)
|
||||
"%s://%s%s%s".format(
|
||||
proto,
|
||||
host,
|
||||
request.getContextPath,
|
||||
path)
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,7 +31,7 @@ class SwaggerApp extends Swagger(apiInfo = ApiSwagger.apiInfo, apiVersion = "1.0
|
||||
object ApiSwagger {
|
||||
val apiInfo = ApiInfo(
|
||||
"""Swagger Petstore""",
|
||||
"""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""",
|
||||
"""This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.""",
|
||||
"""""",
|
||||
"""apiteam@swagger.io""",
|
||||
"""Apache 2.0""",
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.wordnik.client.api
|
||||
|
||||
import com.wordnik.client.model.Pet
|
||||
import com.wordnik.client.model.ApiResponse
|
||||
import java.io.File
|
||||
|
||||
import java.io.File
|
||||
@ -29,156 +30,16 @@ class PetApi (implicit val swagger: Swagger) extends ScalatraServlet
|
||||
}
|
||||
|
||||
|
||||
val updatePetOperation = (apiOperation[Unit]("updatePet")
|
||||
summary "Update an existing pet"
|
||||
parameters(bodyParam[Pet]("body").description("").optional)
|
||||
)
|
||||
|
||||
put("/pet",operation(updatePetOperation)) {
|
||||
|
||||
|
||||
|
||||
|
||||
bodyParam[Pet]("body").description("").optional
|
||||
|
||||
println("body: " + body)
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
val addPetOperation = (apiOperation[Unit]("addPet")
|
||||
summary "Add a new pet to the store"
|
||||
parameters(bodyParam[Pet]("body").description("").optional)
|
||||
parameters(bodyParam[Pet]("body").description(""))
|
||||
)
|
||||
|
||||
post("/pet",operation(addPetOperation)) {
|
||||
|
||||
|
||||
|
||||
|
||||
bodyParam[Pet]("body").description("").optional
|
||||
|
||||
bodyParam[Pet]("body").description("")
|
||||
println("body: " + body)
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
val findPetsByStatusOperation = (apiOperation[List[Pet]]("findPetsByStatus")
|
||||
summary "Finds Pets by status"
|
||||
parameters(queryParam[List[String]]("status").description("").optional.defaultValue(available))
|
||||
)
|
||||
|
||||
get("/pet/findByStatus",operation(findPetsByStatusOperation)) {
|
||||
|
||||
|
||||
|
||||
|
||||
val statusString = params.getAs[String]("status")
|
||||
val status = if("multi".equals("default")) {
|
||||
statusString match {
|
||||
case Some(str) => str.split(",")
|
||||
case None => List()
|
||||
}
|
||||
}
|
||||
else
|
||||
List()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
println("status: " + status)
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
val findPetsByTagsOperation = (apiOperation[List[Pet]]("findPetsByTags")
|
||||
summary "Finds Pets by tags"
|
||||
parameters(queryParam[List[String]]("tags").description("").optional)
|
||||
)
|
||||
|
||||
get("/pet/findByTags",operation(findPetsByTagsOperation)) {
|
||||
|
||||
|
||||
|
||||
|
||||
val tagsString = params.getAs[String]("tags")
|
||||
val tags = if("multi".equals("default")) {
|
||||
tagsString match {
|
||||
case Some(str) => str.split(",")
|
||||
case None => List()
|
||||
}
|
||||
}
|
||||
else
|
||||
List()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
println("tags: " + tags)
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
val getPetByIdOperation = (apiOperation[Pet]("getPetById")
|
||||
summary "Find pet by ID"
|
||||
parameters(pathParam[Long]("petId").description(""))
|
||||
)
|
||||
|
||||
get("/pet/{petId}",operation(getPetByIdOperation)) {
|
||||
|
||||
|
||||
|
||||
val petId = params.getOrElse("petId", halt(400))
|
||||
|
||||
|
||||
|
||||
println("petId: " + petId)
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
val updatePetWithFormOperation = (apiOperation[Unit]("updatePetWithForm")
|
||||
summary "Updates a pet in the store with form data"
|
||||
parameters(pathParam[String]("petId").description(""),
|
||||
formParam[String]("name").description("").optional,
|
||||
formParam[String]("status").description("").optional)
|
||||
)
|
||||
|
||||
post("/pet/{petId}",operation(updatePetWithFormOperation)) {
|
||||
|
||||
|
||||
|
||||
val petId = params.getOrElse("petId", halt(400))
|
||||
|
||||
|
||||
|
||||
println("petId: " + petId)
|
||||
|
||||
|
||||
|
||||
|
||||
val name = params.getAs[String]("name")
|
||||
|
||||
|
||||
|
||||
println("name: " + name)
|
||||
|
||||
|
||||
|
||||
|
||||
val status = params.getAs[String]("status")
|
||||
|
||||
|
||||
|
||||
println("status: " + status)
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -192,27 +53,123 @@ bodyParam[Pet]("body").description("").optional
|
||||
delete("/pet/{petId}",operation(deletePetOperation)) {
|
||||
|
||||
|
||||
|
||||
val petId = params.getOrElse("petId", halt(400))
|
||||
|
||||
|
||||
|
||||
println("petId: " + petId)
|
||||
|
||||
|
||||
|
||||
|
||||
val apiKey = request.getHeader("apiKey")
|
||||
|
||||
|
||||
val apiKey = request.getHeader("apiKey")
|
||||
|
||||
println("apiKey: " + apiKey)
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
val uploadFileOperation = (apiOperation[Unit]("uploadFile")
|
||||
val findPetsByStatusOperation = (apiOperation[List[Pet]]("findPetsByStatus")
|
||||
summary "Finds Pets by status"
|
||||
parameters(queryParam[List[String]]("status").description(""))
|
||||
)
|
||||
|
||||
get("/pet/findByStatus",operation(findPetsByStatusOperation)) {
|
||||
|
||||
|
||||
val statusString = params.getAs[String]("status")
|
||||
val status = if("csv".equals("default")) {
|
||||
statusString match {
|
||||
case Some(str) => str.split(",")
|
||||
case None => List()
|
||||
}
|
||||
}
|
||||
else
|
||||
List()
|
||||
|
||||
|
||||
println("status: " + status)
|
||||
}
|
||||
|
||||
|
||||
|
||||
val findPetsByTagsOperation = (apiOperation[List[Pet]]("findPetsByTags")
|
||||
summary "Finds Pets by tags"
|
||||
parameters(queryParam[List[String]]("tags").description(""))
|
||||
)
|
||||
|
||||
get("/pet/findByTags",operation(findPetsByTagsOperation)) {
|
||||
|
||||
|
||||
val tagsString = params.getAs[String]("tags")
|
||||
val tags = if("csv".equals("default")) {
|
||||
tagsString match {
|
||||
case Some(str) => str.split(",")
|
||||
case None => List()
|
||||
}
|
||||
}
|
||||
else
|
||||
List()
|
||||
|
||||
|
||||
println("tags: " + tags)
|
||||
}
|
||||
|
||||
|
||||
|
||||
val getPetByIdOperation = (apiOperation[Pet]("getPetById")
|
||||
summary "Find pet by ID"
|
||||
parameters(pathParam[Long]("petId").description(""))
|
||||
)
|
||||
|
||||
get("/pet/{petId}",operation(getPetByIdOperation)) {
|
||||
|
||||
|
||||
val petId = params.getOrElse("petId", halt(400))
|
||||
|
||||
println("petId: " + petId)
|
||||
}
|
||||
|
||||
|
||||
|
||||
val updatePetOperation = (apiOperation[Unit]("updatePet")
|
||||
summary "Update an existing pet"
|
||||
parameters(bodyParam[Pet]("body").description(""))
|
||||
)
|
||||
|
||||
put("/pet",operation(updatePetOperation)) {
|
||||
|
||||
|
||||
bodyParam[Pet]("body").description("")
|
||||
println("body: " + body)
|
||||
}
|
||||
|
||||
|
||||
|
||||
val updatePetWithFormOperation = (apiOperation[Unit]("updatePetWithForm")
|
||||
summary "Updates a pet in the store with form data"
|
||||
parameters(pathParam[Long]("petId").description(""),
|
||||
formParam[String]("name").description("").optional,
|
||||
formParam[String]("status").description("").optional)
|
||||
)
|
||||
|
||||
post("/pet/{petId}",operation(updatePetWithFormOperation)) {
|
||||
|
||||
|
||||
val petId = params.getOrElse("petId", halt(400))
|
||||
|
||||
println("petId: " + petId)
|
||||
|
||||
|
||||
val name = params.getAs[String]("name")
|
||||
|
||||
println("name: " + name)
|
||||
|
||||
|
||||
val status = params.getAs[String]("status")
|
||||
|
||||
println("status: " + status)
|
||||
}
|
||||
|
||||
|
||||
|
||||
val uploadFileOperation = (apiOperation[ApiResponse]("uploadFile")
|
||||
summary "uploads an image"
|
||||
parameters(pathParam[Long]("petId").description(""),
|
||||
formParam[String]("additionalMetadata").description("").optional,
|
||||
@ -222,26 +179,16 @@ bodyParam[Pet]("body").description("").optional
|
||||
post("/pet/{petId}/uploadImage",operation(uploadFileOperation)) {
|
||||
|
||||
|
||||
|
||||
val petId = params.getOrElse("petId", halt(400))
|
||||
|
||||
|
||||
|
||||
println("petId: " + petId)
|
||||
|
||||
|
||||
|
||||
|
||||
val additionalMetadata = params.getAs[String]("additionalMetadata")
|
||||
|
||||
|
||||
val additionalMetadata = params.getAs[String]("additionalMetadata")
|
||||
|
||||
println("additionalMetadata: " + additionalMetadata)
|
||||
|
||||
val file = fileParams("file")
|
||||
|
||||
println("file: " + file)
|
||||
|
||||
println("file: " + file)
|
||||
}
|
||||
|
||||
}
|
@ -9,11 +9,11 @@ import org.scalatra.swagger._
|
||||
import org.json4s._
|
||||
import org.json4s.JsonDSL._
|
||||
import org.scalatra.json.{ JValueResult, JacksonJsonSupport }
|
||||
import org.scalatra.servlet.{FileUploadSupport, MultipartConfig, SizeConstraintExceededException}
|
||||
import org.scalatra.servlet.{ FileUploadSupport, MultipartConfig, SizeConstraintExceededException }
|
||||
|
||||
import scala.collection.JavaConverters._
|
||||
|
||||
class StoreApi (implicit val swagger: Swagger) extends ScalatraServlet
|
||||
class StoreApi(implicit val swagger: Swagger) extends ScalatraServlet
|
||||
with FileUploadSupport
|
||||
with JacksonJsonSupport
|
||||
with SwaggerSupport {
|
||||
@ -27,70 +27,47 @@ class StoreApi (implicit val swagger: Swagger) extends ScalatraServlet
|
||||
response.headers += ("Access-Control-Allow-Origin" -> "*")
|
||||
}
|
||||
|
||||
val deleteOrderOperation = (apiOperation[Unit]("deleteOrder")
|
||||
summary "Delete purchase order by ID"
|
||||
parameters (pathParam[String]("orderId").description(""))
|
||||
)
|
||||
|
||||
delete("/store/order/{orderId}", operation(deleteOrderOperation)) {
|
||||
|
||||
val orderId = params.getOrElse("orderId", halt(400))
|
||||
|
||||
println("orderId: " + orderId)
|
||||
}
|
||||
|
||||
val getInventoryOperation = (apiOperation[Map[String, Int]]("getInventory")
|
||||
summary "Returns pet inventories by status"
|
||||
parameters()
|
||||
summary "Returns pet inventories by status"
|
||||
parameters ()
|
||||
)
|
||||
|
||||
get("/store/inventory",operation(getInventoryOperation)) {
|
||||
|
||||
get("/store/inventory", operation(getInventoryOperation)) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
val placeOrderOperation = (apiOperation[Order]("placeOrder")
|
||||
summary "Place an order for a pet"
|
||||
parameters(bodyParam[Order]("body").description("").optional)
|
||||
)
|
||||
|
||||
post("/store/order",operation(placeOrderOperation)) {
|
||||
|
||||
|
||||
|
||||
|
||||
bodyParam[Order]("body").description("").optional
|
||||
|
||||
println("body: " + body)
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
val getOrderByIdOperation = (apiOperation[Order]("getOrderById")
|
||||
summary "Find purchase order by ID"
|
||||
parameters(pathParam[String]("orderId").description(""))
|
||||
summary "Find purchase order by ID"
|
||||
parameters (pathParam[Long]("orderId").description(""))
|
||||
)
|
||||
|
||||
get("/store/order/{orderId}",operation(getOrderByIdOperation)) {
|
||||
|
||||
|
||||
|
||||
val orderId = params.getOrElse("orderId", halt(400))
|
||||
|
||||
get("/store/order/{orderId}", operation(getOrderByIdOperation)) {
|
||||
|
||||
val orderId = params.getOrElse("orderId", halt(400))
|
||||
|
||||
println("orderId: " + orderId)
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
val deleteOrderOperation = (apiOperation[Unit]("deleteOrder")
|
||||
summary "Delete purchase order by ID"
|
||||
parameters(pathParam[String]("orderId").description(""))
|
||||
val placeOrderOperation = (apiOperation[Order]("placeOrder")
|
||||
summary "Place an order for a pet"
|
||||
parameters (bodyParam[Order]("body").description(""))
|
||||
)
|
||||
|
||||
delete("/store/order/{orderId}",operation(deleteOrderOperation)) {
|
||||
|
||||
|
||||
|
||||
val orderId = params.getOrElse("orderId", halt(400))
|
||||
|
||||
|
||||
|
||||
println("orderId: " + orderId)
|
||||
post("/store/order", operation(placeOrderOperation)) {
|
||||
|
||||
bodyParam[Order]("body").description("")
|
||||
println("body: " + body)
|
||||
}
|
||||
|
||||
}
|
@ -9,11 +9,11 @@ import org.scalatra.swagger._
|
||||
import org.json4s._
|
||||
import org.json4s.JsonDSL._
|
||||
import org.scalatra.json.{ JValueResult, JacksonJsonSupport }
|
||||
import org.scalatra.servlet.{FileUploadSupport, MultipartConfig, SizeConstraintExceededException}
|
||||
import org.scalatra.servlet.{ FileUploadSupport, MultipartConfig, SizeConstraintExceededException }
|
||||
|
||||
import scala.collection.JavaConverters._
|
||||
|
||||
class UserApi (implicit val swagger: Swagger) extends ScalatraServlet
|
||||
class UserApi(implicit val swagger: Swagger) extends ScalatraServlet
|
||||
with FileUploadSupport
|
||||
with JacksonJsonSupport
|
||||
with SwaggerSupport {
|
||||
@ -27,165 +27,102 @@ class UserApi (implicit val swagger: Swagger) extends ScalatraServlet
|
||||
response.headers += ("Access-Control-Allow-Origin" -> "*")
|
||||
}
|
||||
|
||||
|
||||
val createUserOperation = (apiOperation[Unit]("createUser")
|
||||
summary "Create user"
|
||||
parameters(bodyParam[User]("body").description("").optional)
|
||||
summary "Create user"
|
||||
parameters (bodyParam[User]("body").description(""))
|
||||
)
|
||||
|
||||
post("/user",operation(createUserOperation)) {
|
||||
|
||||
|
||||
|
||||
|
||||
bodyParam[User]("body").description("").optional
|
||||
post("/user", operation(createUserOperation)) {
|
||||
|
||||
bodyParam[User]("body").description("")
|
||||
println("body: " + body)
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
val createUsersWithArrayInputOperation = (apiOperation[Unit]("createUsersWithArrayInput")
|
||||
summary "Creates list of users with given input array"
|
||||
parameters(bodyParam[List[User]]("body").description("").optional)
|
||||
summary "Creates list of users with given input array"
|
||||
parameters (bodyParam[List[User]]("body").description(""))
|
||||
)
|
||||
|
||||
post("/user/createWithArray",operation(createUsersWithArrayInputOperation)) {
|
||||
|
||||
|
||||
|
||||
|
||||
bodyParam[List[User]]("body").description("").optional
|
||||
post("/user/createWithArray", operation(createUsersWithArrayInputOperation)) {
|
||||
|
||||
bodyParam[List[User]]("body").description("")
|
||||
println("body: " + body)
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
val createUsersWithListInputOperation = (apiOperation[Unit]("createUsersWithListInput")
|
||||
summary "Creates list of users with given input array"
|
||||
parameters(bodyParam[List[User]]("body").description("").optional)
|
||||
summary "Creates list of users with given input array"
|
||||
parameters (bodyParam[List[User]]("body").description(""))
|
||||
)
|
||||
|
||||
post("/user/createWithList",operation(createUsersWithListInputOperation)) {
|
||||
|
||||
|
||||
|
||||
|
||||
bodyParam[List[User]]("body").description("").optional
|
||||
post("/user/createWithList", operation(createUsersWithListInputOperation)) {
|
||||
|
||||
bodyParam[List[User]]("body").description("")
|
||||
println("body: " + body)
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
val loginUserOperation = (apiOperation[String]("loginUser")
|
||||
summary "Logs user into the system"
|
||||
parameters(queryParam[String]("username").description("").optional,
|
||||
queryParam[String]("password").description("").optional)
|
||||
)
|
||||
|
||||
get("/user/login",operation(loginUserOperation)) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
val username = params.getAs[String]("username")
|
||||
|
||||
|
||||
|
||||
println("username: " + username)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
val password = params.getAs[String]("password")
|
||||
|
||||
|
||||
|
||||
println("password: " + password)
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
val logoutUserOperation = (apiOperation[Unit]("logoutUser")
|
||||
summary "Logs out current logged in user session"
|
||||
parameters()
|
||||
)
|
||||
|
||||
get("/user/logout",operation(logoutUserOperation)) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
val getUserByNameOperation = (apiOperation[User]("getUserByName")
|
||||
summary "Get user by user name"
|
||||
parameters(pathParam[String]("username").description(""))
|
||||
)
|
||||
|
||||
get("/user/{username}",operation(getUserByNameOperation)) {
|
||||
|
||||
|
||||
|
||||
val username = params.getOrElse("username", halt(400))
|
||||
|
||||
|
||||
|
||||
println("username: " + username)
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
val updateUserOperation = (apiOperation[Unit]("updateUser")
|
||||
summary "Updated user"
|
||||
parameters(pathParam[String]("username").description(""),
|
||||
bodyParam[User]("body").description("").optional)
|
||||
)
|
||||
|
||||
put("/user/{username}",operation(updateUserOperation)) {
|
||||
|
||||
|
||||
|
||||
val username = params.getOrElse("username", halt(400))
|
||||
|
||||
|
||||
|
||||
println("username: " + username)
|
||||
|
||||
|
||||
|
||||
|
||||
bodyParam[User]("body").description("").optional
|
||||
|
||||
println("body: " + body)
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
val deleteUserOperation = (apiOperation[Unit]("deleteUser")
|
||||
summary "Delete user"
|
||||
parameters(pathParam[String]("username").description(""))
|
||||
summary "Delete user"
|
||||
parameters (pathParam[String]("username").description(""))
|
||||
)
|
||||
|
||||
delete("/user/{username}",operation(deleteUserOperation)) {
|
||||
delete("/user/{username}", operation(deleteUserOperation)) {
|
||||
|
||||
val username = params.getOrElse("username", halt(400))
|
||||
|
||||
println("username: " + username)
|
||||
}
|
||||
|
||||
val username = params.getOrElse("username", halt(400))
|
||||
val getUserByNameOperation = (apiOperation[User]("getUserByName")
|
||||
summary "Get user by user name"
|
||||
parameters (pathParam[String]("username").description(""))
|
||||
)
|
||||
|
||||
get("/user/{username}", operation(getUserByNameOperation)) {
|
||||
|
||||
val username = params.getOrElse("username", halt(400))
|
||||
|
||||
println("username: " + username)
|
||||
}
|
||||
|
||||
val loginUserOperation = (apiOperation[String]("loginUser")
|
||||
summary "Logs user into the system"
|
||||
parameters (queryParam[String]("username").description(""),
|
||||
queryParam[String]("password").description(""))
|
||||
)
|
||||
|
||||
get("/user/login", operation(loginUserOperation)) {
|
||||
|
||||
val username = params.getAs[String]("username")
|
||||
|
||||
println("username: " + username)
|
||||
|
||||
val password = params.getAs[String]("password")
|
||||
|
||||
println("password: " + password)
|
||||
}
|
||||
|
||||
val logoutUserOperation = (apiOperation[Unit]("logoutUser")
|
||||
summary "Logs out current logged in user session"
|
||||
parameters ()
|
||||
)
|
||||
|
||||
get("/user/logout", operation(logoutUserOperation)) {
|
||||
}
|
||||
|
||||
val updateUserOperation = (apiOperation[Unit]("updateUser")
|
||||
summary "Updated user"
|
||||
parameters (pathParam[String]("username").description(""),
|
||||
bodyParam[User]("body").description(""))
|
||||
)
|
||||
|
||||
put("/user/{username}", operation(updateUserOperation)) {
|
||||
|
||||
val username = params.getOrElse("username", halt(400))
|
||||
|
||||
println("username: " + username)
|
||||
|
||||
bodyParam[User]("body").description("")
|
||||
println("body: " + body)
|
||||
}
|
||||
|
||||
}
|
@ -1,8 +1,5 @@
|
||||
package com.wordnik.client.model
|
||||
|
||||
|
||||
|
||||
case class Category (
|
||||
id: Long,
|
||||
name: String
|
||||
)
|
||||
case class Category(
|
||||
id: Option[Long],
|
||||
name: Option[String])
|
||||
|
@ -2,12 +2,10 @@ package com.wordnik.client.model
|
||||
|
||||
import java.util.Date
|
||||
|
||||
|
||||
case class Order (
|
||||
id: Long,
|
||||
petId: Long,
|
||||
quantity: Int,
|
||||
shipDate: Date,
|
||||
status: String,
|
||||
complete: Boolean
|
||||
)
|
||||
case class Order(
|
||||
id: Option[Long],
|
||||
petId: Option[Long],
|
||||
quantity: Option[Int],
|
||||
shipDate: Option[Date],
|
||||
status: Option[String], // Order Status
|
||||
complete: Option[Boolean])
|
||||
|
@ -3,12 +3,11 @@ package com.wordnik.client.model
|
||||
import com.wordnik.client.model.Category
|
||||
import com.wordnik.client.model.Tag
|
||||
|
||||
|
||||
case class Pet (
|
||||
id: Long,
|
||||
category: Category,
|
||||
case class Pet(
|
||||
id: Option[Long],
|
||||
category: Option[Category],
|
||||
name: String,
|
||||
photoUrls: List[String],
|
||||
tags: List[Tag],
|
||||
status: String
|
||||
)
|
||||
tags: Option[List[Tag]],
|
||||
status: Option[String] // pet status in the store
|
||||
)
|
||||
|
@ -1,8 +1,5 @@
|
||||
package com.wordnik.client.model
|
||||
|
||||
|
||||
|
||||
case class Tag (
|
||||
id: Long,
|
||||
name: String
|
||||
)
|
||||
case class Tag(
|
||||
id: Option[Long],
|
||||
name: Option[String])
|
||||
|
@ -1,14 +1,12 @@
|
||||
package com.wordnik.client.model
|
||||
|
||||
|
||||
|
||||
case class User (
|
||||
id: Long,
|
||||
username: String,
|
||||
firstName: String,
|
||||
lastName: String,
|
||||
email: String,
|
||||
password: String,
|
||||
phone: String,
|
||||
userStatus: Int
|
||||
)
|
||||
case class User(
|
||||
id: Option[Long],
|
||||
username: Option[String],
|
||||
firstName: Option[String],
|
||||
lastName: Option[String],
|
||||
email: Option[String],
|
||||
password: Option[String],
|
||||
phone: Option[String],
|
||||
userStatus: Option[Int] // User Status
|
||||
)
|
||||
|
@ -8,85 +8,6 @@ use Silex\Application;
|
||||
$app = new Silex\Application();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$app->POST('/user', function(Application $app, Request $request) {
|
||||
|
||||
|
||||
return new Response('How about implementing createUser as a POST method ?');
|
||||
});
|
||||
|
||||
|
||||
|
||||
$app->POST('/user/createWithArray', function(Application $app, Request $request) {
|
||||
|
||||
|
||||
return new Response('How about implementing createUsersWithArrayInput as a POST method ?');
|
||||
});
|
||||
|
||||
|
||||
|
||||
$app->POST('/user/createWithList', function(Application $app, Request $request) {
|
||||
|
||||
|
||||
return new Response('How about implementing createUsersWithListInput as a POST method ?');
|
||||
});
|
||||
|
||||
|
||||
|
||||
$app->GET('/user/login', function(Application $app, Request $request) {
|
||||
$username = $request->get('username'); $password = $request->get('password');
|
||||
|
||||
return new Response('How about implementing loginUser as a GET method ?');
|
||||
});
|
||||
|
||||
|
||||
|
||||
$app->GET('/user/logout', function(Application $app, Request $request) {
|
||||
|
||||
|
||||
return new Response('How about implementing logoutUser as a GET method ?');
|
||||
});
|
||||
|
||||
|
||||
|
||||
$app->GET('/user/{username}', function(Application $app, Request $request, $username) {
|
||||
|
||||
|
||||
return new Response('How about implementing getUserByName as a GET method ?');
|
||||
});
|
||||
|
||||
|
||||
|
||||
$app->PUT('/user/{username}', function(Application $app, Request $request, $username) {
|
||||
|
||||
|
||||
return new Response('How about implementing updateUser as a PUT method ?');
|
||||
});
|
||||
|
||||
|
||||
|
||||
$app->DELETE('/user/{username}', function(Application $app, Request $request, $username) {
|
||||
|
||||
|
||||
return new Response('How about implementing deleteUser as a DELETE method ?');
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$app->PUT('/pet', function(Application $app, Request $request) {
|
||||
|
||||
|
||||
return new Response('How about implementing updatePet as a PUT method ?');
|
||||
});
|
||||
|
||||
|
||||
|
||||
$app->POST('/pet', function(Application $app, Request $request) {
|
||||
|
||||
|
||||
@ -94,39 +15,6 @@ $app->POST('/pet', function(Application $app, Request $request) {
|
||||
});
|
||||
|
||||
|
||||
|
||||
$app->GET('/pet/findByStatus', function(Application $app, Request $request) {
|
||||
$status = $request->get('status');
|
||||
|
||||
return new Response('How about implementing findPetsByStatus as a GET method ?');
|
||||
});
|
||||
|
||||
|
||||
|
||||
$app->GET('/pet/findByTags', function(Application $app, Request $request) {
|
||||
$tags = $request->get('tags');
|
||||
|
||||
return new Response('How about implementing findPetsByTags as a GET method ?');
|
||||
});
|
||||
|
||||
|
||||
|
||||
$app->GET('/pet/{petId}', function(Application $app, Request $request, $pet_id) {
|
||||
|
||||
|
||||
return new Response('How about implementing getPetById as a GET method ?');
|
||||
});
|
||||
|
||||
|
||||
|
||||
$app->POST('/pet/{petId}', function(Application $app, Request $request, $pet_id) {
|
||||
|
||||
$name = $request->get('name'); $status = $request->get('status');
|
||||
return new Response('How about implementing updatePetWithForm as a POST method ?');
|
||||
});
|
||||
|
||||
|
||||
|
||||
$app->DELETE('/pet/{petId}', function(Application $app, Request $request, $pet_id) {
|
||||
|
||||
|
||||
@ -134,6 +22,40 @@ $app->DELETE('/pet/{petId}', function(Application $app, Request $request, $pet_i
|
||||
});
|
||||
|
||||
|
||||
$app->GET('/pet/findByStatus', function(Application $app, Request $request) {
|
||||
$status = $request->get('status');
|
||||
|
||||
return new Response('How about implementing findPetsByStatus as a GET method ?');
|
||||
});
|
||||
|
||||
|
||||
$app->GET('/pet/findByTags', function(Application $app, Request $request) {
|
||||
$tags = $request->get('tags');
|
||||
|
||||
return new Response('How about implementing findPetsByTags as a GET method ?');
|
||||
});
|
||||
|
||||
|
||||
$app->GET('/pet/{petId}', function(Application $app, Request $request, $pet_id) {
|
||||
|
||||
|
||||
return new Response('How about implementing getPetById as a GET method ?');
|
||||
});
|
||||
|
||||
|
||||
$app->PUT('/pet', function(Application $app, Request $request) {
|
||||
|
||||
|
||||
return new Response('How about implementing updatePet as a PUT method ?');
|
||||
});
|
||||
|
||||
|
||||
$app->POST('/pet/{petId}', function(Application $app, Request $request, $pet_id) {
|
||||
|
||||
$name = $request->get('name'); $status = $request->get('status');
|
||||
return new Response('How about implementing updatePetWithForm as a POST method ?');
|
||||
});
|
||||
|
||||
|
||||
$app->POST('/pet/{petId}/uploadImage', function(Application $app, Request $request, $pet_id) {
|
||||
|
||||
@ -142,51 +64,6 @@ $app->POST('/pet/{petId}/uploadImage', function(Application $app, Request $reque
|
||||
});
|
||||
|
||||
|
||||
|
||||
$app->GET('/pet/{petId}?testing_byte_array=true', function(Application $app, Request $request, $pet_id) {
|
||||
|
||||
|
||||
return new Response('How about implementing getPetByIdWithByteArray as a GET method ?');
|
||||
});
|
||||
|
||||
|
||||
|
||||
$app->POST('/pet?testing_byte_array=true', function(Application $app, Request $request) {
|
||||
|
||||
|
||||
return new Response('How about implementing addPetUsingByteArray as a POST method ?');
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$app->GET('/store/inventory', function(Application $app, Request $request) {
|
||||
|
||||
|
||||
return new Response('How about implementing getInventory as a GET method ?');
|
||||
});
|
||||
|
||||
|
||||
|
||||
$app->POST('/store/order', function(Application $app, Request $request) {
|
||||
|
||||
|
||||
return new Response('How about implementing placeOrder as a POST method ?');
|
||||
});
|
||||
|
||||
|
||||
|
||||
$app->GET('/store/order/{orderId}', function(Application $app, Request $request, $order_id) {
|
||||
|
||||
|
||||
return new Response('How about implementing getOrderById as a GET method ?');
|
||||
});
|
||||
|
||||
|
||||
|
||||
$app->DELETE('/store/order/{orderId}', function(Application $app, Request $request, $order_id) {
|
||||
|
||||
|
||||
@ -194,7 +71,81 @@ $app->DELETE('/store/order/{orderId}', function(Application $app, Request $reque
|
||||
});
|
||||
|
||||
|
||||
$app->GET('/store/inventory', function(Application $app, Request $request) {
|
||||
|
||||
|
||||
return new Response('How about implementing getInventory as a GET method ?');
|
||||
});
|
||||
|
||||
|
||||
$app->GET('/store/order/{orderId}', function(Application $app, Request $request, $order_id) {
|
||||
|
||||
|
||||
return new Response('How about implementing getOrderById as a GET method ?');
|
||||
});
|
||||
|
||||
|
||||
$app->POST('/store/order', function(Application $app, Request $request) {
|
||||
|
||||
|
||||
return new Response('How about implementing placeOrder as a POST method ?');
|
||||
});
|
||||
|
||||
|
||||
$app->POST('/user', function(Application $app, Request $request) {
|
||||
|
||||
|
||||
return new Response('How about implementing createUser as a POST method ?');
|
||||
});
|
||||
|
||||
|
||||
$app->POST('/user/createWithArray', function(Application $app, Request $request) {
|
||||
|
||||
|
||||
return new Response('How about implementing createUsersWithArrayInput as a POST method ?');
|
||||
});
|
||||
|
||||
|
||||
$app->POST('/user/createWithList', function(Application $app, Request $request) {
|
||||
|
||||
|
||||
return new Response('How about implementing createUsersWithListInput as a POST method ?');
|
||||
});
|
||||
|
||||
|
||||
$app->DELETE('/user/{username}', function(Application $app, Request $request, $username) {
|
||||
|
||||
|
||||
return new Response('How about implementing deleteUser as a DELETE method ?');
|
||||
});
|
||||
|
||||
|
||||
$app->GET('/user/{username}', function(Application $app, Request $request, $username) {
|
||||
|
||||
|
||||
return new Response('How about implementing getUserByName as a GET method ?');
|
||||
});
|
||||
|
||||
|
||||
$app->GET('/user/login', function(Application $app, Request $request) {
|
||||
$username = $request->get('username'); $password = $request->get('password');
|
||||
|
||||
return new Response('How about implementing loginUser as a GET method ?');
|
||||
});
|
||||
|
||||
|
||||
$app->GET('/user/logout', function(Application $app, Request $request) {
|
||||
|
||||
|
||||
return new Response('How about implementing logoutUser as a GET method ?');
|
||||
});
|
||||
|
||||
|
||||
$app->PUT('/user/{username}', function(Application $app, Request $request, $username) {
|
||||
|
||||
|
||||
return new Response('How about implementing updateUser as a PUT method ?');
|
||||
});
|
||||
|
||||
|
||||
$app->run();
|
||||
|
@ -1,25 +1,20 @@
|
||||
require 'json'
|
||||
|
||||
|
||||
MyApp.add_route('POST', '/v2/pets', {
|
||||
MyApp.add_route('POST', '/v2/pet', {
|
||||
"resourcePath" => "/Pet",
|
||||
"summary" => "Add a new pet to the store",
|
||||
"nickname" => "add_pet",
|
||||
"responseClass" => "void",
|
||||
"endpoint" => "/pets",
|
||||
"endpoint" => "/pet",
|
||||
"notes" => "",
|
||||
"parameters" => [
|
||||
|
||||
|
||||
|
||||
|
||||
{
|
||||
"name" => "body",
|
||||
"description" => "Pet object that needs to be added to the store",
|
||||
"dataType" => "Pet",
|
||||
"paramType" => "body",
|
||||
}
|
||||
|
||||
]}) do
|
||||
cross_origin
|
||||
# the guts live here
|
||||
@ -28,32 +23,26 @@ MyApp.add_route('POST', '/v2/pets', {
|
||||
end
|
||||
|
||||
|
||||
MyApp.add_route('DELETE', '/v2/pets/{petId}', {
|
||||
MyApp.add_route('DELETE', '/v2/pet/{petId}', {
|
||||
"resourcePath" => "/Pet",
|
||||
"summary" => "Deletes a pet",
|
||||
"nickname" => "delete_pet",
|
||||
"responseClass" => "void",
|
||||
"endpoint" => "/pets/{petId}",
|
||||
"endpoint" => "/pet/{petId}",
|
||||
"notes" => "",
|
||||
"parameters" => [
|
||||
|
||||
|
||||
{
|
||||
"name" => "pet_id",
|
||||
"description" => "Pet id to delete",
|
||||
"dataType" => "int",
|
||||
"paramType" => "path",
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
"name" => "api_key",
|
||||
"description" => "",
|
||||
"dataType" => "string",
|
||||
"paramType" => "header",
|
||||
},
|
||||
|
||||
|
||||
]}) do
|
||||
cross_origin
|
||||
# the guts live here
|
||||
@ -62,28 +51,23 @@ MyApp.add_route('DELETE', '/v2/pets/{petId}', {
|
||||
end
|
||||
|
||||
|
||||
MyApp.add_route('GET', '/v2/pets/findByStatus', {
|
||||
MyApp.add_route('GET', '/v2/pet/findByStatus', {
|
||||
"resourcePath" => "/Pet",
|
||||
"summary" => "Finds Pets by status",
|
||||
"nickname" => "find_pets_by_status",
|
||||
"responseClass" => "array[Pet]",
|
||||
"endpoint" => "/pets/findByStatus",
|
||||
"notes" => "Multiple status values can be provided with comma seperated strings",
|
||||
"endpoint" => "/pet/findByStatus",
|
||||
"notes" => "Multiple status values can be provided with comma separated strings",
|
||||
"parameters" => [
|
||||
|
||||
{
|
||||
"name" => "status",
|
||||
"description" => "Status values that need to be considered for filter",
|
||||
"dataType" => "array[string]",
|
||||
"paramType" => "query",
|
||||
"collectionFormat" => "multi",
|
||||
"collectionFormat" => "csv",
|
||||
"allowableValues" => "",
|
||||
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
]}) do
|
||||
cross_origin
|
||||
# the guts live here
|
||||
@ -92,28 +76,23 @@ MyApp.add_route('GET', '/v2/pets/findByStatus', {
|
||||
end
|
||||
|
||||
|
||||
MyApp.add_route('GET', '/v2/pets/findByTags', {
|
||||
MyApp.add_route('GET', '/v2/pet/findByTags', {
|
||||
"resourcePath" => "/Pet",
|
||||
"summary" => "Finds Pets by tags",
|
||||
"nickname" => "find_pets_by_tags",
|
||||
"responseClass" => "array[Pet]",
|
||||
"endpoint" => "/pets/findByTags",
|
||||
"notes" => "Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.",
|
||||
"endpoint" => "/pet/findByTags",
|
||||
"notes" => "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.",
|
||||
"parameters" => [
|
||||
|
||||
{
|
||||
"name" => "tags",
|
||||
"description" => "Tags to filter by",
|
||||
"dataType" => "array[string]",
|
||||
"paramType" => "query",
|
||||
"collectionFormat" => "multi",
|
||||
"collectionFormat" => "csv",
|
||||
"allowableValues" => "",
|
||||
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
]}) do
|
||||
cross_origin
|
||||
# the guts live here
|
||||
@ -122,25 +101,20 @@ MyApp.add_route('GET', '/v2/pets/findByTags', {
|
||||
end
|
||||
|
||||
|
||||
MyApp.add_route('GET', '/v2/pets/{petId}', {
|
||||
MyApp.add_route('GET', '/v2/pet/{petId}', {
|
||||
"resourcePath" => "/Pet",
|
||||
"summary" => "Find pet by ID",
|
||||
"nickname" => "get_pet_by_id",
|
||||
"responseClass" => "Pet",
|
||||
"endpoint" => "/pets/{petId}",
|
||||
"notes" => "Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions",
|
||||
"endpoint" => "/pet/{petId}",
|
||||
"notes" => "Returns a single pet",
|
||||
"parameters" => [
|
||||
|
||||
|
||||
{
|
||||
"name" => "pet_id",
|
||||
"description" => "ID of pet that needs to be fetched",
|
||||
"description" => "ID of pet to return",
|
||||
"dataType" => "int",
|
||||
"paramType" => "path",
|
||||
},
|
||||
|
||||
|
||||
|
||||
]}) do
|
||||
cross_origin
|
||||
# the guts live here
|
||||
@ -149,25 +123,20 @@ MyApp.add_route('GET', '/v2/pets/{petId}', {
|
||||
end
|
||||
|
||||
|
||||
MyApp.add_route('PUT', '/v2/pets', {
|
||||
MyApp.add_route('PUT', '/v2/pet', {
|
||||
"resourcePath" => "/Pet",
|
||||
"summary" => "Update an existing pet",
|
||||
"nickname" => "update_pet",
|
||||
"responseClass" => "void",
|
||||
"endpoint" => "/pets",
|
||||
"endpoint" => "/pet",
|
||||
"notes" => "",
|
||||
"parameters" => [
|
||||
|
||||
|
||||
|
||||
|
||||
{
|
||||
"name" => "body",
|
||||
"description" => "Pet object that needs to be added to the store",
|
||||
"dataType" => "Pet",
|
||||
"paramType" => "body",
|
||||
}
|
||||
|
||||
]}) do
|
||||
cross_origin
|
||||
# the guts live here
|
||||
@ -176,25 +145,42 @@ MyApp.add_route('PUT', '/v2/pets', {
|
||||
end
|
||||
|
||||
|
||||
MyApp.add_route('POST', '/v2/pets/{petId}', {
|
||||
MyApp.add_route('POST', '/v2/pet/{petId}', {
|
||||
"resourcePath" => "/Pet",
|
||||
"summary" => "Updates a pet in the store with form data",
|
||||
"nickname" => "update_pet_with_form",
|
||||
"responseClass" => "void",
|
||||
"endpoint" => "/pets/{petId}",
|
||||
"endpoint" => "/pet/{petId}",
|
||||
"notes" => "",
|
||||
"parameters" => [
|
||||
|
||||
|
||||
{
|
||||
"name" => "pet_id",
|
||||
"description" => "ID of pet that needs to be updated",
|
||||
"dataType" => "string",
|
||||
"dataType" => "int",
|
||||
"paramType" => "path",
|
||||
},
|
||||
]}) do
|
||||
cross_origin
|
||||
# the guts live here
|
||||
|
||||
{"message" => "yes, it worked"}.to_json
|
||||
end
|
||||
|
||||
|
||||
MyApp.add_route('POST', '/v2/pet/{petId}/uploadImage', {
|
||||
"resourcePath" => "/Pet",
|
||||
"summary" => "uploads an image",
|
||||
"nickname" => "upload_file",
|
||||
"responseClass" => "ApiResponse",
|
||||
"endpoint" => "/pet/{petId}/uploadImage",
|
||||
"notes" => "",
|
||||
"parameters" => [
|
||||
{
|
||||
"name" => "pet_id",
|
||||
"description" => "ID of pet to update",
|
||||
"dataType" => "int",
|
||||
"paramType" => "path",
|
||||
},
|
||||
|
||||
|
||||
|
||||
]}) do
|
||||
cross_origin
|
||||
# the guts live here
|
||||
|
@ -1,25 +1,20 @@
|
||||
require 'json'
|
||||
|
||||
|
||||
MyApp.add_route('DELETE', '/v2/stores/order/{orderId}', {
|
||||
MyApp.add_route('DELETE', '/v2/store/order/{orderId}', {
|
||||
"resourcePath" => "/Store",
|
||||
"summary" => "Delete purchase order by ID",
|
||||
"nickname" => "delete_order",
|
||||
"responseClass" => "void",
|
||||
"endpoint" => "/stores/order/{orderId}",
|
||||
"endpoint" => "/store/order/{orderId}",
|
||||
"notes" => "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors",
|
||||
"parameters" => [
|
||||
|
||||
|
||||
{
|
||||
"name" => "order_id",
|
||||
"description" => "ID of the order that needs to be deleted",
|
||||
"dataType" => "string",
|
||||
"paramType" => "path",
|
||||
},
|
||||
|
||||
|
||||
|
||||
]}) do
|
||||
cross_origin
|
||||
# the guts live here
|
||||
@ -28,25 +23,36 @@ MyApp.add_route('DELETE', '/v2/stores/order/{orderId}', {
|
||||
end
|
||||
|
||||
|
||||
MyApp.add_route('GET', '/v2/stores/order/{orderId}', {
|
||||
MyApp.add_route('GET', '/v2/store/inventory', {
|
||||
"resourcePath" => "/Store",
|
||||
"summary" => "Returns pet inventories by status",
|
||||
"nickname" => "get_inventory",
|
||||
"responseClass" => "map[string,int]",
|
||||
"endpoint" => "/store/inventory",
|
||||
"notes" => "Returns a map of status codes to quantities",
|
||||
"parameters" => [
|
||||
]}) do
|
||||
cross_origin
|
||||
# the guts live here
|
||||
|
||||
{"message" => "yes, it worked"}.to_json
|
||||
end
|
||||
|
||||
|
||||
MyApp.add_route('GET', '/v2/store/order/{orderId}', {
|
||||
"resourcePath" => "/Store",
|
||||
"summary" => "Find purchase order by ID",
|
||||
"nickname" => "get_order_by_id",
|
||||
"responseClass" => "Order",
|
||||
"endpoint" => "/stores/order/{orderId}",
|
||||
"endpoint" => "/store/order/{orderId}",
|
||||
"notes" => "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions",
|
||||
"parameters" => [
|
||||
|
||||
|
||||
{
|
||||
"name" => "order_id",
|
||||
"description" => "ID of pet that needs to be fetched",
|
||||
"dataType" => "string",
|
||||
"dataType" => "int",
|
||||
"paramType" => "path",
|
||||
},
|
||||
|
||||
|
||||
|
||||
]}) do
|
||||
cross_origin
|
||||
# the guts live here
|
||||
@ -55,25 +61,20 @@ MyApp.add_route('GET', '/v2/stores/order/{orderId}', {
|
||||
end
|
||||
|
||||
|
||||
MyApp.add_route('POST', '/v2/stores/order', {
|
||||
MyApp.add_route('POST', '/v2/store/order', {
|
||||
"resourcePath" => "/Store",
|
||||
"summary" => "Place an order for a pet",
|
||||
"nickname" => "place_order",
|
||||
"responseClass" => "Order",
|
||||
"endpoint" => "/stores/order",
|
||||
"endpoint" => "/store/order",
|
||||
"notes" => "",
|
||||
"parameters" => [
|
||||
|
||||
|
||||
|
||||
|
||||
{
|
||||
"name" => "body",
|
||||
"description" => "order placed for purchasing the pet",
|
||||
"dataType" => "Order",
|
||||
"paramType" => "body",
|
||||
}
|
||||
|
||||
]}) do
|
||||
cross_origin
|
||||
# the guts live here
|
||||
|
@ -1,25 +1,20 @@
|
||||
require 'json'
|
||||
|
||||
|
||||
MyApp.add_route('POST', '/v2/users', {
|
||||
MyApp.add_route('POST', '/v2/user', {
|
||||
"resourcePath" => "/User",
|
||||
"summary" => "Create user",
|
||||
"nickname" => "create_user",
|
||||
"responseClass" => "void",
|
||||
"endpoint" => "/users",
|
||||
"endpoint" => "/user",
|
||||
"notes" => "This can only be done by the logged in user.",
|
||||
"parameters" => [
|
||||
|
||||
|
||||
|
||||
|
||||
{
|
||||
"name" => "body",
|
||||
"description" => "Created user object",
|
||||
"dataType" => "User",
|
||||
"paramType" => "body",
|
||||
}
|
||||
|
||||
]}) do
|
||||
cross_origin
|
||||
# the guts live here
|
||||
@ -28,25 +23,20 @@ MyApp.add_route('POST', '/v2/users', {
|
||||
end
|
||||
|
||||
|
||||
MyApp.add_route('POST', '/v2/users/createWithArray', {
|
||||
MyApp.add_route('POST', '/v2/user/createWithArray', {
|
||||
"resourcePath" => "/User",
|
||||
"summary" => "Creates list of users with given input array",
|
||||
"nickname" => "create_users_with_array_input",
|
||||
"responseClass" => "void",
|
||||
"endpoint" => "/users/createWithArray",
|
||||
"endpoint" => "/user/createWithArray",
|
||||
"notes" => "",
|
||||
"parameters" => [
|
||||
|
||||
|
||||
|
||||
|
||||
{
|
||||
"name" => "body",
|
||||
"description" => "List of user object",
|
||||
"dataType" => "array[User]",
|
||||
"paramType" => "body",
|
||||
}
|
||||
|
||||
]}) do
|
||||
cross_origin
|
||||
# the guts live here
|
||||
@ -55,25 +45,20 @@ MyApp.add_route('POST', '/v2/users/createWithArray', {
|
||||
end
|
||||
|
||||
|
||||
MyApp.add_route('POST', '/v2/users/createWithList', {
|
||||
MyApp.add_route('POST', '/v2/user/createWithList', {
|
||||
"resourcePath" => "/User",
|
||||
"summary" => "Creates list of users with given input array",
|
||||
"nickname" => "create_users_with_list_input",
|
||||
"responseClass" => "void",
|
||||
"endpoint" => "/users/createWithList",
|
||||
"endpoint" => "/user/createWithList",
|
||||
"notes" => "",
|
||||
"parameters" => [
|
||||
|
||||
|
||||
|
||||
|
||||
{
|
||||
"name" => "body",
|
||||
"description" => "List of user object",
|
||||
"dataType" => "array[User]",
|
||||
"paramType" => "body",
|
||||
}
|
||||
|
||||
]}) do
|
||||
cross_origin
|
||||
# the guts live here
|
||||
@ -82,25 +67,20 @@ MyApp.add_route('POST', '/v2/users/createWithList', {
|
||||
end
|
||||
|
||||
|
||||
MyApp.add_route('DELETE', '/v2/users/{username}', {
|
||||
MyApp.add_route('DELETE', '/v2/user/{username}', {
|
||||
"resourcePath" => "/User",
|
||||
"summary" => "Delete user",
|
||||
"nickname" => "delete_user",
|
||||
"responseClass" => "void",
|
||||
"endpoint" => "/users/{username}",
|
||||
"endpoint" => "/user/{username}",
|
||||
"notes" => "This can only be done by the logged in user.",
|
||||
"parameters" => [
|
||||
|
||||
|
||||
{
|
||||
"name" => "username",
|
||||
"description" => "The name that needs to be deleted",
|
||||
"dataType" => "string",
|
||||
"paramType" => "path",
|
||||
},
|
||||
|
||||
|
||||
|
||||
]}) do
|
||||
cross_origin
|
||||
# the guts live here
|
||||
@ -109,25 +89,20 @@ MyApp.add_route('DELETE', '/v2/users/{username}', {
|
||||
end
|
||||
|
||||
|
||||
MyApp.add_route('GET', '/v2/users/{username}', {
|
||||
MyApp.add_route('GET', '/v2/user/{username}', {
|
||||
"resourcePath" => "/User",
|
||||
"summary" => "Get user by user name",
|
||||
"nickname" => "get_user_by_name",
|
||||
"responseClass" => "User",
|
||||
"endpoint" => "/users/{username}",
|
||||
"endpoint" => "/user/{username}",
|
||||
"notes" => "",
|
||||
"parameters" => [
|
||||
|
||||
|
||||
{
|
||||
"name" => "username",
|
||||
"description" => "The name that needs to be fetched. Use user1 for testing.",
|
||||
"description" => "The name that needs to be fetched. Use user1 for testing. ",
|
||||
"dataType" => "string",
|
||||
"paramType" => "path",
|
||||
},
|
||||
|
||||
|
||||
|
||||
]}) do
|
||||
cross_origin
|
||||
# the guts live here
|
||||
@ -136,15 +111,14 @@ MyApp.add_route('GET', '/v2/users/{username}', {
|
||||
end
|
||||
|
||||
|
||||
MyApp.add_route('GET', '/v2/users/login', {
|
||||
MyApp.add_route('GET', '/v2/user/login', {
|
||||
"resourcePath" => "/User",
|
||||
"summary" => "Logs user into the system",
|
||||
"nickname" => "login_user",
|
||||
"responseClass" => "string",
|
||||
"endpoint" => "/users/login",
|
||||
"endpoint" => "/user/login",
|
||||
"notes" => "",
|
||||
"parameters" => [
|
||||
|
||||
{
|
||||
"name" => "username",
|
||||
"description" => "The user name for login",
|
||||
@ -154,7 +128,6 @@ MyApp.add_route('GET', '/v2/users/login', {
|
||||
"allowableValues" => "",
|
||||
|
||||
},
|
||||
|
||||
{
|
||||
"name" => "password",
|
||||
"description" => "The password for login in clear text",
|
||||
@ -164,10 +137,6 @@ MyApp.add_route('GET', '/v2/users/login', {
|
||||
"allowableValues" => "",
|
||||
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
]}) do
|
||||
cross_origin
|
||||
# the guts live here
|
||||
@ -176,18 +145,14 @@ MyApp.add_route('GET', '/v2/users/login', {
|
||||
end
|
||||
|
||||
|
||||
MyApp.add_route('GET', '/v2/users/logout', {
|
||||
MyApp.add_route('GET', '/v2/user/logout', {
|
||||
"resourcePath" => "/User",
|
||||
"summary" => "Logs out current logged in user session",
|
||||
"nickname" => "logout_user",
|
||||
"responseClass" => "void",
|
||||
"endpoint" => "/users/logout",
|
||||
"endpoint" => "/user/logout",
|
||||
"notes" => "",
|
||||
"parameters" => [
|
||||
|
||||
|
||||
|
||||
|
||||
]}) do
|
||||
cross_origin
|
||||
# the guts live here
|
||||
@ -196,32 +161,26 @@ MyApp.add_route('GET', '/v2/users/logout', {
|
||||
end
|
||||
|
||||
|
||||
MyApp.add_route('PUT', '/v2/users/{username}', {
|
||||
MyApp.add_route('PUT', '/v2/user/{username}', {
|
||||
"resourcePath" => "/User",
|
||||
"summary" => "Updated user",
|
||||
"nickname" => "update_user",
|
||||
"responseClass" => "void",
|
||||
"endpoint" => "/users/{username}",
|
||||
"endpoint" => "/user/{username}",
|
||||
"notes" => "This can only be done by the logged in user.",
|
||||
"parameters" => [
|
||||
|
||||
|
||||
{
|
||||
"name" => "username",
|
||||
"description" => "name that need to be deleted",
|
||||
"dataType" => "string",
|
||||
"paramType" => "path",
|
||||
},
|
||||
|
||||
|
||||
|
||||
{
|
||||
"name" => "body",
|
||||
"description" => "Updated user object",
|
||||
"dataType" => "User",
|
||||
"paramType" => "body",
|
||||
}
|
||||
|
||||
]}) do
|
||||
cross_origin
|
||||
# the guts live here
|
||||
|
@ -1,23 +1,37 @@
|
||||
---
|
||||
swagger: "2.0"
|
||||
info:
|
||||
description: "This is a sample server Petstore server.\n\n[Learn about Swagger](http://swagger.io)\
|
||||
\ or join the IRC channel `#swagger` on irc.freenode.net.\n\nFor this sample,\
|
||||
\ you can use the api key `special-key` to test the authorization filters\n"
|
||||
description: "This is a sample server Petstore server. You can find out more about\
|
||||
\ Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/).\
|
||||
\ 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://helloreverb.com/terms/"
|
||||
termsOfService: "http://swagger.io/terms/"
|
||||
contact:
|
||||
name: "apiteam@swagger.io"
|
||||
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"
|
||||
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:
|
||||
/pets:
|
||||
/pet:
|
||||
post:
|
||||
tags:
|
||||
- "pet"
|
||||
@ -28,13 +42,13 @@ paths:
|
||||
- "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:
|
||||
@ -42,8 +56,8 @@ paths:
|
||||
description: "Invalid input"
|
||||
security:
|
||||
- petstore_auth:
|
||||
- "write_pets"
|
||||
- "read_pets"
|
||||
- "write:pets"
|
||||
- "read:pets"
|
||||
put:
|
||||
tags:
|
||||
- "pet"
|
||||
@ -54,13 +68,13 @@ paths:
|
||||
- "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:
|
||||
@ -72,27 +86,32 @@ paths:
|
||||
description: "Validation exception"
|
||||
security:
|
||||
- petstore_auth:
|
||||
- "write_pets"
|
||||
- "read_pets"
|
||||
/pets/findByStatus:
|
||||
- "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"
|
||||
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"
|
||||
collectionFormat: "multi"
|
||||
default: "available"
|
||||
enum:
|
||||
- "available"
|
||||
- "pending"
|
||||
- "sold"
|
||||
collectionFormat: "csv"
|
||||
responses:
|
||||
200:
|
||||
description: "successful operation"
|
||||
@ -104,28 +123,28 @@ paths:
|
||||
description: "Invalid status value"
|
||||
security:
|
||||
- petstore_auth:
|
||||
- "write_pets"
|
||||
- "read_pets"
|
||||
/pets/findByTags:
|
||||
- "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\
|
||||
description: "Multiple tags can be provided with comma separated strings. Use\
|
||||
\ tag1, tag2, tag3 for testing."
|
||||
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"
|
||||
collectionFormat: "multi"
|
||||
collectionFormat: "csv"
|
||||
responses:
|
||||
200:
|
||||
description: "successful operation"
|
||||
@ -137,23 +156,22 @@ paths:
|
||||
description: "Invalid tag value"
|
||||
security:
|
||||
- petstore_auth:
|
||||
- "write_pets"
|
||||
- "read_pets"
|
||||
/pets/{petId}:
|
||||
- "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"
|
||||
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"
|
||||
@ -168,9 +186,6 @@ paths:
|
||||
description: "Pet not found"
|
||||
security:
|
||||
- api_key: []
|
||||
- petstore_auth:
|
||||
- "write_pets"
|
||||
- "read_pets"
|
||||
post:
|
||||
tags:
|
||||
- "pet"
|
||||
@ -180,31 +195,32 @@ paths:
|
||||
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"
|
||||
required: true
|
||||
required: false
|
||||
type: "string"
|
||||
- name: "status"
|
||||
in: "formData"
|
||||
description: "Updated status of the pet"
|
||||
required: true
|
||||
required: false
|
||||
type: "string"
|
||||
responses:
|
||||
405:
|
||||
description: "Invalid input"
|
||||
security:
|
||||
- petstore_auth:
|
||||
- "write_pets"
|
||||
- "read_pets"
|
||||
- "write:pets"
|
||||
- "read:pets"
|
||||
delete:
|
||||
tags:
|
||||
- "pet"
|
||||
@ -212,13 +228,12 @@ paths:
|
||||
description: ""
|
||||
operationId: "deletePet"
|
||||
produces:
|
||||
- "application/json"
|
||||
- "application/xml"
|
||||
- "application/json"
|
||||
parameters:
|
||||
- name: "api_key"
|
||||
in: "header"
|
||||
description: ""
|
||||
required: true
|
||||
required: false
|
||||
type: "string"
|
||||
- name: "petId"
|
||||
in: "path"
|
||||
@ -231,9 +246,66 @@ paths:
|
||||
description: "Invalid pet value"
|
||||
security:
|
||||
- petstore_auth:
|
||||
- "write_pets"
|
||||
- "read_pets"
|
||||
/stores/order:
|
||||
- "write:pets"
|
||||
- "read:pets"
|
||||
/pet/{petId}/uploadImage:
|
||||
post:
|
||||
tags:
|
||||
- "pet"
|
||||
summary: "uploads an image"
|
||||
description: ""
|
||||
operationId: "uploadFile"
|
||||
consumes:
|
||||
- "multipart/form-data"
|
||||
produces:
|
||||
- "application/json"
|
||||
parameters:
|
||||
- name: "petId"
|
||||
in: "path"
|
||||
description: "ID of pet to update"
|
||||
required: true
|
||||
type: "integer"
|
||||
format: "int64"
|
||||
- name: "additionalMetadata"
|
||||
in: "formData"
|
||||
description: "Additional data to pass to server"
|
||||
required: false
|
||||
type: "string"
|
||||
- name: "file"
|
||||
in: "formData"
|
||||
description: "file to upload"
|
||||
required: false
|
||||
type: "file"
|
||||
responses:
|
||||
200:
|
||||
description: "successful operation"
|
||||
schema:
|
||||
$ref: "#/definitions/ApiResponse"
|
||||
security:
|
||||
- petstore_auth:
|
||||
- "write:pets"
|
||||
- "read:pets"
|
||||
/store/inventory:
|
||||
get:
|
||||
tags:
|
||||
- "store"
|
||||
summary: "Returns pet inventories by status"
|
||||
description: "Returns a map of status codes to quantities"
|
||||
operationId: "getInventory"
|
||||
produces:
|
||||
- "application/json"
|
||||
parameters: []
|
||||
responses:
|
||||
200:
|
||||
description: "successful operation"
|
||||
schema:
|
||||
type: "object"
|
||||
additionalProperties:
|
||||
type: "integer"
|
||||
format: "int32"
|
||||
security:
|
||||
- api_key: []
|
||||
/store/order:
|
||||
post:
|
||||
tags:
|
||||
- "store"
|
||||
@ -241,13 +313,13 @@ paths:
|
||||
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:
|
||||
@ -257,7 +329,7 @@ paths:
|
||||
$ref: "#/definitions/Order"
|
||||
400:
|
||||
description: "Invalid Order"
|
||||
/stores/order/{orderId}:
|
||||
/store/order/{orderId}:
|
||||
get:
|
||||
tags:
|
||||
- "store"
|
||||
@ -266,14 +338,17 @@ paths:
|
||||
\ values will generated exceptions"
|
||||
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: 5.0
|
||||
minimum: 1.0
|
||||
format: "int64"
|
||||
responses:
|
||||
200:
|
||||
description: "successful operation"
|
||||
@ -291,20 +366,21 @@ paths:
|
||||
\ above 1000 or nonintegers 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"
|
||||
minimum: 1.0
|
||||
responses:
|
||||
400:
|
||||
description: "Invalid ID supplied"
|
||||
404:
|
||||
description: "Order not found"
|
||||
/users:
|
||||
/user:
|
||||
post:
|
||||
tags:
|
||||
- "user"
|
||||
@ -312,19 +388,19 @@ 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"
|
||||
/users/createWithArray:
|
||||
/user/createWithArray:
|
||||
post:
|
||||
tags:
|
||||
- "user"
|
||||
@ -332,13 +408,13 @@ paths:
|
||||
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:
|
||||
@ -346,7 +422,7 @@ paths:
|
||||
responses:
|
||||
default:
|
||||
description: "successful operation"
|
||||
/users/createWithList:
|
||||
/user/createWithList:
|
||||
post:
|
||||
tags:
|
||||
- "user"
|
||||
@ -354,13 +430,13 @@ paths:
|
||||
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:
|
||||
@ -368,7 +444,7 @@ paths:
|
||||
responses:
|
||||
default:
|
||||
description: "successful operation"
|
||||
/users/login:
|
||||
/user/login:
|
||||
get:
|
||||
tags:
|
||||
- "user"
|
||||
@ -376,27 +452,36 @@ paths:
|
||||
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 toekn expires"
|
||||
400:
|
||||
description: "Invalid username/password supplied"
|
||||
/users/logout:
|
||||
/user/logout:
|
||||
get:
|
||||
tags:
|
||||
- "user"
|
||||
@ -404,13 +489,13 @@ paths:
|
||||
description: ""
|
||||
operationId: "logoutUser"
|
||||
produces:
|
||||
- "application/json"
|
||||
- "application/xml"
|
||||
- "application/json"
|
||||
parameters: []
|
||||
responses:
|
||||
default:
|
||||
description: "successful operation"
|
||||
/users/{username}:
|
||||
/user/{username}:
|
||||
get:
|
||||
tags:
|
||||
- "user"
|
||||
@ -418,12 +503,12 @@ paths:
|
||||
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:
|
||||
@ -442,8 +527,8 @@ 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"
|
||||
@ -453,7 +538,7 @@ paths:
|
||||
- in: "body"
|
||||
name: "body"
|
||||
description: "Updated user object"
|
||||
required: false
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/User"
|
||||
responses:
|
||||
@ -468,8 +553,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"
|
||||
@ -491,9 +576,46 @@ securityDefinitions:
|
||||
authorizationUrl: "http://petstore.swagger.io/api/oauth/dialog"
|
||||
flow: "implicit"
|
||||
scopes:
|
||||
write_pets: "modify pets in your account"
|
||||
read_pets: "read your pets"
|
||||
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"
|
||||
Category:
|
||||
type: "object"
|
||||
properties:
|
||||
id:
|
||||
type: "integer"
|
||||
format: "int64"
|
||||
name:
|
||||
type: "string"
|
||||
xml:
|
||||
name: "Category"
|
||||
User:
|
||||
type: "object"
|
||||
properties:
|
||||
@ -516,7 +638,9 @@ definitions:
|
||||
type: "integer"
|
||||
format: "int32"
|
||||
description: "User Status"
|
||||
Category:
|
||||
xml:
|
||||
name: "User"
|
||||
Tag:
|
||||
type: "object"
|
||||
properties:
|
||||
id:
|
||||
@ -524,6 +648,8 @@ definitions:
|
||||
format: "int64"
|
||||
name:
|
||||
type: "string"
|
||||
xml:
|
||||
name: "Tag"
|
||||
Pet:
|
||||
type: "object"
|
||||
required:
|
||||
@ -540,40 +666,37 @@ definitions:
|
||||
example: "doggie"
|
||||
photoUrls:
|
||||
type: "array"
|
||||
xml:
|
||||
name: "photoUrl"
|
||||
wrapped: true
|
||||
items:
|
||||
type: "string"
|
||||
tags:
|
||||
type: "array"
|
||||
xml:
|
||||
name: "tag"
|
||||
wrapped: true
|
||||
items:
|
||||
$ref: "#/definitions/Tag"
|
||||
status:
|
||||
type: "string"
|
||||
description: "pet status in the store"
|
||||
Tag:
|
||||
enum:
|
||||
- "available"
|
||||
- "pending"
|
||||
- "sold"
|
||||
xml:
|
||||
name: "Pet"
|
||||
ApiResponse:
|
||||
type: "object"
|
||||
properties:
|
||||
id:
|
||||
type: "integer"
|
||||
format: "int64"
|
||||
name:
|
||||
type: "string"
|
||||
Order:
|
||||
type: "object"
|
||||
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"
|
||||
complete:
|
||||
type: "boolean"
|
||||
externalDocs:
|
||||
description: "Find out more about Swagger"
|
||||
url: "http://swagger.io"
|
||||
|
@ -9,11 +9,205 @@ require_once __DIR__ . '/vendor/autoload.php';
|
||||
$app = new Slim\App();
|
||||
|
||||
|
||||
/**
|
||||
* POST addPet
|
||||
* Summary: Add a new pet to the store
|
||||
* Notes:
|
||||
* Output-Formats: [application/xml, application/json]
|
||||
*/
|
||||
$app->POST('/pet', function($request, $response, $args) {
|
||||
|
||||
|
||||
|
||||
$body = $request->getParsedBody();
|
||||
$response->write('How about implementing addPet as a POST method ?');
|
||||
return $response;
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* DELETE deletePet
|
||||
* Summary: Deletes a pet
|
||||
* Notes:
|
||||
* Output-Formats: [application/xml, application/json]
|
||||
*/
|
||||
$app->DELETE('/pet/{petId}', function($request, $response, $args) {
|
||||
$headers = $request->getHeaders();
|
||||
|
||||
|
||||
|
||||
$response->write('How about implementing deletePet as a DELETE method ?');
|
||||
return $response;
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* GET findPetsByStatus
|
||||
* Summary: Finds Pets by status
|
||||
* Notes: Multiple status values can be provided with comma separated strings
|
||||
* Output-Formats: [application/xml, application/json]
|
||||
*/
|
||||
$app->GET('/pet/findByStatus', function($request, $response, $args) {
|
||||
|
||||
$queryParams = $request->getQueryParams();
|
||||
$status = $queryParams['status'];
|
||||
|
||||
|
||||
$response->write('How about implementing findPetsByStatus as a GET method ?');
|
||||
return $response;
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* GET findPetsByTags
|
||||
* Summary: Finds Pets by tags
|
||||
* Notes: Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||
* Output-Formats: [application/xml, application/json]
|
||||
*/
|
||||
$app->GET('/pet/findByTags', function($request, $response, $args) {
|
||||
|
||||
$queryParams = $request->getQueryParams();
|
||||
$tags = $queryParams['tags'];
|
||||
|
||||
|
||||
$response->write('How about implementing findPetsByTags as a GET method ?');
|
||||
return $response;
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* GET getPetById
|
||||
* Summary: Find pet by ID
|
||||
* Notes: Returns a single pet
|
||||
* Output-Formats: [application/xml, application/json]
|
||||
*/
|
||||
$app->GET('/pet/{petId}', function($request, $response, $args) {
|
||||
|
||||
|
||||
|
||||
|
||||
$response->write('How about implementing getPetById as a GET method ?');
|
||||
return $response;
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* PUT updatePet
|
||||
* Summary: Update an existing pet
|
||||
* Notes:
|
||||
* Output-Formats: [application/xml, application/json]
|
||||
*/
|
||||
$app->PUT('/pet', function($request, $response, $args) {
|
||||
|
||||
|
||||
|
||||
$body = $request->getParsedBody();
|
||||
$response->write('How about implementing updatePet as a PUT method ?');
|
||||
return $response;
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* POST updatePetWithForm
|
||||
* Summary: Updates a pet in the store with form data
|
||||
* Notes:
|
||||
* Output-Formats: [application/xml, application/json]
|
||||
*/
|
||||
$app->POST('/pet/{petId}', function($request, $response, $args) {
|
||||
|
||||
|
||||
$name = $args['name']; $status = $args['status'];
|
||||
|
||||
$response->write('How about implementing updatePetWithForm as a POST method ?');
|
||||
return $response;
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* POST uploadFile
|
||||
* Summary: uploads an image
|
||||
* Notes:
|
||||
* Output-Formats: [application/json]
|
||||
*/
|
||||
$app->POST('/pet/{petId}/uploadImage', function($request, $response, $args) {
|
||||
|
||||
|
||||
$additionalMetadata = $args['additionalMetadata']; $file = $args['file'];
|
||||
|
||||
$response->write('How about implementing uploadFile as a POST method ?');
|
||||
return $response;
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* DELETE deleteOrder
|
||||
* Summary: Delete purchase order by ID
|
||||
* Notes: For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||
* Output-Formats: [application/xml, application/json]
|
||||
*/
|
||||
$app->DELETE('/store/order/{orderId}', function($request, $response, $args) {
|
||||
|
||||
|
||||
|
||||
|
||||
$response->write('How about implementing deleteOrder as a DELETE method ?');
|
||||
return $response;
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* GET getInventory
|
||||
* Summary: Returns pet inventories by status
|
||||
* Notes: Returns a map of status codes to quantities
|
||||
* Output-Formats: [application/json]
|
||||
*/
|
||||
$app->GET('/store/inventory', function($request, $response, $args) {
|
||||
|
||||
|
||||
|
||||
|
||||
$response->write('How about implementing getInventory as a GET method ?');
|
||||
return $response;
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* GET getOrderById
|
||||
* Summary: Find purchase order by ID
|
||||
* Notes: For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||
* Output-Formats: [application/xml, application/json]
|
||||
*/
|
||||
$app->GET('/store/order/{orderId}', function($request, $response, $args) {
|
||||
|
||||
|
||||
|
||||
|
||||
$response->write('How about implementing getOrderById as a GET method ?');
|
||||
return $response;
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* POST placeOrder
|
||||
* Summary: Place an order for a pet
|
||||
* Notes:
|
||||
* Output-Formats: [application/xml, application/json]
|
||||
*/
|
||||
$app->POST('/store/order', function($request, $response, $args) {
|
||||
|
||||
|
||||
|
||||
$body = $request->getParsedBody();
|
||||
$response->write('How about implementing placeOrder as a POST method ?');
|
||||
return $response;
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* POST createUser
|
||||
* Summary: Create user
|
||||
* Notes: This can only be done by the logged in user.
|
||||
* Output-Formats: [application/json, application/xml]
|
||||
* Output-Formats: [application/xml, application/json]
|
||||
*/
|
||||
$app->POST('/user', function($request, $response, $args) {
|
||||
|
||||
@ -29,7 +223,7 @@ $app->POST('/user', function($request, $response, $args) {
|
||||
* POST createUsersWithArrayInput
|
||||
* Summary: Creates list of users with given input array
|
||||
* Notes:
|
||||
* Output-Formats: [application/json, application/xml]
|
||||
* Output-Formats: [application/xml, application/json]
|
||||
*/
|
||||
$app->POST('/user/createWithArray', function($request, $response, $args) {
|
||||
|
||||
@ -45,7 +239,7 @@ $app->POST('/user/createWithArray', function($request, $response, $args) {
|
||||
* POST createUsersWithListInput
|
||||
* Summary: Creates list of users with given input array
|
||||
* Notes:
|
||||
* Output-Formats: [application/json, application/xml]
|
||||
* Output-Formats: [application/xml, application/json]
|
||||
*/
|
||||
$app->POST('/user/createWithList', function($request, $response, $args) {
|
||||
|
||||
@ -57,11 +251,43 @@ $app->POST('/user/createWithList', function($request, $response, $args) {
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* DELETE deleteUser
|
||||
* Summary: Delete user
|
||||
* Notes: This can only be done by the logged in user.
|
||||
* Output-Formats: [application/xml, application/json]
|
||||
*/
|
||||
$app->DELETE('/user/{username}', function($request, $response, $args) {
|
||||
|
||||
|
||||
|
||||
|
||||
$response->write('How about implementing deleteUser as a DELETE method ?');
|
||||
return $response;
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* GET getUserByName
|
||||
* Summary: Get user by user name
|
||||
* Notes:
|
||||
* Output-Formats: [application/xml, application/json]
|
||||
*/
|
||||
$app->GET('/user/{username}', function($request, $response, $args) {
|
||||
|
||||
|
||||
|
||||
|
||||
$response->write('How about implementing getUserByName as a GET method ?');
|
||||
return $response;
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* GET loginUser
|
||||
* Summary: Logs user into the system
|
||||
* Notes:
|
||||
* Output-Formats: [application/json, application/xml]
|
||||
* Output-Formats: [application/xml, application/json]
|
||||
*/
|
||||
$app->GET('/user/login', function($request, $response, $args) {
|
||||
|
||||
@ -78,7 +304,7 @@ $app->GET('/user/login', function($request, $response, $args) {
|
||||
* GET logoutUser
|
||||
* Summary: Logs out current logged in user session
|
||||
* Notes:
|
||||
* Output-Formats: [application/json, application/xml]
|
||||
* Output-Formats: [application/xml, application/json]
|
||||
*/
|
||||
$app->GET('/user/logout', function($request, $response, $args) {
|
||||
|
||||
@ -90,27 +316,11 @@ $app->GET('/user/logout', function($request, $response, $args) {
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* GET getUserByName
|
||||
* Summary: Get user by user name
|
||||
* Notes:
|
||||
* Output-Formats: [application/json, application/xml]
|
||||
*/
|
||||
$app->GET('/user/{username}', function($request, $response, $args) {
|
||||
|
||||
|
||||
|
||||
|
||||
$response->write('How about implementing getUserByName as a GET method ?');
|
||||
return $response;
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* PUT updateUser
|
||||
* Summary: Updated user
|
||||
* Notes: This can only be done by the logged in user.
|
||||
* Output-Formats: [application/json, application/xml]
|
||||
* Output-Formats: [application/xml, application/json]
|
||||
*/
|
||||
$app->PUT('/user/{username}', function($request, $response, $args) {
|
||||
|
||||
@ -122,247 +332,5 @@ $app->PUT('/user/{username}', function($request, $response, $args) {
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* DELETE deleteUser
|
||||
* Summary: Delete user
|
||||
* Notes: This can only be done by the logged in user.
|
||||
* Output-Formats: [application/json, application/xml]
|
||||
*/
|
||||
$app->DELETE('/user/{username}', function($request, $response, $args) {
|
||||
|
||||
|
||||
|
||||
|
||||
$response->write('How about implementing deleteUser as a DELETE method ?');
|
||||
return $response;
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* PUT updatePet
|
||||
* Summary: Update an existing pet
|
||||
* Notes:
|
||||
* Output-Formats: [application/json, application/xml]
|
||||
*/
|
||||
$app->PUT('/pet', function($request, $response, $args) {
|
||||
|
||||
|
||||
|
||||
$body = $request->getParsedBody();
|
||||
$response->write('How about implementing updatePet as a PUT method ?');
|
||||
return $response;
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* POST addPet
|
||||
* Summary: Add a new pet to the store
|
||||
* Notes:
|
||||
* Output-Formats: [application/json, application/xml]
|
||||
*/
|
||||
$app->POST('/pet', function($request, $response, $args) {
|
||||
|
||||
|
||||
|
||||
$body = $request->getParsedBody();
|
||||
$response->write('How about implementing addPet as a POST method ?');
|
||||
return $response;
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* GET findPetsByStatus
|
||||
* Summary: Finds Pets by status
|
||||
* Notes: Multiple status values can be provided with comma seperated strings
|
||||
* Output-Formats: [application/json, application/xml]
|
||||
*/
|
||||
$app->GET('/pet/findByStatus', function($request, $response, $args) {
|
||||
|
||||
$queryParams = $request->getQueryParams();
|
||||
$status = $queryParams['status'];
|
||||
|
||||
|
||||
$response->write('How about implementing findPetsByStatus as a GET method ?');
|
||||
return $response;
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* GET findPetsByTags
|
||||
* Summary: Finds Pets by tags
|
||||
* Notes: Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
|
||||
* Output-Formats: [application/json, application/xml]
|
||||
*/
|
||||
$app->GET('/pet/findByTags', function($request, $response, $args) {
|
||||
|
||||
$queryParams = $request->getQueryParams();
|
||||
$tags = $queryParams['tags'];
|
||||
|
||||
|
||||
$response->write('How about implementing findPetsByTags as a GET method ?');
|
||||
return $response;
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* GET getPetById
|
||||
* Summary: Find pet by ID
|
||||
* Notes: Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
||||
* Output-Formats: [application/json, application/xml]
|
||||
*/
|
||||
$app->GET('/pet/{petId}', function($request, $response, $args) {
|
||||
|
||||
|
||||
|
||||
|
||||
$response->write('How about implementing getPetById as a GET method ?');
|
||||
return $response;
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* POST updatePetWithForm
|
||||
* Summary: Updates a pet in the store with form data
|
||||
* Notes:
|
||||
* Output-Formats: [application/json, application/xml]
|
||||
*/
|
||||
$app->POST('/pet/{petId}', function($request, $response, $args) {
|
||||
|
||||
|
||||
$name = $args['name']; $status = $args['status'];
|
||||
|
||||
$response->write('How about implementing updatePetWithForm as a POST method ?');
|
||||
return $response;
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* DELETE deletePet
|
||||
* Summary: Deletes a pet
|
||||
* Notes:
|
||||
* Output-Formats: [application/json, application/xml]
|
||||
*/
|
||||
$app->DELETE('/pet/{petId}', function($request, $response, $args) {
|
||||
$headers = $request->getHeaders();
|
||||
|
||||
|
||||
|
||||
$response->write('How about implementing deletePet as a DELETE method ?');
|
||||
return $response;
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* POST uploadFile
|
||||
* Summary: uploads an image
|
||||
* Notes:
|
||||
* Output-Formats: [application/json, application/xml]
|
||||
*/
|
||||
$app->POST('/pet/{petId}/uploadImage', function($request, $response, $args) {
|
||||
|
||||
|
||||
$additionalMetadata = $args['additionalMetadata']; $file = $args['file'];
|
||||
|
||||
$response->write('How about implementing uploadFile as a POST method ?');
|
||||
return $response;
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* GET getPetByIdWithByteArray
|
||||
* Summary: Fake endpoint to test byte array return by 'Find pet by ID'
|
||||
* Notes: Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
||||
* Output-Formats: [application/json, application/xml]
|
||||
*/
|
||||
$app->GET('/pet/{petId}?testing_byte_array=true', function($request, $response, $args) {
|
||||
|
||||
|
||||
|
||||
|
||||
$response->write('How about implementing getPetByIdWithByteArray as a GET method ?');
|
||||
return $response;
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* POST addPetUsingByteArray
|
||||
* Summary: Fake endpoint to test byte array in body parameter for adding a new pet to the store
|
||||
* Notes:
|
||||
* Output-Formats: [application/json, application/xml]
|
||||
*/
|
||||
$app->POST('/pet?testing_byte_array=true', function($request, $response, $args) {
|
||||
|
||||
|
||||
|
||||
$body = $request->getParsedBody();
|
||||
$response->write('How about implementing addPetUsingByteArray as a POST method ?');
|
||||
return $response;
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* GET getInventory
|
||||
* Summary: Returns pet inventories by status
|
||||
* Notes: Returns a map of status codes to quantities
|
||||
* Output-Formats: [application/json, application/xml]
|
||||
*/
|
||||
$app->GET('/store/inventory', function($request, $response, $args) {
|
||||
|
||||
|
||||
|
||||
|
||||
$response->write('How about implementing getInventory as a GET method ?');
|
||||
return $response;
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* POST placeOrder
|
||||
* Summary: Place an order for a pet
|
||||
* Notes:
|
||||
* Output-Formats: [application/json, application/xml]
|
||||
*/
|
||||
$app->POST('/store/order', function($request, $response, $args) {
|
||||
|
||||
|
||||
|
||||
$body = $request->getParsedBody();
|
||||
$response->write('How about implementing placeOrder as a POST method ?');
|
||||
return $response;
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* GET getOrderById
|
||||
* Summary: Find purchase order by ID
|
||||
* Notes: For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||
* Output-Formats: [application/json, application/xml]
|
||||
*/
|
||||
$app->GET('/store/order/{orderId}', function($request, $response, $args) {
|
||||
|
||||
|
||||
|
||||
|
||||
$response->write('How about implementing getOrderById as a GET method ?');
|
||||
return $response;
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* DELETE deleteOrder
|
||||
* Summary: Delete purchase order by ID
|
||||
* Notes: For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||
* Output-Formats: [application/json, application/xml]
|
||||
*/
|
||||
$app->DELETE('/store/order/{orderId}', function($request, $response, $args) {
|
||||
|
||||
|
||||
|
||||
|
||||
$response->write('How about implementing deleteOrder as a DELETE method ?');
|
||||
return $response;
|
||||
});
|
||||
|
||||
|
||||
|
||||
$app->run();
|
||||
|
Loading…
x
Reference in New Issue
Block a user