update server generator to use petstore.yaml

This commit is contained in:
wing328 2016-04-15 17:42:18 +08:00
parent 4f84c7d3bc
commit 0982afbca0
17 changed files with 375 additions and 507 deletions

View File

@ -26,6 +26,6 @@ fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="$@ generate -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

View File

@ -26,6 +26,6 @@ fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="$@ generate -t modules/swagger-codegen/src/main/resources/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

View File

@ -26,6 +26,6 @@ fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="$@ generate -t modules/swagger-codegen/src/main/resources/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

View File

@ -26,6 +26,6 @@ fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="$@ generate -t modules/swagger-codegen/src/main/resources/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

View File

@ -26,6 +26,6 @@ fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="$@ generate -t modules/swagger-codegen/src/main/resources/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

View File

@ -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 &lt; 10. ID &gt; 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 &#39;Find pet by ID&#39;
/// </summary>
/// <remarks>Returns a pet when ID &lt; 10. ID &gt; 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();
}
}
}

View File

@ -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 &lt; 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 &lt;&#x3D; 5 or &gt; 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 &lt;= 5 or &gt; 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 &lt; 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();
}
}
}

View File

@ -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();
}
}
}

View File

@ -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;
}
}

View File

@ -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;
// 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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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:39:42.971+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" );
}
*/
}

View File

@ -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:39:42.971+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" );
}
*/
}

View File

@ -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:39:42.971+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" );
}
*/
}

View File

@ -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"
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"