[csharp] Fixed isMap property (#13482)

* fixed data type for maps

* fighting line endings

* fighting line endings

* removed commented code

* reverted unintended line break

* reverted unintended line break

* reverted unintended line break
This commit is contained in:
devhl-labs 2022-09-26 23:10:10 -04:00 committed by GitHub
parent 36976d5c72
commit 4e54b07076
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 15 additions and 15 deletions

View File

@ -118,7 +118,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
);
mapTypes = new HashSet<>(
Arrays.asList("IDictionary")
Arrays.asList("IDictionary", "Dictionary")
);
// NOTE: C# uses camel cased reserved words, while models are title cased. We don't want lowercase comparisons.
@ -712,7 +712,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
}
} else {
operation.returnContainer = operation.returnType;
operation.isMap = this.mapTypes.contains(typeMapping);
operation.isMap = this.mapTypes.stream().anyMatch(t -> typeMapping.startsWith(t));
}
}

View File

@ -1,4 +1,4 @@
var example = exampleJson != null
? JsonConvert.DeserializeObject<Dictionary<{{{returnType}}}>>(exampleJson)
: new Dictionary<{{{returnType}}}>();
? JsonConvert.DeserializeObject<{{{returnType}}}>(exampleJson)
: new {{{returnType}}}();

View File

@ -1,4 +1,4 @@
var example = exampleJson != null
? JsonConvert.DeserializeObject<Dictionary<{{{returnType}}}>>(exampleJson)
: new Dictionary<{{{returnType}}}>();
? JsonConvert.DeserializeObject<{{{returnType}}}>(exampleJson)
: new {{{returnType}}}();

View File

@ -1,4 +1,4 @@
var example = exampleJson != null
? JsonConvert.DeserializeObject<Dictionary<{{{returnType}}}>>(exampleJson)
: new Dictionary<{{{returnType}}}>();
? JsonConvert.DeserializeObject<{{{returnType}}}>(exampleJson)
: new {{{returnType}}}();

View File

@ -70,7 +70,7 @@ namespace Org.OpenAPITools.Controllers
var example = exampleJson != null
? JsonConvert.DeserializeObject<Dictionary<string, int>>(exampleJson)
: default(Dictionary<string, int>);
: new Dictionary<string, int>();
//TODO: Change the data returned
return new ObjectResult(example);
}

View File

@ -70,7 +70,7 @@ namespace Org.OpenAPITools.Controllers
var example = exampleJson != null
? JsonConvert.DeserializeObject<Dictionary<string, int>>(exampleJson)
: default(Dictionary<string, int>);
: new Dictionary<string, int>();
//TODO: Change the data returned
return new ObjectResult(example);
}

View File

@ -70,7 +70,7 @@ namespace Org.OpenAPITools.Controllers
var example = exampleJson != null
? JsonConvert.DeserializeObject<Dictionary<string, int>>(exampleJson)
: default(Dictionary<string, int>);
: new Dictionary<string, int>();
//TODO: Change the data returned
return new ObjectResult(example);
}

View File

@ -70,7 +70,7 @@ namespace Org.OpenAPITools.Controllers
var example = exampleJson != null
? JsonConvert.DeserializeObject<Dictionary<string, int>>(exampleJson)
: default(Dictionary<string, int>);
: new Dictionary<string, int>();
//TODO: Change the data returned
return new ObjectResult(example);
}

View File

@ -70,7 +70,7 @@ namespace Org.OpenAPITools.Controllers
var example = exampleJson != null
? JsonConvert.DeserializeObject<Dictionary<string, int>>(exampleJson)
: default(Dictionary<string, int>);
: new Dictionary<string, int>();
//TODO: Change the data returned
return new ObjectResult(example);
}

View File

@ -70,7 +70,7 @@ namespace Org.OpenAPITools.Controllers
var example = exampleJson != null
? JsonConvert.DeserializeObject<Dictionary<string, int>>(exampleJson)
: default(Dictionary<string, int>);
: new Dictionary<string, int>();
//TODO: Change the data returned
return new ObjectResult(example);
}

View File

@ -70,7 +70,7 @@ namespace Org.OpenAPITools.Controllers
var example = exampleJson != null
? JsonConvert.DeserializeObject<Dictionary<string, int>>(exampleJson)
: default(Dictionary<string, int>);
: new Dictionary<string, int>();
//TODO: Change the data returned
return new ObjectResult(example);
}