forked from swagger-api/swagger-codegen
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue swagger-api#5419 - Part 1 - C# Servers updated and samples gene…
…rated
- Loading branch information
1 parent
621ff06
commit 1d5e35f
Showing
78 changed files
with
8,935 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
104 changes: 104 additions & 0 deletions
104
samples/server/petstore/aspnetcore/src/IO.Swagger/Controllers/FakeApi.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
/* | ||
* Swagger Petstore | ||
* | ||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ | ||
* | ||
* OpenAPI spec version: 1.0.0 | ||
* Contact: [email protected] | ||
* Generated by: https://github.com/swagger-api/swagger-codegen.git | ||
*/ | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Collections.ObjectModel; | ||
using System.ComponentModel; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Net; | ||
using System.Threading.Tasks; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Newtonsoft.Json; | ||
using Swashbuckle.SwaggerGen.Annotations; | ||
using IO.Swagger.Models; | ||
|
||
namespace IO.Swagger.Controllers | ||
{ | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
public class FakeApiController : Controller | ||
{ | ||
|
||
/// <summary> | ||
/// To test \"client\" model | ||
/// </summary> | ||
/// <remarks>To test \"client\" model</remarks> | ||
/// <param name="body">client model</param> | ||
/// <response code="200">successful operation</response> | ||
[HttpPatch] | ||
[Route("/v2/fake")] | ||
[SwaggerOperation("TestClientModel")] | ||
[SwaggerResponse(200, type: typeof(Client))] | ||
public virtual IActionResult TestClientModel([FromBody]Client body) | ||
{ | ||
string exampleJson = null; | ||
|
||
var example = exampleJson != null | ||
? JsonConvert.DeserializeObject<Client>(exampleJson) | ||
: default(Client); | ||
return new ObjectResult(example); | ||
} | ||
|
||
|
||
/// <summary> | ||
/// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 | ||
/// </summary> | ||
/// <remarks>Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 </remarks> | ||
/// <param name="number">None</param> | ||
/// <param name="double">None</param> | ||
/// <param name="patternWithoutDelimiter">None</param> | ||
/// <param name="byte">None</param> | ||
/// <param name="integer">None</param> | ||
/// <param name="int32">None</param> | ||
/// <param name="int64">None</param> | ||
/// <param name="float">None</param> | ||
/// <param name="string">None</param> | ||
/// <param name="binary">None</param> | ||
/// <param name="date">None</param> | ||
/// <param name="dateTime">None</param> | ||
/// <param name="password">None</param> | ||
/// <param name="callback">None</param> | ||
/// <response code="400">Invalid username supplied</response> | ||
/// <response code="404">User not found</response> | ||
[HttpPost] | ||
[Route("/v2/fake")] | ||
[SwaggerOperation("TestEndpointParameters")] | ||
public virtual void TestEndpointParameters([FromForm]decimal? number, [FromForm]double? double, [FromForm]string patternWithoutDelimiter, [FromForm]byte[] byte, [FromForm]int? integer, [FromForm]int? int32, [FromForm]long? int64, [FromForm]float? float, [FromForm]string string, [FromForm]byte[] binary, [FromForm]DateTime? date, [FromForm]DateTime? dateTime, [FromForm]string password, [FromForm]string callback) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
|
||
/// <summary> | ||
/// To test enum parameters | ||
/// </summary> | ||
/// <remarks>To test enum parameters</remarks> | ||
/// <param name="enumFormStringArray">Form parameter enum test (string array)</param> | ||
/// <param name="enumFormString">Form parameter enum test (string)</param> | ||
/// <param name="enumHeaderStringArray">Header parameter enum test (string array)</param> | ||
/// <param name="enumHeaderString">Header parameter enum test (string)</param> | ||
/// <param name="enumQueryStringArray">Query parameter enum test (string array)</param> | ||
/// <param name="enumQueryString">Query parameter enum test (string)</param> | ||
/// <param name="enumQueryInteger">Query parameter enum test (double)</param> | ||
/// <param name="enumQueryDouble">Query parameter enum test (double)</param> | ||
/// <response code="400">Invalid request</response> | ||
/// <response code="404">Not found</response> | ||
[HttpGet] | ||
[Route("/v2/fake")] | ||
[SwaggerOperation("TestEnumParameters")] | ||
public virtual void TestEnumParameters([FromForm]List<string> enumFormStringArray, [FromForm]string enumFormString, [FromHeader]List<string> enumHeaderStringArray, [FromHeader]string enumHeaderString, [FromQuery]List<string> enumQueryStringArray, [FromQuery]string enumQueryString, [FromQuery]int? enumQueryInteger, [FromForm]double? enumQueryDouble) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
samples/server/petstore/aspnetcore/src/IO.Swagger/Controllers/PetApi.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/* | ||
* Swagger Petstore | ||
* | ||
* 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. | ||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ | ||
* | ||
* OpenAPI spec version: 1.0.0 | ||
* Contact: [email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/* | ||
* Swagger Petstore | ||
* | ||
* 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. | ||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ | ||
* | ||
* OpenAPI spec version: 1.0.0 | ||
* Contact: [email protected] | ||
|
@@ -37,7 +37,7 @@ public class StoreApiController : Controller | |
/// <response code="400">Invalid ID supplied</response> | ||
/// <response code="404">Order not found</response> | ||
[HttpDelete] | ||
[Route("/v2/store/order/{orderId}")] | ||
[Route("/v2/store/order/{order_id}")] | ||
[SwaggerOperation("DeleteOrder")] | ||
public virtual void DeleteOrder([FromRoute]string orderId) | ||
{ | ||
|
@@ -74,7 +74,7 @@ public virtual IActionResult GetInventory() | |
/// <response code="400">Invalid ID supplied</response> | ||
/// <response code="404">Order not found</response> | ||
[HttpGet] | ||
[Route("/v2/store/order/{orderId}")] | ||
[Route("/v2/store/order/{order_id}")] | ||
[SwaggerOperation("GetOrderById")] | ||
[SwaggerResponse(200, type: typeof(Order))] | ||
public virtual IActionResult GetOrderById([FromRoute]long? orderId) | ||
|
2 changes: 1 addition & 1 deletion
2
samples/server/petstore/aspnetcore/src/IO.Swagger/Controllers/UserApi.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/* | ||
* Swagger Petstore | ||
* | ||
* 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. | ||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ | ||
* | ||
* OpenAPI spec version: 1.0.0 | ||
* Contact: [email protected] | ||
|
148 changes: 148 additions & 0 deletions
148
samples/server/petstore/aspnetcore/src/IO.Swagger/Models/AdditionalPropertiesClass.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
/* | ||
* Swagger Petstore | ||
* | ||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ | ||
* | ||
* OpenAPI spec version: 1.0.0 | ||
* Contact: [email protected] | ||
* Generated by: https://github.com/swagger-api/swagger-codegen.git | ||
*/ | ||
|
||
using System; | ||
using System.Linq; | ||
using System.IO; | ||
using System.Text; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using System.Collections.ObjectModel; | ||
using System.Runtime.Serialization; | ||
using Newtonsoft.Json; | ||
|
||
namespace IO.Swagger.Models | ||
{ | ||
|
||
/// <summary> | ||
/// | ||
/// </summary> | ||
[DataContract] | ||
public partial class AdditionalPropertiesClass : IEquatable<AdditionalPropertiesClass> | ||
{ | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="AdditionalPropertiesClass" /> class. | ||
/// </summary> | ||
/// <param name="MapProperty">MapProperty.</param> | ||
/// <param name="MapOfMapProperty">MapOfMapProperty.</param> | ||
public AdditionalPropertiesClass(Dictionary<string, string> MapProperty = default(Dictionary<string, string>), Dictionary<string, Dictionary<string, string>> MapOfMapProperty = default(Dictionary<string, Dictionary<string, string>>)) | ||
{ | ||
this.MapProperty = MapProperty; | ||
this.MapOfMapProperty = MapOfMapProperty; | ||
|
||
} | ||
|
||
/// <summary> | ||
/// Gets or Sets MapProperty | ||
/// </summary> | ||
[DataMember(Name="map_property")] | ||
public Dictionary<string, string> MapProperty { get; set; } | ||
/// <summary> | ||
/// Gets or Sets MapOfMapProperty | ||
/// </summary> | ||
[DataMember(Name="map_of_map_property")] | ||
public Dictionary<string, Dictionary<string, string>> MapOfMapProperty { get; set; } | ||
|
||
/// <summary> | ||
/// Returns the string presentation of the object | ||
/// </summary> | ||
/// <returns>String presentation of the object</returns> | ||
public override string ToString() | ||
{ | ||
var sb = new StringBuilder(); | ||
sb.Append("class AdditionalPropertiesClass {\n"); | ||
sb.Append(" MapProperty: ").Append(MapProperty).Append("\n"); | ||
sb.Append(" MapOfMapProperty: ").Append(MapOfMapProperty).Append("\n"); | ||
sb.Append("}\n"); | ||
return sb.ToString(); | ||
} | ||
|
||
/// <summary> | ||
/// Returns the JSON string presentation of the object | ||
/// </summary> | ||
/// <returns>JSON string presentation of the object</returns> | ||
public string ToJson() | ||
{ | ||
return JsonConvert.SerializeObject(this, Formatting.Indented); | ||
} | ||
|
||
/// <summary> | ||
/// Returns true if objects are equal | ||
/// </summary> | ||
/// <param name="obj">Object to be compared</param> | ||
/// <returns>Boolean</returns> | ||
public override bool Equals(object obj) | ||
{ | ||
if (ReferenceEquals(null, obj)) return false; | ||
if (ReferenceEquals(this, obj)) return true; | ||
if (obj.GetType() != GetType()) return false; | ||
return Equals((AdditionalPropertiesClass)obj); | ||
} | ||
|
||
/// <summary> | ||
/// Returns true if AdditionalPropertiesClass instances are equal | ||
/// </summary> | ||
/// <param name="other">Instance of AdditionalPropertiesClass to be compared</param> | ||
/// <returns>Boolean</returns> | ||
public bool Equals(AdditionalPropertiesClass other) | ||
{ | ||
|
||
if (ReferenceEquals(null, other)) return false; | ||
if (ReferenceEquals(this, other)) return true; | ||
|
||
return | ||
( | ||
this.MapProperty == other.MapProperty || | ||
this.MapProperty != null && | ||
this.MapProperty.SequenceEqual(other.MapProperty) | ||
) && | ||
( | ||
this.MapOfMapProperty == other.MapOfMapProperty || | ||
this.MapOfMapProperty != null && | ||
this.MapOfMapProperty.SequenceEqual(other.MapOfMapProperty) | ||
); | ||
} | ||
|
||
/// <summary> | ||
/// Gets the hash code | ||
/// </summary> | ||
/// <returns>Hash code</returns> | ||
public override int GetHashCode() | ||
{ | ||
// credit: http://stackoverflow.com/a/263416/677735 | ||
unchecked // Overflow is fine, just wrap | ||
{ | ||
int hash = 41; | ||
// Suitable nullity checks etc, of course :) | ||
if (this.MapProperty != null) | ||
hash = hash * 59 + this.MapProperty.GetHashCode(); | ||
if (this.MapOfMapProperty != null) | ||
hash = hash * 59 + this.MapOfMapProperty.GetHashCode(); | ||
return hash; | ||
} | ||
} | ||
|
||
#region Operators | ||
|
||
public static bool operator ==(AdditionalPropertiesClass left, AdditionalPropertiesClass right) | ||
{ | ||
return Equals(left, right); | ||
} | ||
|
||
public static bool operator !=(AdditionalPropertiesClass left, AdditionalPropertiesClass right) | ||
{ | ||
return !Equals(left, right); | ||
} | ||
|
||
#endregion Operators | ||
|
||
} | ||
} |
Oops, something went wrong.