Skip to content

Commit

Permalink
fix NancyFX string parser (#4048)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
simo9000 authored and wing328 committed Oct 22, 2016
1 parent 4f9ee0f commit 27be0ed
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ namespace {{packageName}}.{{packageContext}}.Utils
private static IDictionary<Type, Func<Parameter, object>> CreateParsers()
{
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(byte), SafeParse(byte.Parse));
Expand Down Expand Up @@ -411,4 +411,4 @@ namespace {{packageName}}.{{packageContext}}.Utils
Path,
Header
}
}
}
10 changes: 5 additions & 5 deletions samples/server/petstore/nancyfx/IO.Swagger.sln
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
VisualStudioVersion = 12.0.0.0
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
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D198220E-91F6-402F-966F-8EF6105B1B75}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D198220E-91F6-402F-966F-8EF6105B1B75}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D198220E-91F6-402F-966F-8EF6105B1B75}.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}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1CE943E7-586D-4D9C-BE8B-3E005FDC39D1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1CE943E7-586D-4D9C-BE8B-3E005FDC39D1}.Release|Any CPU.ActiveCfg = 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.Build.0 = Debug|Any CPU
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{D198220E-91F6-402F-966F-8EF6105B1B75}</ProjectGuid>
<ProjectGuid>{1CE943E7-586D-4D9C-BE8B-3E005FDC39D1}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>IO.Swagger.v2</RootNamespace>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace IO.Swagger.v2.Models
{
/// <summary>
/// ApiResponse
/// Describes the result of uploading an image resource
/// </summary>
public sealed class ApiResponse: IEquatable<ApiResponse>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace IO.Swagger.v2.Models
{
/// <summary>
/// Category
/// A category for a pet
/// </summary>
public sealed class Category: IEquatable<Category>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace IO.Swagger.v2.Models
{
/// <summary>
/// Order
/// An order for a pets from the pet store
/// </summary>
public sealed class Order: IEquatable<Order>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace IO.Swagger.v2.Models
{
/// <summary>
/// Pet
/// A pet for sale in the pet store
/// </summary>
public sealed class Pet: IEquatable<Pet>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace IO.Swagger.v2.Models
{
/// <summary>
/// Tag
/// A tag for a pet
/// </summary>
public sealed class Tag: IEquatable<Tag>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace IO.Swagger.v2.Models
{
/// <summary>
/// User
/// A User who is purchasing from the pet store
/// </summary>
public sealed class User: IEquatable<User>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ private static TValue DynamicValueOf<TValue>(dynamic parameters, string name)
private static IDictionary<Type, Func<Parameter, object>> CreateParsers()
{
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(byte), SafeParse(byte.Parse));
Expand Down Expand Up @@ -411,4 +411,4 @@ internal enum ParameterType
Path,
Header
}
}
}

0 comments on commit 27be0ed

Please sign in to comment.