Skip to content

Commit

Permalink
Refactor deferred binding attributes (#1723)
Browse files Browse the repository at this point in the history
  • Loading branch information
liliankasem committed Jul 13, 2023
1 parent 46273d8 commit cb7a45b
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace Microsoft.Azure.Functions.Worker
{
[AllowConverterFallback(true)]
[ConverterFallbackBehavior(ConverterFallbackBehavior.Default)]
[InputConverter(typeof(EventGridCloudEventConverter))]
[InputConverter(typeof(EventGridEventConverter))]
[InputConverter(typeof(EventGridBinaryDataConverter))]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ namespace Microsoft.Azure.Functions.Worker.Extensions.EventGrid.TypeConverters
/// <summary>
/// Converter to bind to <see cref="BinaryData" /> or <see cref="BinaryData[]" /> type parameters.
/// </summary>
[SupportedConverterType(typeof(BinaryData))]
[SupportedConverterType(typeof(BinaryData[]))]
[SupportedTargetType(typeof(BinaryData))]
[SupportedTargetType(typeof(BinaryData[]))]
internal class EventGridBinaryDataConverter : EventGridConverterBase
{
protected override ConversionResult ConvertCore(Type targetType, string json)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ namespace Microsoft.Azure.Functions.Worker.Extensions.EventGrid.TypeConverters
/// <summary>
/// Converter to bind to <see cref="CloudEvent" /> or <see cref="CloudEvent[]" /> type parameters.
/// </summary>
[SupportedConverterType(typeof(CloudEvent))]
[SupportedConverterType(typeof(CloudEvent[]))]
[SupportedTargetType(typeof(CloudEvent))]
[SupportedTargetType(typeof(CloudEvent[]))]
internal class EventGridCloudEventConverter: EventGridConverterBase
{
protected override ConversionResult ConvertCore(Type targetType, string json)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ namespace Microsoft.Azure.Functions.Worker.Extensions.EventGrid.TypeConverters
/// <summary>
/// Converter to bind to <see cref="EventGridEvent" /> or <see cref="EventGridEvent[]" /> type parameters.
/// </summary>
[SupportedConverterType(typeof(EventGridEvent))]
[SupportedConverterType(typeof(EventGridEvent[]))]
[SupportedTargetType(typeof(EventGridEvent))]
[SupportedTargetType(typeof(EventGridEvent[]))]
internal class EventGridEventConverter : EventGridConverterBase
{
protected override ConversionResult ConvertCore(Type targetType, string json)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace Microsoft.Azure.Functions.Worker.Extensions.EventGrid.TypeConverters
/// <summary>
/// Converter to bind to <see cref="string[]" /> type parameters.
/// </summary>
[SupportedConverterType(typeof(string[]))]
[SupportedTargetType(typeof(string[]))]
internal class EventGridStringArrayConverter : EventGridConverterBase
{
protected override ConversionResult ConvertCore(Type targetType, string json)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ private bool DoesConverterSupportDeferredBinding(TypedConstant converter, string

if (!converterAdvertisesTypes)
{
// If a converter advertises deferred binding but does not explictly advertise any types then DeferredBinding will be supported for all the types
// If a converter advertises deferred binding but does not explicitly advertise any types then DeferredBinding will be supported for all the types
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ public async Task Convert_Using_Advertised_Converter_Specified_In_ConverterConte
IReadOnlyDictionary<string, object> properties = new Dictionary<string, object>()
{
{ PropertyBagKeys.BindingAttributeSupportedConverters, new Dictionary<Type, List<Type>>() { {
typeof(MySimpleSyncInputConverter2), new List<Type>() } } },
typeof(MySimpleSyncInputConverter2), new List<Type>() } } },
{ PropertyBagKeys.ConverterFallbackBehavior, ConverterFallbackBehavior.Disallow }
};
var converterContext = CreateConverterContext(typeof(Poco[]), "0c67c078-7213-4e91-ad41-f8747c865f3d", properties);
Expand All @@ -225,7 +225,7 @@ public async Task Convert_Using_Advertised_Converter_Specified_In_ConverterConte
IReadOnlyDictionary<string, object> properties = new Dictionary<string, object>()
{
{ PropertyBagKeys.BindingAttributeSupportedConverters, new Dictionary<Type, List<Type>>() { {
typeof(MySimpleSyncInputConverter2), null } } },
typeof(MySimpleSyncInputConverter2), null } } },
{ PropertyBagKeys.ConverterFallbackBehavior, ConverterFallbackBehavior.Disallow }
};
var converterContext = CreateConverterContext(typeof(IEnumerable<string>), "0c67c078-7213-4e91-ad41-f8747c865f3d", properties);
Expand Down

0 comments on commit cb7a45b

Please sign in to comment.