Skip to content

Commit

Permalink
fix: Remove config validation in constructors (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mielek authored Jan 10, 2025
1 parent 860ef46 commit 61cee0a
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 32 deletions.
8 changes: 0 additions & 8 deletions src/Authoring/Configs/ForwardRequestConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,4 @@ public record ForwardRequestConfig
/// When set to true, triggers on-error section for response codes in the range from 400 to 599 inclusive. Policy expressions aren't allowed.
/// </summary>
public bool? FailOnErrorStatusCode { get; init; }

public ForwardRequestConfig()
{
if (Timeout.HasValue && TimeoutMs.HasValue)
{
throw new ArgumentException("You can specify either timeout or timeout-ms but not both.");
}
}
}
8 changes: 0 additions & 8 deletions src/Authoring/Configs/RateLimitConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,4 @@ public abstract record EntityLimitConfig
public string? Id { get; init; }
public required int Calls { get; init; }
public required int RenewalPeriod { get; init; }

public EntityLimitConfig()
{
if (Name is null && Id is null)
{
throw new ArgumentNullException("Name or Id need to be specified");
}
}
}
8 changes: 0 additions & 8 deletions src/Authoring/Configs/SetBackendServiceConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,4 @@ public record SetBackendServiceConfig
public string? SfServiceInstanceName { get; init; }
public string? SfPartitionKey { get; init; }
public string? SfListenerName { get; init; }

public SetBackendServiceConfig()
{
if (BaseUrl == null && BackendId == null || BaseUrl != null && BackendId != null)
{
throw new ArgumentException("You need to specify either base-url or backend-id but not both.");
}
}
}
8 changes: 0 additions & 8 deletions src/Authoring/Configs/ValidateJwtConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,6 @@ public record ValidateJwtConfig
public string[]? Audiences { get; init; }
public string[]? Issuers { get; init; }
public ClaimConfig[]? RequiredClaims { get; init; }

public ValidateJwtConfig()
{
if (new[] { HeaderName, QueryParameterName, TokenValue }.Count(string.IsNullOrEmpty) != 1)
{
throw new ArgumentException("Only one of HeaderName, QueryParameterName and TokenValue must be set");
}
}
}

public record OpenIdConfig
Expand Down

0 comments on commit 61cee0a

Please sign in to comment.