diff --git a/modules/swagger-codegen/src/main/java/com/wordnik/swagger/codegen/languages/CSharpClientCodegen.java b/modules/swagger-codegen/src/main/java/com/wordnik/swagger/codegen/languages/CSharpClientCodegen.java index 8203a83b349..969b143c5a0 100644 --- a/modules/swagger-codegen/src/main/java/com/wordnik/swagger/codegen/languages/CSharpClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/com/wordnik/swagger/codegen/languages/CSharpClientCodegen.java @@ -50,7 +50,7 @@ public class CSharpClientCodegen extends DefaultCodegen implements CodegenConfig languageSpecificPrimitives = new HashSet( Arrays.asList( - "string?", + "string", "bool?", "double?", "int?", @@ -72,7 +72,7 @@ public class CSharpClientCodegen extends DefaultCodegen implements CodegenConfig instantiationTypes.put("map", "Dictionary"); typeMapping = new HashMap(); - typeMapping.put("string", "string?"); + typeMapping.put("string", "string"); typeMapping.put("boolean", "bool?"); typeMapping.put("integer", "int?"); typeMapping.put("float", "float?"); diff --git a/samples/client/petstore/csharp/src/main/csharp/io/swagger/Api/PetApi.cs b/samples/client/petstore/csharp/src/main/csharp/io/swagger/Api/PetApi.cs index 6bbaa142c4a..4f20c0cba45 100644 --- a/samples/client/petstore/csharp/src/main/csharp/io/swagger/Api/PetApi.cs +++ b/samples/client/petstore/csharp/src/main/csharp/io/swagger/Api/PetApi.cs @@ -132,7 +132,7 @@ namespace io.swagger.Api { /// Status values that need to be considered for filter /// - public List FindPetsByStatus (List Status) { + public List FindPetsByStatus (List Status) { // create path and map variables var path = "/pet/findByStatus".Replace("{format}","json"); @@ -188,7 +188,7 @@ namespace io.swagger.Api { /// Tags to filter by /// - public List FindPetsByTags (List Tags) { + public List FindPetsByTags (List Tags) { // create path and map variables var path = "/pet/findByTags".Replace("{format}","json"); @@ -244,7 +244,7 @@ namespace io.swagger.Api { /// ID of pet that needs to be fetched /// - public PetTest GetPetById (long? PetId) { + public Pet GetPetById (long? PetId) { // create path and map variables var path = "/pet/{petId}".Replace("{format}","json").Replace("{" + "petId" + "}", apiInvoker.ParameterToString(PetId)); @@ -262,17 +262,17 @@ namespace io.swagger.Api { try { - if (typeof(PetTest) == typeof(byte[])) { + if (typeof(Pet) == typeof(byte[])) { var response = apiInvoker.invokeBinaryAPI(basePath, path, "GET", queryParams, null, headerParams, formParams); - return ((object)response) as PetTest; + return ((object)response) as Pet; } else { var response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, formParams); if (response != null){ - return (PetTest) ApiInvoker.deserialize(response, typeof(PetTest)); + return (Pet) ApiInvoker.deserialize(response, typeof(Pet)); } else { return null; @@ -299,7 +299,7 @@ namespace io.swagger.Api { /// Updated status of the pet /// - public void UpdatePetWithForm (string? PetId, string? Name, string? Status) { + public void UpdatePetWithForm (string PetId, string Name, string Status) { // create path and map variables var path = "/pet/{petId}".Replace("{format}","json").Replace("{" + "petId" + "}", apiInvoker.ParameterToString(PetId)); @@ -362,7 +362,7 @@ namespace io.swagger.Api { /// Pet id to delete /// - public void DeletePet (string? ApiKey, long? PetId) { + public void DeletePet (string ApiKey, long? PetId) { // create path and map variables var path = "/pet/{petId}".Replace("{format}","json").Replace("{" + "petId" + "}", apiInvoker.ParameterToString(PetId)); @@ -413,7 +413,7 @@ namespace io.swagger.Api { /// file to upload /// - public void UploadFile (long? PetId, string? AdditionalMetadata, byte[] File) { + public void UploadFile (long? PetId, string AdditionalMetadata, byte[] File) { // create path and map variables var path = "/pet/{petId}/uploadImage".Replace("{format}","json").Replace("{" + "petId" + "}", apiInvoker.ParameterToString(PetId)); diff --git a/samples/client/petstore/csharp/src/main/csharp/io/swagger/Api/StoreApi.cs b/samples/client/petstore/csharp/src/main/csharp/io/swagger/Api/StoreApi.cs index e433ced7bc7..2514539e298 100644 --- a/samples/client/petstore/csharp/src/main/csharp/io/swagger/Api/StoreApi.cs +++ b/samples/client/petstore/csharp/src/main/csharp/io/swagger/Api/StoreApi.cs @@ -141,7 +141,7 @@ namespace io.swagger.Api { /// ID of pet that needs to be fetched /// - public Order GetOrderById (string? OrderId) { + public Order GetOrderById (string OrderId) { // create path and map variables var path = "/store/order/{orderId}".Replace("{format}","json").Replace("{" + "orderId" + "}", apiInvoker.ParameterToString(OrderId)); @@ -194,7 +194,7 @@ namespace io.swagger.Api { /// ID of the order that needs to be deleted /// - public void DeleteOrder (string? OrderId) { + public void DeleteOrder (string OrderId) { // create path and map variables var path = "/store/order/{orderId}".Replace("{format}","json").Replace("{" + "orderId" + "}", apiInvoker.ParameterToString(OrderId)); diff --git a/samples/client/petstore/csharp/src/main/csharp/io/swagger/Api/UserApi.cs b/samples/client/petstore/csharp/src/main/csharp/io/swagger/Api/UserApi.cs index d706c029aab..4f1f4a1bf19 100644 --- a/samples/client/petstore/csharp/src/main/csharp/io/swagger/Api/UserApi.cs +++ b/samples/client/petstore/csharp/src/main/csharp/io/swagger/Api/UserApi.cs @@ -181,7 +181,7 @@ namespace io.swagger.Api { /// The password for login in clear text /// - public string? LoginUser (string? Username, string? Password) { + public string LoginUser (string Username, string Password) { // create path and map variables var path = "/user/login".Replace("{format}","json"); @@ -205,17 +205,17 @@ namespace io.swagger.Api { try { - if (typeof(string?) == typeof(byte[])) { + if (typeof(string) == typeof(byte[])) { var response = apiInvoker.invokeBinaryAPI(basePath, path, "GET", queryParams, null, headerParams, formParams); - return ((object)response) as string?; + return ((object)response) as string; } else { var response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, formParams); if (response != null){ - return (string?) ApiInvoker.deserialize(response, typeof(string?)); + return (string) ApiInvoker.deserialize(response, typeof(string)); } else { return null; @@ -287,7 +287,7 @@ namespace io.swagger.Api { /// The name that needs to be fetched. Use user1 for testing. /// - public User GetUserByName (string? Username) { + public User GetUserByName (string Username) { // create path and map variables var path = "/user/{username}".Replace("{format}","json").Replace("{" + "username" + "}", apiInvoker.ParameterToString(Username)); @@ -341,7 +341,7 @@ namespace io.swagger.Api { /// Updated user object /// - public void UpdateUser (string? Username, User Body) { + public void UpdateUser (string Username, User Body) { // create path and map variables var path = "/user/{username}".Replace("{format}","json").Replace("{" + "username" + "}", apiInvoker.ParameterToString(Username)); @@ -389,7 +389,7 @@ namespace io.swagger.Api { /// The name that needs to be deleted /// - public void DeleteUser (string? Username) { + public void DeleteUser (string Username) { // create path and map variables var path = "/user/{username}".Replace("{format}","json").Replace("{" + "username" + "}", apiInvoker.ParameterToString(Username)); diff --git a/samples/client/petstore/csharp/src/main/csharp/io/swagger/Model/Category.cs b/samples/client/petstore/csharp/src/main/csharp/io/swagger/Model/Category.cs index 57a3c740b7e..bfe1c0c4be8 100644 --- a/samples/client/petstore/csharp/src/main/csharp/io/swagger/Model/Category.cs +++ b/samples/client/petstore/csharp/src/main/csharp/io/swagger/Model/Category.cs @@ -13,7 +13,7 @@ namespace io.swagger.Model { - public string? Name { get; set; } + public string Name { get; set; } diff --git a/samples/client/petstore/csharp/src/main/csharp/io/swagger/Model/Order.cs b/samples/client/petstore/csharp/src/main/csharp/io/swagger/Model/Order.cs index 70976be64b3..20a6d7367dd 100644 --- a/samples/client/petstore/csharp/src/main/csharp/io/swagger/Model/Order.cs +++ b/samples/client/petstore/csharp/src/main/csharp/io/swagger/Model/Order.cs @@ -29,7 +29,7 @@ namespace io.swagger.Model { /* Order Status */ - public string? Status { get; set; } + public string Status { get; set; } diff --git a/samples/client/petstore/csharp/src/main/csharp/io/swagger/Model/Pet.cs b/samples/client/petstore/csharp/src/main/csharp/io/swagger/Model/Pet.cs index 437368390f0..b0f3573b78c 100644 --- a/samples/client/petstore/csharp/src/main/csharp/io/swagger/Model/Pet.cs +++ b/samples/client/petstore/csharp/src/main/csharp/io/swagger/Model/Pet.cs @@ -18,12 +18,12 @@ namespace io.swagger.Model { - public string? Name { get; set; } + public string Name { get; set; } - public List PhotoUrls { get; set; } + public List PhotoUrls { get; set; } @@ -34,7 +34,7 @@ namespace io.swagger.Model { /* pet status in the store */ - public string? Status { get; set; } + public string Status { get; set; } diff --git a/samples/client/petstore/csharp/src/main/csharp/io/swagger/Model/PetTest.cs b/samples/client/petstore/csharp/src/main/csharp/io/swagger/Model/PetTest.cs new file mode 100644 index 00000000000..920e7eb2ee0 --- /dev/null +++ b/samples/client/petstore/csharp/src/main/csharp/io/swagger/Model/PetTest.cs @@ -0,0 +1,41 @@ +using System; +using System.Text; +using System.Collections; +using System.Collections.Generic; + +namespace io.swagger.Model { + public class PetTest { + + + + public long? Id { get; set; } + + + + + public Category Category { get; set; } + + + + + public string Name { get; set; } + + + + public override string ToString() { + var sb = new StringBuilder(); + sb.Append("class PetTest {\n"); + + sb.Append(" Id: ").Append(Id).Append("\n"); + + sb.Append(" Category: ").Append(Category).Append("\n"); + + sb.Append(" Name: ").Append(Name).Append("\n"); + + sb.Append("}\n"); + return sb.ToString(); + } + } + + +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/src/main/csharp/io/swagger/Model/Tag.cs b/samples/client/petstore/csharp/src/main/csharp/io/swagger/Model/Tag.cs index cc4f7df25ff..2fbf7070050 100644 --- a/samples/client/petstore/csharp/src/main/csharp/io/swagger/Model/Tag.cs +++ b/samples/client/petstore/csharp/src/main/csharp/io/swagger/Model/Tag.cs @@ -13,7 +13,7 @@ namespace io.swagger.Model { - public string? Name { get; set; } + public string Name { get; set; } diff --git a/samples/client/petstore/csharp/src/main/csharp/io/swagger/Model/User.cs b/samples/client/petstore/csharp/src/main/csharp/io/swagger/Model/User.cs index 23f9e246c30..146ba13c768 100644 --- a/samples/client/petstore/csharp/src/main/csharp/io/swagger/Model/User.cs +++ b/samples/client/petstore/csharp/src/main/csharp/io/swagger/Model/User.cs @@ -13,32 +13,32 @@ namespace io.swagger.Model { - public string? Username { get; set; } + public string Username { get; set; } - public string? FirstName { get; set; } + public string FirstName { get; set; } - public string? LastName { get; set; } + public string LastName { get; set; } - public string? Email { get; set; } + public string Email { get; set; } - public string? Password { get; set; } + public string Password { get; set; } - public string? Phone { get; set; } + public string Phone { get; set; }