diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CSharpClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CSharpClientCodegen.java index ba9f461fd1f3..01ba4168fdc1 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CSharpClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CSharpClientCodegen.java @@ -306,83 +306,9 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen { this.packageGuid = packageGuid; } - /* - * - */ @Override public Map postProcessModels(Map objMap) { - objMap = super.postProcessModels(objMap); - - List models = (List) objMap.get("models"); - for (Object _mo : models) { - Map mo = (Map) _mo; - CodegenModel cm = (CodegenModel) mo.get("model"); - for (CodegenProperty var : cm.vars) { - Map allowableValues = var.allowableValues; - - // handle ArrayProperty - if (var.items != null) { - allowableValues = var.items.allowableValues; - } - - if (allowableValues == null) { - continue; - } - - List values = (List) allowableValues.get("values"); - - if (values == null) { - continue; - } - - // put "enumVars" map into `allowableValues", including `name` and `value` - List> enumVars = new ArrayList>(); - String commonPrefix = findCommonPrefixOfVars(values); - int truncateIdx = commonPrefix.length(); - for (String value : values) { - Map enumVar = new HashMap(); - String enumName; - if (truncateIdx == 0) { - enumName = value; - } else { - enumName = value.substring(truncateIdx); - if ("".equals(enumName)) { - enumName = value; - } - } - enumVar.put("name", toEnumVarName(enumName)); - enumVar.put("jsonname", value); - enumVar.put("value", value); - enumVars.add(enumVar); - } - allowableValues.put("enumVars", enumVars); - - // handle default value for enum, e.g. available => StatusEnum.AVAILABLE - - // HACK: strip ? from enum - if (var.datatypeWithEnum != null) { - var.vendorExtensions.put(DATA_TYPE_WITH_ENUM_EXTENSION, var.datatypeWithEnum.substring(0, var.datatypeWithEnum.length() - 1)); - } - - if (var.defaultValue != null) { - String enumName = null; - - for (Map enumVar : enumVars) { - if (var.defaultValue.replace("\"", "").equals(enumVar.get("value"))) { - enumName = enumVar.get("name"); - break; - } - } - - if (enumName != null && var.vendorExtensions.containsKey(DATA_TYPE_WITH_ENUM_EXTENSION)) { - var.defaultValue = var.vendorExtensions.get(DATA_TYPE_WITH_ENUM_EXTENSION) + "." + enumName; - } - } - } - } - return super.postProcessModels(objMap); - //return objs; } public void setTargetFramework(String dotnetFramework) { diff --git a/modules/swagger-codegen/src/main/resources/csharp/enumClass.mustache b/modules/swagger-codegen/src/main/resources/csharp/enumClass.mustache index 47620c623c6c..2c853cea25cb 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/enumClass.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/enumClass.mustache @@ -1,5 +1,14 @@ - public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} { + /// + /// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}} + /// {{#description}} + /// {{{description}}}{{/description}} + [JsonConverter(typeof(StringEnumConverter))] + public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} + { {{#allowableValues}}{{#enumVars}} + /// + /// Enum {{name}} for {{{value}}} + /// [EnumMember(Value = {{{value}}})] {{name}}{{^-last}}, {{/-last}}{{#-last}}{{/-last}}{{/enumVars}}{{/allowableValues}} diff --git a/modules/swagger-codegen/src/test/resources/2_0/petstore.json b/modules/swagger-codegen/src/test/resources/2_0/petstore.json index e31d5604601c..3ac7a6294bb5 100644 --- a/modules/swagger-codegen/src/test/resources/2_0/petstore.json +++ b/modules/swagger-codegen/src/test/resources/2_0/petstore.json @@ -1274,6 +1274,7 @@ }, "status": { "type": "string", + "default": "placed", "description": "Order Status", "enum": [ "placed", @@ -1378,6 +1379,7 @@ }, "EnumClass" : { "type": "string", + "default": "-efg", "enum": ["_abc", "-efg", "(xyz)"] }, "Enum_Test" : { diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Animal.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Animal.cs index 147884b19aa2..11d93aabd20d 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Animal.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Animal.cs @@ -13,7 +13,7 @@ using Newtonsoft.Json.Converters; namespace IO.Swagger.Model { /// - /// + /// Animal /// [DataContract] public partial class Animal : IEquatable diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Cat.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Cat.cs index dd03e5a6c3eb..235889c9864b 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Cat.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Cat.cs @@ -13,7 +13,7 @@ using Newtonsoft.Json.Converters; namespace IO.Swagger.Model { /// - /// + /// Cat /// [DataContract] public partial class Cat : Animal, IEquatable diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Category.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Category.cs index 89e8bfae7cc4..223bec6d0ab0 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Category.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Category.cs @@ -13,7 +13,7 @@ using Newtonsoft.Json.Converters; namespace IO.Swagger.Model { /// - /// + /// Category /// [DataContract] public partial class Category : IEquatable diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Dog.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Dog.cs index 0cd6e0891d71..7fefac6e26d3 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Dog.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Dog.cs @@ -13,7 +13,7 @@ using Newtonsoft.Json.Converters; namespace IO.Swagger.Model { /// - /// + /// Dog /// [DataContract] public partial class Dog : Animal, IEquatable diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/EnumClass.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/EnumClass.cs index a514468625a6..be3b7a17c5f4 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/EnumClass.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/EnumClass.cs @@ -12,16 +12,30 @@ using Newtonsoft.Json.Converters; namespace IO.Swagger.Model { - public enum EnumClass { - - [EnumMember(Value = "_abc")] - Abc, - - [EnumMember(Value = "-efg")] - efg, - - [EnumMember(Value = "(xyz)")] - xyz - } + /// + /// Gets or Sets EnumClass + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum EnumClass + { + + /// + /// Enum Abc for "_abc" + /// + [EnumMember(Value = "_abc")] + Abc, + + /// + /// Enum efg for "-efg" + /// + [EnumMember(Value = "-efg")] + efg, + + /// + /// Enum xyz for "(xyz)" + /// + [EnumMember(Value = "(xyz)")] + xyz + } } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/EnumTest.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/EnumTest.cs index c845ee695ca5..2ab24be8371c 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/EnumTest.cs @@ -13,21 +13,27 @@ using Newtonsoft.Json.Converters; namespace IO.Swagger.Model { /// - /// + /// EnumTest /// [DataContract] public partial class EnumTest : IEquatable { - /// /// Gets or Sets EnumString /// [JsonConverter(typeof(StringEnumConverter))] - public enum EnumStringEnum { + public enum EnumStringEnum + { + /// + /// Enum Upper for "UPPER" + /// [EnumMember(Value = "UPPER")] Upper, + /// + /// Enum Lower for "lower" + /// [EnumMember(Value = "lower")] Lower } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/InlineResponse200.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/InlineResponse200.cs index fd53579cc1b8..32d3db25e58e 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/InlineResponse200.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/InlineResponse200.cs @@ -13,25 +13,34 @@ using Newtonsoft.Json.Converters; namespace IO.Swagger.Model { /// - /// + /// InlineResponse200 /// [DataContract] public partial class InlineResponse200 : IEquatable { - /// /// pet status in the store /// /// pet status in the store [JsonConverter(typeof(StringEnumConverter))] - public enum StatusEnum { + public enum StatusEnum + { + /// + /// Enum Available for "available" + /// [EnumMember(Value = "available")] Available, + /// + /// Enum Pending for "pending" + /// [EnumMember(Value = "pending")] Pending, + /// + /// Enum Sold for "sold" + /// [EnumMember(Value = "sold")] Sold } @@ -48,14 +57,14 @@ namespace IO.Swagger.Model /// Initializes a new instance of the class. /// Initializes a new instance of the class. /// - /// PhotoUrls. - /// Name. + /// Tags. /// Id (required). /// Category. - /// Tags. /// pet status in the store. + /// Name. + /// PhotoUrls. - public InlineResponse200(List PhotoUrls = null, string Name = null, long? Id = null, Object Category = null, List Tags = null, StatusEnum? Status = null) + public InlineResponse200(List Tags = null, long? Id = null, Object Category = null, StatusEnum? Status = null, string Name = null, List PhotoUrls = null) { // to ensure "Id" is required (not null) if (Id == null) @@ -66,26 +75,20 @@ namespace IO.Swagger.Model { this.Id = Id; } - this.PhotoUrls = PhotoUrls; - this.Name = Name; - this.Category = Category; this.Tags = Tags; + this.Category = Category; this.Status = Status; + this.Name = Name; + this.PhotoUrls = PhotoUrls; } - + /// - /// Gets or Sets PhotoUrls + /// Gets or Sets Tags /// - [DataMember(Name="photoUrls", EmitDefaultValue=false)] - public List PhotoUrls { get; set; } - - /// - /// Gets or Sets Name - /// - [DataMember(Name="name", EmitDefaultValue=false)] - public string Name { get; set; } + [DataMember(Name="tags", EmitDefaultValue=false)] + public List Tags { get; set; } /// /// Gets or Sets Id @@ -100,10 +103,16 @@ namespace IO.Swagger.Model public Object Category { get; set; } /// - /// Gets or Sets Tags + /// Gets or Sets Name /// - [DataMember(Name="tags", EmitDefaultValue=false)] - public List Tags { get; set; } + [DataMember(Name="name", EmitDefaultValue=false)] + public string Name { get; set; } + + /// + /// Gets or Sets PhotoUrls + /// + [DataMember(Name="photoUrls", EmitDefaultValue=false)] + public List PhotoUrls { get; set; } /// /// Returns the string presentation of the object @@ -113,16 +122,17 @@ namespace IO.Swagger.Model { var sb = new StringBuilder(); sb.Append("class InlineResponse200 {\n"); - sb.Append(" PhotoUrls: ").Append(PhotoUrls).Append("\n"); - sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" Tags: ").Append(Tags).Append("\n"); sb.Append(" Id: ").Append(Id).Append("\n"); sb.Append(" Category: ").Append(Category).Append("\n"); - sb.Append(" Tags: ").Append(Tags).Append("\n"); sb.Append(" Status: ").Append(Status).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" PhotoUrls: ").Append(PhotoUrls).Append("\n"); + sb.Append("}\n"); return sb.ToString(); } - + /// /// Returns the JSON string presentation of the object /// @@ -156,14 +166,9 @@ namespace IO.Swagger.Model return ( - this.PhotoUrls == other.PhotoUrls || - this.PhotoUrls != null && - this.PhotoUrls.SequenceEqual(other.PhotoUrls) - ) && - ( - this.Name == other.Name || - this.Name != null && - this.Name.Equals(other.Name) + this.Tags == other.Tags || + this.Tags != null && + this.Tags.SequenceEqual(other.Tags) ) && ( this.Id == other.Id || @@ -175,15 +180,20 @@ namespace IO.Swagger.Model this.Category != null && this.Category.Equals(other.Category) ) && - ( - this.Tags == other.Tags || - this.Tags != null && - this.Tags.SequenceEqual(other.Tags) - ) && ( this.Status == other.Status || this.Status != null && this.Status.Equals(other.Status) + ) && + ( + this.Name == other.Name || + this.Name != null && + this.Name.Equals(other.Name) + ) && + ( + this.PhotoUrls == other.PhotoUrls || + this.PhotoUrls != null && + this.PhotoUrls.SequenceEqual(other.PhotoUrls) ); } @@ -198,18 +208,25 @@ namespace IO.Swagger.Model { int hash = 41; // Suitable nullity checks etc, of course :) - if (this.PhotoUrls != null) - hash = hash * 59 + this.PhotoUrls.GetHashCode(); - if (this.Name != null) - hash = hash * 59 + this.Name.GetHashCode(); - if (this.Id != null) - hash = hash * 59 + this.Id.GetHashCode(); - if (this.Category != null) - hash = hash * 59 + this.Category.GetHashCode(); + if (this.Tags != null) hash = hash * 59 + this.Tags.GetHashCode(); + + if (this.Id != null) + hash = hash * 59 + this.Id.GetHashCode(); + + if (this.Category != null) + hash = hash * 59 + this.Category.GetHashCode(); + if (this.Status != null) hash = hash * 59 + this.Status.GetHashCode(); + + if (this.Name != null) + hash = hash * 59 + this.Name.GetHashCode(); + + if (this.PhotoUrls != null) + hash = hash * 59 + this.PhotoUrls.GetHashCode(); + return hash; } } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Model200Response.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Model200Response.cs index 06dfb9b97a70..52a19ff2f225 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Model200Response.cs @@ -13,7 +13,7 @@ using Newtonsoft.Json.Converters; namespace IO.Swagger.Model { /// - /// Model for testing model name starting with number + /// Model200Response /// [DataContract] public partial class Model200Response : IEquatable @@ -30,7 +30,7 @@ namespace IO.Swagger.Model this.Name = Name; } - + /// /// Gets or Sets Name @@ -47,10 +47,11 @@ namespace IO.Swagger.Model var sb = new StringBuilder(); sb.Append("class Model200Response {\n"); sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append("}\n"); return sb.ToString(); } - + /// /// Returns the JSON string presentation of the object /// @@ -101,8 +102,10 @@ namespace IO.Swagger.Model { int hash = 41; // Suitable nullity checks etc, of course :) + if (this.Name != null) hash = hash * 59 + this.Name.GetHashCode(); + return hash; } } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/ModelReturn.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/ModelReturn.cs index 67224e50a51e..3b74f1ba729d 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/ModelReturn.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/ModelReturn.cs @@ -13,7 +13,7 @@ using Newtonsoft.Json.Converters; namespace IO.Swagger.Model { /// - /// Model for testing reserved words + /// ModelReturn /// [DataContract] public partial class ModelReturn : IEquatable @@ -30,7 +30,7 @@ namespace IO.Swagger.Model this._Return = _Return; } - + /// /// Gets or Sets _Return @@ -47,10 +47,11 @@ namespace IO.Swagger.Model var sb = new StringBuilder(); sb.Append("class ModelReturn {\n"); sb.Append(" _Return: ").Append(_Return).Append("\n"); + sb.Append("}\n"); return sb.ToString(); } - + /// /// Returns the JSON string presentation of the object /// @@ -101,8 +102,10 @@ namespace IO.Swagger.Model { int hash = 41; // Suitable nullity checks etc, of course :) + if (this._Return != null) hash = hash * 59 + this._Return.GetHashCode(); + return hash; } } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Name.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Name.cs index 1f16afaa8970..01592253e246 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Name.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Name.cs @@ -13,7 +13,7 @@ using Newtonsoft.Json.Converters; namespace IO.Swagger.Model { /// - /// Model for testing model name same as property name + /// Name /// [DataContract] public partial class Name : IEquatable @@ -23,24 +23,16 @@ namespace IO.Swagger.Model /// Initializes a new instance of the class. /// Initializes a new instance of the class. /// - /// _Name (required). - /// Property. + /// _Name. + /// SnakeCase. - public Name(int? _Name = null, string Property = null) + public Name(int? _Name = null, int? SnakeCase = null) { - // to ensure "_Name" is required (not null) - if (_Name == null) - { - throw new InvalidDataException("_Name is a required property for Name and cannot be null"); - } - else - { - this._Name = _Name; - } - this.Property = Property; + this._Name = _Name; + this.SnakeCase = SnakeCase; } - + /// /// Gets or Sets _Name @@ -52,13 +44,7 @@ namespace IO.Swagger.Model /// Gets or Sets SnakeCase /// [DataMember(Name="snake_case", EmitDefaultValue=false)] - public int? SnakeCase { get; private set; } - - /// - /// Gets or Sets Property - /// - [DataMember(Name="property", EmitDefaultValue=false)] - public string Property { get; set; } + public int? SnakeCase { get; set; } /// /// Returns the string presentation of the object @@ -70,11 +56,11 @@ namespace IO.Swagger.Model sb.Append("class Name {\n"); sb.Append(" _Name: ").Append(_Name).Append("\n"); sb.Append(" SnakeCase: ").Append(SnakeCase).Append("\n"); - sb.Append(" Property: ").Append(Property).Append("\n"); + sb.Append("}\n"); return sb.ToString(); } - + /// /// Returns the JSON string presentation of the object /// @@ -116,11 +102,6 @@ namespace IO.Swagger.Model this.SnakeCase == other.SnakeCase || this.SnakeCase != null && this.SnakeCase.Equals(other.SnakeCase) - ) && - ( - this.Property == other.Property || - this.Property != null && - this.Property.Equals(other.Property) ); } @@ -135,12 +116,13 @@ namespace IO.Swagger.Model { int hash = 41; // Suitable nullity checks etc, of course :) + if (this._Name != null) hash = hash * 59 + this._Name.GetHashCode(); + if (this.SnakeCase != null) hash = hash * 59 + this.SnakeCase.GetHashCode(); - if (this.Property != null) - hash = hash * 59 + this.Property.GetHashCode(); + return hash; } } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Order.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Order.cs index f83a9d451f0f..5561095be767 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Order.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Order.cs @@ -13,25 +13,34 @@ using Newtonsoft.Json.Converters; namespace IO.Swagger.Model { /// - /// + /// Order /// [DataContract] public partial class Order : IEquatable { - /// /// Order Status /// /// Order Status [JsonConverter(typeof(StringEnumConverter))] - public enum StatusEnum { + public enum StatusEnum + { + /// + /// Enum Placed for "placed" + /// [EnumMember(Value = "placed")] Placed, + /// + /// Enum Approved for "approved" + /// [EnumMember(Value = "approved")] Approved, + /// + /// Enum Delivered for "delivered" + /// [EnumMember(Value = "delivered")] Delivered } @@ -48,38 +57,36 @@ namespace IO.Swagger.Model /// Initializes a new instance of the class. /// Initializes a new instance of the class. /// - /// Id. /// PetId. /// Quantity. /// ShipDate. - /// Order Status. - /// Complete (default to false). + /// Order Status (default to StatusEnum.Placed). + /// Complete. - public Order(long? Id = null, long? PetId = null, int? Quantity = null, DateTime? ShipDate = null, StatusEnum? Status = null, bool? Complete = null) + public Order(long? PetId = null, int? Quantity = null, DateTime? ShipDate = null, StatusEnum? Status = null, bool? Complete = null) { - this.Id = Id; this.PetId = PetId; this.Quantity = Quantity; this.ShipDate = ShipDate; - this.Status = Status; - // use default value if no "Complete" provided - if (Complete == null) + // use default value if no "Status" provided + if (Status == null) { - this.Complete = false; + this.Status = StatusEnum.Placed; } else { - this.Complete = Complete; + this.Status = Status; } + this.Complete = Complete; } - + /// /// Gets or Sets Id /// [DataMember(Name="id", EmitDefaultValue=false)] - public long? Id { get; set; } + public long? Id { get; private set; } /// /// Gets or Sets PetId @@ -119,10 +126,11 @@ namespace IO.Swagger.Model 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(); } - + /// /// Returns the JSON string presentation of the object /// @@ -198,18 +206,25 @@ namespace IO.Swagger.Model { 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; } } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Pet.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Pet.cs index b732e687dce1..db790ad8ab1e 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Pet.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Pet.cs @@ -13,25 +13,34 @@ using Newtonsoft.Json.Converters; namespace IO.Swagger.Model { /// - /// + /// Pet /// [DataContract] public partial class Pet : IEquatable { - /// /// pet status in the store /// /// pet status in the store [JsonConverter(typeof(StringEnumConverter))] - public enum StatusEnum { + public enum StatusEnum + { + /// + /// Enum Available for "available" + /// [EnumMember(Value = "available")] Available, + /// + /// Enum Pending for "pending" + /// [EnumMember(Value = "pending")] Pending, + /// + /// Enum Sold for "sold" + /// [EnumMember(Value = "sold")] Sold } @@ -81,7 +90,7 @@ namespace IO.Swagger.Model this.Status = Status; } - + /// /// Gets or Sets Id @@ -127,10 +136,11 @@ namespace IO.Swagger.Model 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(); } - + /// /// Returns the JSON string presentation of the object /// @@ -206,18 +216,25 @@ namespace IO.Swagger.Model { 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; } } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/SpecialModelName.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/SpecialModelName.cs index 7ea43dabbd72..17451359d82a 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/SpecialModelName.cs @@ -13,7 +13,7 @@ using Newtonsoft.Json.Converters; namespace IO.Swagger.Model { /// - /// + /// SpecialModelName /// [DataContract] public partial class SpecialModelName : IEquatable diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Tag.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Tag.cs index 8054698b8f92..93c7b4deb06d 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Tag.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Tag.cs @@ -13,7 +13,7 @@ using Newtonsoft.Json.Converters; namespace IO.Swagger.Model { /// - /// + /// Tag /// [DataContract] public partial class Tag : IEquatable diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/User.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/User.cs index 5c5f3daa33ea..3336da10d73a 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/User.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/User.cs @@ -13,7 +13,7 @@ using Newtonsoft.Json.Converters; namespace IO.Swagger.Model { /// - /// + /// User /// [DataContract] public partial class User : IEquatable diff --git a/samples/client/petstore/php/SwaggerClient-php/README.md b/samples/client/petstore/php/SwaggerClient-php/README.md index e829f2643a4f..ead713aa68d3 100644 --- a/samples/client/petstore/php/SwaggerClient-php/README.md +++ b/samples/client/petstore/php/SwaggerClient-php/README.md @@ -5,7 +5,7 @@ This PHP package is automatically generated by the [Swagger Codegen](https://git - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-04-03T17:03:15.368+08:00 +- Build date: 2016-04-03T22:11:31.470+08:00 - Build package: class io.swagger.codegen.languages.PhpClientCodegen ## Requirements