Skip to content

Commit

Permalink
Hide validation APIs (#1490)
Browse files Browse the repository at this point in the history
  • Loading branch information
martintmk authored Aug 15, 2023
1 parent 02687e8 commit fc8642b
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 11 deletions.
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

0 comments on commit fc8642b

Please sign in to comment.