Permalink
Browse files

Fixed issue with media formatters not being reported

  • Loading branch information...
1 parent 697ec6c commit ce08640121f7644aa98005906125080b66fb9efb @davidsavagejr committed Oct 11, 2012
Showing with 11 additions and 20 deletions.
  1. +11 −20 src/SDammann.WebApi.Versioning/VersionedApiExplorer.cs
@@ -166,17 +166,22 @@ private void PopulateActionDescriptions(HttpActionDescriptor actionDescriptor, I
foreach (HttpMethod method in supportedMethods)
{
- apiDescriptions.Add(new VersionedApiDescription()
+ var description = new ApiDescription()
{
Documentation = apiDocumentation,
HttpMethod = method,
RelativePath = finalPath,
ActionDescriptor = actionDescriptor,
- Route = route,
- SupportedResponseFormatters = new Collection<MediaTypeFormatter>(supportedResponseFormatters.ToList()),
- SupportedRequestBodyFormatters = new Collection<MediaTypeFormatter>(supportedRequestBodyFormatters.ToList()),
- ParameterDescriptions = new Collection<ApiParameterDescription>(parameterDescriptions)
- });
+ Route = route
+ };
+ foreach(var mtf in supportedRequestBodyFormatters)
+ description.SupportedRequestBodyFormatters.Add(mtf);
+ foreach(var mtf in supportedResponseFormatters)
+ description.SupportedResponseFormatters.Add(mtf);
+ foreach(var par in parameterDescriptions)
+ description.ParameterDescriptions.Add(par);
+
+ apiDescriptions.Add(description);
}
}
@@ -340,18 +345,4 @@ public static string Version(this HttpControllerDescriptor controllerDescriptor)
return version;
}
}
-
- internal class VersionedApiDescription : ApiDescription
- {
- public VersionedApiDescription()
- {
- SupportedRequestBodyFormatters = new Collection<MediaTypeFormatter>();
- SupportedResponseFormatters = new Collection<MediaTypeFormatter>();
- ParameterDescriptions = new Collection<ApiParameterDescription>();
- }
-
- public new Collection<MediaTypeFormatter> SupportedResponseFormatters { get; internal set; }
- public new Collection<MediaTypeFormatter> SupportedRequestBodyFormatters { get; internal set; }
- public new Collection<ApiParameterDescription> ParameterDescriptions { get; internal set; }
- }
}

0 comments on commit ce08640

Please sign in to comment.