Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide validation APIs #1490

Merged
merged 1 commit into from
Aug 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions src/Polly.Core/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,6 @@ Polly.ResiliencePipelineBuilderBase.Name.get -> string?
Polly.ResiliencePipelineBuilderBase.Name.set -> void
Polly.ResiliencePipelineBuilderBase.TelemetryListener.get -> Polly.Telemetry.TelemetryListener?
Polly.ResiliencePipelineBuilderBase.TelemetryListener.set -> void
Polly.ResiliencePipelineBuilderBase.Validator.get -> System.Action<Polly.ResilienceValidationContext!>!
Polly.ResiliencePipelineBuilderExtensions
Polly.ResilienceProperties
Polly.ResilienceProperties.GetValue<TValue>(Polly.ResiliencePropertyKey<TValue> key, TValue defaultValue) -> TValue
Expand All @@ -281,10 +280,6 @@ Polly.ResilienceStrategyOptions
Polly.ResilienceStrategyOptions.Name.get -> string?
Polly.ResilienceStrategyOptions.Name.set -> void
Polly.ResilienceStrategyOptions.ResilienceStrategyOptions() -> void
Polly.ResilienceValidationContext
Polly.ResilienceValidationContext.Instance.get -> object!
Polly.ResilienceValidationContext.PrimaryMessage.get -> string!
Polly.ResilienceValidationContext.ResilienceValidationContext(object! instance, string! primaryMessage) -> void
Polly.Retry.OnRetryArguments
Polly.Retry.OnRetryArguments.AttemptNumber.get -> int
Polly.Retry.OnRetryArguments.ExecutionTime.get -> System.TimeSpan
Expand Down
3 changes: 1 addition & 2 deletions src/Polly.Core/ResiliencePipelineBuilderBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ private protected ResiliencePipelineBuilderBase(ResiliencePipelineBuilderBase ot
/// The validator should throw <see cref="ValidationException"/> when the validated instance is invalid.
/// </remarks>
/// <exception cref="ArgumentNullException">Thrown when the attempting to assign <see langword="null"/> to this property.</exception>
[EditorBrowsable(EditorBrowsableState.Never)]
public Action<ResilienceValidationContext> Validator { get; private protected set; } = ValidationHelper.ValidateObject;
internal Action<ResilienceValidationContext> Validator { get; private protected set; } = ValidationHelper.ValidateObject;

[RequiresUnreferencedCode(Constants.OptionsValidation)]
internal void AddStrategyCore(Func<StrategyBuilderContext, ResiliencePipeline> factory, ResilienceStrategyOptions options)
Expand Down
6 changes: 3 additions & 3 deletions src/Polly.Core/ResilienceValidationContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/// <summary>
/// The validation context that encapsulates parameters for the validation.
/// </summary>
public sealed class ResilienceValidationContext
internal sealed class ResilienceValidationContext
{
/// <summary>
/// Initializes a new instance of the <see cref="ResilienceValidationContext"/> class.
Expand All @@ -12,8 +12,8 @@ public sealed class ResilienceValidationContext
/// <param name="primaryMessage">The primary validation message.</param>
public ResilienceValidationContext(object instance, string primaryMessage)
{
Instance = Guard.NotNull(instance);
PrimaryMessage = Guard.NotNull(primaryMessage);
Instance = Polly.Utils.Guard.NotNull(instance);
PrimaryMessage = Polly.Utils.Guard.NotNull(primaryMessage);
}

/// <summary>
Expand Down
2 changes: 2 additions & 0 deletions src/Polly.Extensions/Polly.Extensions.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@
<EnableAotAnalyzer>true</EnableAotAnalyzer>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\Polly.Core\ResilienceValidationContext.cs" Link="Utils\ResilienceValidationContext.cs" />
<Compile Include="..\Polly.Core\Utils\Guard.cs" Link="Utils\Guard.cs" />
<Compile Include="..\Polly.Core\Utils\ObjectPool.cs" Link="Utils\ObjectPool.cs" />
<Compile Include="..\Polly.Core\ToBeRemoved\TimeProvider.cs" Link="ToBeRemoved\TimeProvider.cs" />
<Compile Include="..\Polly.Core\Utils\ValidationHelper.cs" Link="Utils\ValidationHelper.cs" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static TBuilder ConfigureTelemetry<TBuilder>(this TBuilder builder, Telem
Guard.NotNull(builder);
Guard.NotNull(options);

builder.Validator(new(options, $"The '{nameof(TelemetryOptions)}' are invalid."));
ValidationHelper.ValidateObject(new(options, $"The '{nameof(TelemetryOptions)}' are invalid."));
builder.TelemetryListener = new TelemetryListenerImpl(options);

return builder;
Expand Down