forked from loafle/openapi-generator-original
NancyFx:
- Skipping parsing nulls of nullable types
This commit is contained in:
parent
a458e53e25
commit
adb02a030f
@ -20,6 +20,10 @@ namespace {{packageName}}.{{packageContext}}.Utils
|
|||||||
var isNullable = default(TValue) == null;
|
var isNullable = default(TValue) == null;
|
||||||
string value = RawValue(parameters, name);
|
string value = RawValue(parameters, name);
|
||||||
Preconditions.Evaluate(!string.IsNullOrEmpty(value) || isNullable, string.Format("Required parameter: '{0}' is missing", name));
|
Preconditions.Evaluate(!string.IsNullOrEmpty(value) || isNullable, string.Format("Required parameter: '{0}' is missing", name));
|
||||||
|
if (value == null && isNullable)
|
||||||
|
{
|
||||||
|
return default(TValue);
|
||||||
|
}
|
||||||
if (valueType.IsEnum || (valueUnderlyingType != null && valueUnderlyingType.IsEnum))
|
if (valueType.IsEnum || (valueUnderlyingType != null && valueUnderlyingType.IsEnum))
|
||||||
{
|
{
|
||||||
return EnumValueOf<TValue>(name, value);
|
return EnumValueOf<TValue>(name, value);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user