forked from loafle/openapi-generator-original
fix NancyFX string parser (#4048)
* fix NancyFX string parser parser needs to access the Value parameter to enable the direct cast at line 102 when handling string parameters * Updated nancyfx sample
This commit is contained in:
parent
4f9ee0f93d
commit
27be0ed197
@ -134,7 +134,7 @@ namespace {{packageName}}.{{packageContext}}.Utils
|
|||||||
private static IDictionary<Type, Func<Parameter, object>> CreateParsers()
|
private static IDictionary<Type, Func<Parameter, object>> CreateParsers()
|
||||||
{
|
{
|
||||||
var parsers = ImmutableDictionary.CreateBuilder<Type, Func<Parameter, object>>();
|
var parsers = ImmutableDictionary.CreateBuilder<Type, Func<Parameter, object>>();
|
||||||
parsers.Put(typeof(string), value => value);
|
parsers.Put(typeof(string), value => value.Value);
|
||||||
parsers.Put(typeof(bool), SafeParse(bool.Parse));
|
parsers.Put(typeof(bool), SafeParse(bool.Parse));
|
||||||
parsers.Put(typeof(bool?), SafeParse(bool.Parse));
|
parsers.Put(typeof(bool?), SafeParse(bool.Parse));
|
||||||
parsers.Put(typeof(byte), SafeParse(byte.Parse));
|
parsers.Put(typeof(byte), SafeParse(byte.Parse));
|
||||||
|
@ -2,7 +2,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
|||||||
# Visual Studio 2012
|
# Visual Studio 2012
|
||||||
VisualStudioVersion = 12.0.0.0
|
VisualStudioVersion = 12.0.0.0
|
||||||
MinimumVisualStudioVersion = 10.0.0.1
|
MinimumVisualStudioVersion = 10.0.0.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{D198220E-91F6-402F-966F-8EF6105B1B75}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{1CE943E7-586D-4D9C-BE8B-3E005FDC39D1}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@ -10,10 +10,10 @@ Debug|Any CPU = Debug|Any CPU
|
|||||||
Release|Any CPU = Release|Any CPU
|
Release|Any CPU = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{D198220E-91F6-402F-966F-8EF6105B1B75}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{1CE943E7-586D-4D9C-BE8B-3E005FDC39D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{D198220E-91F6-402F-966F-8EF6105B1B75}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{1CE943E7-586D-4D9C-BE8B-3E005FDC39D1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{D198220E-91F6-402F-966F-8EF6105B1B75}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{1CE943E7-586D-4D9C-BE8B-3E005FDC39D1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{D198220E-91F6-402F-966F-8EF6105B1B75}.Release|Any CPU.Build.0 = Release|Any CPU
|
{1CE943E7-586D-4D9C-BE8B-3E005FDC39D1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
<ProjectGuid>{D198220E-91F6-402F-966F-8EF6105B1B75}</ProjectGuid>
|
<ProjectGuid>{1CE943E7-586D-4D9C-BE8B-3E005FDC39D1}</ProjectGuid>
|
||||||
<OutputType>Library</OutputType>
|
<OutputType>Library</OutputType>
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
<RootNamespace>IO.Swagger.v2</RootNamespace>
|
<RootNamespace>IO.Swagger.v2</RootNamespace>
|
||||||
|
@ -8,7 +8,7 @@ using NodaTime;
|
|||||||
namespace IO.Swagger.v2.Models
|
namespace IO.Swagger.v2.Models
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ApiResponse
|
/// Describes the result of uploading an image resource
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class ApiResponse: IEquatable<ApiResponse>
|
public sealed class ApiResponse: IEquatable<ApiResponse>
|
||||||
{
|
{
|
||||||
|
@ -8,7 +8,7 @@ using NodaTime;
|
|||||||
namespace IO.Swagger.v2.Models
|
namespace IO.Swagger.v2.Models
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Category
|
/// A category for a pet
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class Category: IEquatable<Category>
|
public sealed class Category: IEquatable<Category>
|
||||||
{
|
{
|
||||||
|
@ -8,7 +8,7 @@ using NodaTime;
|
|||||||
namespace IO.Swagger.v2.Models
|
namespace IO.Swagger.v2.Models
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Order
|
/// An order for a pets from the pet store
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class Order: IEquatable<Order>
|
public sealed class Order: IEquatable<Order>
|
||||||
{
|
{
|
||||||
|
@ -8,7 +8,7 @@ using NodaTime;
|
|||||||
namespace IO.Swagger.v2.Models
|
namespace IO.Swagger.v2.Models
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Pet
|
/// A pet for sale in the pet store
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class Pet: IEquatable<Pet>
|
public sealed class Pet: IEquatable<Pet>
|
||||||
{
|
{
|
||||||
|
@ -8,7 +8,7 @@ using NodaTime;
|
|||||||
namespace IO.Swagger.v2.Models
|
namespace IO.Swagger.v2.Models
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tag
|
/// A tag for a pet
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class Tag: IEquatable<Tag>
|
public sealed class Tag: IEquatable<Tag>
|
||||||
{
|
{
|
||||||
|
@ -8,7 +8,7 @@ using NodaTime;
|
|||||||
namespace IO.Swagger.v2.Models
|
namespace IO.Swagger.v2.Models
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// User
|
/// A User who is purchasing from the pet store
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class User: IEquatable<User>
|
public sealed class User: IEquatable<User>
|
||||||
{
|
{
|
||||||
|
@ -134,7 +134,7 @@ namespace IO.Swagger.v2.Utils
|
|||||||
private static IDictionary<Type, Func<Parameter, object>> CreateParsers()
|
private static IDictionary<Type, Func<Parameter, object>> CreateParsers()
|
||||||
{
|
{
|
||||||
var parsers = ImmutableDictionary.CreateBuilder<Type, Func<Parameter, object>>();
|
var parsers = ImmutableDictionary.CreateBuilder<Type, Func<Parameter, object>>();
|
||||||
parsers.Put(typeof(string), value => value);
|
parsers.Put(typeof(string), value => value.Value);
|
||||||
parsers.Put(typeof(bool), SafeParse(bool.Parse));
|
parsers.Put(typeof(bool), SafeParse(bool.Parse));
|
||||||
parsers.Put(typeof(bool?), SafeParse(bool.Parse));
|
parsers.Put(typeof(bool?), SafeParse(bool.Parse));
|
||||||
parsers.Put(typeof(byte), SafeParse(byte.Parse));
|
parsers.Put(typeof(byte), SafeParse(byte.Parse));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user