fix string?

This commit is contained in:
wing328 2015-04-21 23:16:17 +08:00
parent 2c0e8f6079
commit eed04560c0
10 changed files with 73 additions and 32 deletions

View File

@ -50,7 +50,7 @@ public class CSharpClientCodegen extends DefaultCodegen implements CodegenConfig
languageSpecificPrimitives = new HashSet<String>( languageSpecificPrimitives = new HashSet<String>(
Arrays.asList( Arrays.asList(
"string?", "string",
"bool?", "bool?",
"double?", "double?",
"int?", "int?",
@ -72,7 +72,7 @@ public class CSharpClientCodegen extends DefaultCodegen implements CodegenConfig
instantiationTypes.put("map", "Dictionary"); instantiationTypes.put("map", "Dictionary");
typeMapping = new HashMap<String, String>(); typeMapping = new HashMap<String, String>();
typeMapping.put("string", "string?"); typeMapping.put("string", "string");
typeMapping.put("boolean", "bool?"); typeMapping.put("boolean", "bool?");
typeMapping.put("integer", "int?"); typeMapping.put("integer", "int?");
typeMapping.put("float", "float?"); typeMapping.put("float", "float?");

View File

@ -132,7 +132,7 @@ namespace io.swagger.Api {
/// <param name="Status">Status values that need to be considered for filter</param> /// <param name="Status">Status values that need to be considered for filter</param>
/// <returns></returns> /// <returns></returns>
public List<Pet> FindPetsByStatus (List<string?> Status) { public List<Pet> FindPetsByStatus (List<string> Status) {
// create path and map variables // create path and map variables
var path = "/pet/findByStatus".Replace("{format}","json"); var path = "/pet/findByStatus".Replace("{format}","json");
@ -188,7 +188,7 @@ namespace io.swagger.Api {
/// <param name="Tags">Tags to filter by</param> /// <param name="Tags">Tags to filter by</param>
/// <returns></returns> /// <returns></returns>
public List<Pet> FindPetsByTags (List<string?> Tags) { public List<Pet> FindPetsByTags (List<string> Tags) {
// create path and map variables // create path and map variables
var path = "/pet/findByTags".Replace("{format}","json"); var path = "/pet/findByTags".Replace("{format}","json");
@ -244,7 +244,7 @@ namespace io.swagger.Api {
/// <param name="PetId">ID of pet that needs to be fetched</param> /// <param name="PetId">ID of pet that needs to be fetched</param>
/// <returns></returns> /// <returns></returns>
public PetTest GetPetById (long? PetId) { public Pet GetPetById (long? PetId) {
// create path and map variables // create path and map variables
var path = "/pet/{petId}".Replace("{format}","json").Replace("{" + "petId" + "}", apiInvoker.ParameterToString(PetId)); var path = "/pet/{petId}".Replace("{format}","json").Replace("{" + "petId" + "}", apiInvoker.ParameterToString(PetId));
@ -262,17 +262,17 @@ namespace io.swagger.Api {
try { try {
if (typeof(PetTest) == typeof(byte[])) { if (typeof(Pet) == typeof(byte[])) {
var response = apiInvoker.invokeBinaryAPI(basePath, path, "GET", queryParams, null, headerParams, formParams); var response = apiInvoker.invokeBinaryAPI(basePath, path, "GET", queryParams, null, headerParams, formParams);
return ((object)response) as PetTest; return ((object)response) as Pet;
} else { } else {
var response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, formParams); var response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, formParams);
if (response != null){ if (response != null){
return (PetTest) ApiInvoker.deserialize(response, typeof(PetTest)); return (Pet) ApiInvoker.deserialize(response, typeof(Pet));
} }
else { else {
return null; return null;
@ -299,7 +299,7 @@ namespace io.swagger.Api {
/// <param name="Status">Updated status of the pet</param> /// <param name="Status">Updated status of the pet</param>
/// <returns></returns> /// <returns></returns>
public void UpdatePetWithForm (string? PetId, string? Name, string? Status) { public void UpdatePetWithForm (string PetId, string Name, string Status) {
// create path and map variables // create path and map variables
var path = "/pet/{petId}".Replace("{format}","json").Replace("{" + "petId" + "}", apiInvoker.ParameterToString(PetId)); var path = "/pet/{petId}".Replace("{format}","json").Replace("{" + "petId" + "}", apiInvoker.ParameterToString(PetId));
@ -362,7 +362,7 @@ namespace io.swagger.Api {
/// <param name="PetId">Pet id to delete</param> /// <param name="PetId">Pet id to delete</param>
/// <returns></returns> /// <returns></returns>
public void DeletePet (string? ApiKey, long? PetId) { public void DeletePet (string ApiKey, long? PetId) {
// create path and map variables // create path and map variables
var path = "/pet/{petId}".Replace("{format}","json").Replace("{" + "petId" + "}", apiInvoker.ParameterToString(PetId)); var path = "/pet/{petId}".Replace("{format}","json").Replace("{" + "petId" + "}", apiInvoker.ParameterToString(PetId));
@ -413,7 +413,7 @@ namespace io.swagger.Api {
/// <param name="File">file to upload</param> /// <param name="File">file to upload</param>
/// <returns></returns> /// <returns></returns>
public void UploadFile (long? PetId, string? AdditionalMetadata, byte[] File) { public void UploadFile (long? PetId, string AdditionalMetadata, byte[] File) {
// create path and map variables // create path and map variables
var path = "/pet/{petId}/uploadImage".Replace("{format}","json").Replace("{" + "petId" + "}", apiInvoker.ParameterToString(PetId)); var path = "/pet/{petId}/uploadImage".Replace("{format}","json").Replace("{" + "petId" + "}", apiInvoker.ParameterToString(PetId));

View File

@ -141,7 +141,7 @@ namespace io.swagger.Api {
/// <param name="OrderId">ID of pet that needs to be fetched</param> /// <param name="OrderId">ID of pet that needs to be fetched</param>
/// <returns></returns> /// <returns></returns>
public Order GetOrderById (string? OrderId) { public Order GetOrderById (string OrderId) {
// create path and map variables // create path and map variables
var path = "/store/order/{orderId}".Replace("{format}","json").Replace("{" + "orderId" + "}", apiInvoker.ParameterToString(OrderId)); var path = "/store/order/{orderId}".Replace("{format}","json").Replace("{" + "orderId" + "}", apiInvoker.ParameterToString(OrderId));
@ -194,7 +194,7 @@ namespace io.swagger.Api {
/// <param name="OrderId">ID of the order that needs to be deleted</param> /// <param name="OrderId">ID of the order that needs to be deleted</param>
/// <returns></returns> /// <returns></returns>
public void DeleteOrder (string? OrderId) { public void DeleteOrder (string OrderId) {
// create path and map variables // create path and map variables
var path = "/store/order/{orderId}".Replace("{format}","json").Replace("{" + "orderId" + "}", apiInvoker.ParameterToString(OrderId)); var path = "/store/order/{orderId}".Replace("{format}","json").Replace("{" + "orderId" + "}", apiInvoker.ParameterToString(OrderId));

View File

@ -181,7 +181,7 @@ namespace io.swagger.Api {
/// <param name="Password">The password for login in clear text</param> /// <param name="Password">The password for login in clear text</param>
/// <returns></returns> /// <returns></returns>
public string? LoginUser (string? Username, string? Password) { public string LoginUser (string Username, string Password) {
// create path and map variables // create path and map variables
var path = "/user/login".Replace("{format}","json"); var path = "/user/login".Replace("{format}","json");
@ -205,17 +205,17 @@ namespace io.swagger.Api {
try { try {
if (typeof(string?) == typeof(byte[])) { if (typeof(string) == typeof(byte[])) {
var response = apiInvoker.invokeBinaryAPI(basePath, path, "GET", queryParams, null, headerParams, formParams); var response = apiInvoker.invokeBinaryAPI(basePath, path, "GET", queryParams, null, headerParams, formParams);
return ((object)response) as string?; return ((object)response) as string;
} else { } else {
var response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, formParams); var response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, formParams);
if (response != null){ if (response != null){
return (string?) ApiInvoker.deserialize(response, typeof(string?)); return (string) ApiInvoker.deserialize(response, typeof(string));
} }
else { else {
return null; return null;
@ -287,7 +287,7 @@ namespace io.swagger.Api {
/// <param name="Username">The name that needs to be fetched. Use user1 for testing. </param> /// <param name="Username">The name that needs to be fetched. Use user1 for testing. </param>
/// <returns></returns> /// <returns></returns>
public User GetUserByName (string? Username) { public User GetUserByName (string Username) {
// create path and map variables // create path and map variables
var path = "/user/{username}".Replace("{format}","json").Replace("{" + "username" + "}", apiInvoker.ParameterToString(Username)); var path = "/user/{username}".Replace("{format}","json").Replace("{" + "username" + "}", apiInvoker.ParameterToString(Username));
@ -341,7 +341,7 @@ namespace io.swagger.Api {
/// <param name="Body">Updated user object</param> /// <param name="Body">Updated user object</param>
/// <returns></returns> /// <returns></returns>
public void UpdateUser (string? Username, User Body) { public void UpdateUser (string Username, User Body) {
// create path and map variables // create path and map variables
var path = "/user/{username}".Replace("{format}","json").Replace("{" + "username" + "}", apiInvoker.ParameterToString(Username)); var path = "/user/{username}".Replace("{format}","json").Replace("{" + "username" + "}", apiInvoker.ParameterToString(Username));
@ -389,7 +389,7 @@ namespace io.swagger.Api {
/// <param name="Username">The name that needs to be deleted</param> /// <param name="Username">The name that needs to be deleted</param>
/// <returns></returns> /// <returns></returns>
public void DeleteUser (string? Username) { public void DeleteUser (string Username) {
// create path and map variables // create path and map variables
var path = "/user/{username}".Replace("{format}","json").Replace("{" + "username" + "}", apiInvoker.ParameterToString(Username)); var path = "/user/{username}".Replace("{format}","json").Replace("{" + "username" + "}", apiInvoker.ParameterToString(Username));

View File

@ -13,7 +13,7 @@ namespace io.swagger.Model {
public string? Name { get; set; } public string Name { get; set; }

View File

@ -29,7 +29,7 @@ namespace io.swagger.Model {
/* Order Status */ /* Order Status */
public string? Status { get; set; } public string Status { get; set; }

View File

@ -18,12 +18,12 @@ namespace io.swagger.Model {
public string? Name { get; set; } public string Name { get; set; }
public List<string?> PhotoUrls { get; set; } public List<string> PhotoUrls { get; set; }
@ -34,7 +34,7 @@ namespace io.swagger.Model {
/* pet status in the store */ /* pet status in the store */
public string? Status { get; set; } public string Status { get; set; }

View File

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

View File

@ -13,7 +13,7 @@ namespace io.swagger.Model {
public string? Name { get; set; } public string Name { get; set; }

View File

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