Skip to content
Permalink
Browse files

Small modificaiton to CSharpTypeResolver to restore binary capability (

…#1053)

Changed evaluation order slightly to allow `type: "string", format: "binary"` to resolve to a `byte[]` type, which is otherwise not possible.
  • Loading branch information...
owainc authored and RicoSuter committed Sep 1, 2019
1 parent 911d2fd commit 817d273c6bcd3f0dfc6debc8a14040e8cefc2cbd
Showing with 4 additions and 4 deletions.
  1. +4 −4 src/NJsonSchema.CodeGeneration.CSharp/CSharpTypeResolver.cs
@@ -107,14 +107,14 @@ public string Resolve(JsonSchema schema, bool isNullable, string typeNameHint, b
return ResolveBoolean(isNullable);
}

if (type.HasFlag(JsonObjectType.String) && !schema.ActualTypeSchema.IsEnumeration)
if (schema.IsBinary)
{
return ResolveString(schema.ActualTypeSchema, isNullable, typeNameHint);
return "byte[]";
}

if (schema.IsBinary)
if (type.HasFlag(JsonObjectType.String) && !schema.ActualTypeSchema.IsEnumeration)
{
return "byte[]";
return ResolveString(schema.ActualTypeSchema, isNullable, typeNameHint);
}

// Type generating schemas

0 comments on commit 817d273

Please sign in to comment.
You can’t perform that action at this time.