From 333949764e5ee46c3ee915bb99b97a00f437b90f Mon Sep 17 00:00:00 2001 From: Abel Silva Date: Mon, 9 May 2016 23:31:24 +0100 Subject: [PATCH] Fix for complex properties on definitions --- src/SwaggerWcf/Properties/AssemblyInfo.cs | 6 +++--- src/SwaggerWcf/Support/Helpers.cs | 8 +++++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/SwaggerWcf/Properties/AssemblyInfo.cs b/src/SwaggerWcf/Properties/AssemblyInfo.cs index e636fca..353d17f 100644 --- a/src/SwaggerWcf/Properties/AssemblyInfo.cs +++ b/src/SwaggerWcf/Properties/AssemblyInfo.cs @@ -37,6 +37,6 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.1.7")] -[assembly: AssemblyFileVersion("0.1.7")] -[assembly: AssemblyInformationalVersion("0.1.7")] +[assembly: AssemblyVersion("0.1.8")] +[assembly: AssemblyFileVersion("0.1.8")] +[assembly: AssemblyInformationalVersion("0.1.8")] diff --git a/src/SwaggerWcf/Support/Helpers.cs b/src/SwaggerWcf/Support/Helpers.cs index b6bcf5d..fab5c07 100644 --- a/src/SwaggerWcf/Support/Helpers.cs +++ b/src/SwaggerWcf/Support/Helpers.cs @@ -94,13 +94,19 @@ public static TypeFormat MapSwaggerType(Type type, IList definitions) { return new TypeFormat(ParameterType.String, "enum"); } - + //it's a collection/array, so it will use the swagger "container" syntax if (type.GetInterfaces().Any(i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof(IEnumerable<>))) { return new TypeFormat(ParameterType.Array, null); } + //it's a collection/array, so it will use the swagger "container" syntax + if (type.GetInterfaces().Any(i => i == typeof(System.Collections.IEnumerable))) + { + return new TypeFormat(ParameterType.Array, null); + } + //it's a complex type, so we'll need to map it later if (definitions != null && !definitions.Contains(type)) {