Skip to content

Commit

Permalink
Fix gaps in final commit for aspnet#258 (c9ab0b4)
Browse files Browse the repository at this point in the history
- register `DefaultWebHookMetadataProvider` in DI
- correct names of resources
  • Loading branch information
dougbu authored and WestDiscGolf committed Apr 17, 2018
1 parent 5a7ce76 commit eca20df
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 16 deletions.
Expand Up @@ -380,7 +380,7 @@ protected void EnsureValidBodyTypeMetadata(IWebHookBodyTypeMetadata bodyTypeMeta
{
var message = string.Format(
CultureInfo.CurrentCulture,
Resources.MetadataProvider_MissingMetadata,
Resources.PropertyProvider_MissingMetadata,
receiverName,
typeof(IWebHookBodyTypeMetadataService));
throw new InvalidOperationException(message);
Expand Down Expand Up @@ -410,7 +410,7 @@ protected void EnsureValidEventMetadata(IWebHookEventMetadata eventMetadata, str
// IWebHookEventMetadata is mandatory when performing action selection using event names.
var message = string.Format(
CultureInfo.CurrentCulture,
Resources.MetadataProvider_MissingMetadataServices,
Resources.PropertyProvider_MissingMetadataServices,
receiverName,
typeof(IWebHookEventSelectorMetadata),
typeof(IWebHookEventMetadata));
Expand Down Expand Up @@ -449,7 +449,7 @@ protected void EnsureValidEventMetadata(IWebHookEventMetadata eventMetadata, str
{
var message = string.Format(
CultureInfo.CurrentCulture,
Resources.MetadataProvider_ConflictingMetadataServices,
Resources.PropertyProvider_ConflictingMetadataServices,
receiverWithConflictingMetadata.ReceiverName,
typeof(IWebHookEventFromBodyMetadata),
typeof(IWebHookEventMetadata));
Expand Down Expand Up @@ -484,7 +484,7 @@ protected void EnsureUniqueRegistrations<TService>(IReadOnlyList<TService> servi
{
var message = string.Format(
CultureInfo.CurrentCulture,
Resources.MetadataProvider_DuplicateMetadata,
Resources.PropertyProvider_DuplicateMetadata,
duplicateMetadataGroup.Key, // ReceiverName
typeof(TService));
throw new InvalidOperationException(message);
Expand Down
Expand Up @@ -7,6 +7,7 @@
using Microsoft.AspNetCore.WebHooks;
using Microsoft.AspNetCore.WebHooks.ApplicationModels;
using Microsoft.AspNetCore.WebHooks.Filters;
using Microsoft.AspNetCore.WebHooks.Metadata;
using Microsoft.Extensions.DependencyInjection.Extensions;

namespace Microsoft.Extensions.DependencyInjection
Expand All @@ -27,6 +28,8 @@ public static void AddWebHookServices(IServiceCollection services)
throw new ArgumentNullException(nameof(services));
}

services.TryAddSingleton<WebHookMetadataProvider, DefaultWebHookMetadataProvider>();

services.TryAddEnumerable(
ServiceDescriptor.Transient<IApplicationModelProvider, WebHookActionModelFilterProvider>());
services.TryAddEnumerable(
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Expand Up @@ -135,16 +135,16 @@
<data name="GetRequest_NoQueryParameter" xml:space="preserve">
<value>A '{0}' WebHook verification request must contain a '{1}' query parameter.</value>
</data>
<data name="MetadataProvider_ConflictingMetadataServices" xml:space="preserve">
<data name="PropertyProvider_ConflictingMetadataServices" xml:space="preserve">
<value>Invalid metadata services found for the '{0}' WebHook receiver. Receivers must not provide both '{1}' and '{2}' services.</value>
</data>
<data name="MetadataProvider_DuplicateMetadata" xml:space="preserve">
<data name="PropertyProvider_DuplicateMetadata" xml:space="preserve">
<value>Invalid metadata services found for the '{0}' WebHook receiver. Receivers must not have more than one '{1}' registration.</value>
</data>
<data name="MetadataProvider_MissingMetadata" xml:space="preserve">
<data name="PropertyProvider_MissingMetadata" xml:space="preserve">
<value>Invalid metadata services found for the '{0}' WebHook receiver. Receiver must have an '{1}' implementation.</value>
</data>
<data name="MetadataProvider_MissingMetadataServices" xml:space="preserve">
<data name="PropertyProvider_MissingMetadataServices" xml:space="preserve">
<value>Invalid metadata services found for the '{0}' WebHook receiver. Receivers with attributes implementing '{1}' must also provide a '{2}' service.</value>
</data>
<data name="RequestReader_ModelBindingFailed" xml:space="preserve">
Expand Down

0 comments on commit eca20df

Please sign in to comment.