From 64c0b8638fc07d5980354e59b1777ebab444ee86 Mon Sep 17 00:00:00 2001 From: Tom Kay Date: Fri, 13 Dec 2024 12:58:20 +0000 Subject: [PATCH] Optional property (#232) * optional property * use omitempty as optional --- v1/policy/rate_limit.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/v1/policy/rate_limit.go b/v1/policy/rate_limit.go index 6b7f6de..0579951 100644 --- a/v1/policy/rate_limit.go +++ b/v1/policy/rate_limit.go @@ -32,7 +32,7 @@ const ( type RateLimitPolicy struct { // LimitProperty is the property to limit the rate by, global if empty - LimitProperty RateLimitKey `json:"limitProperty" yaml:"limitProperty" validate:"oneof=PlacementID MerchantReference CorrelationID BillingProfileID IP Currency UserAgent DeviceType DeviceBrowser DeviceBrowserVersion DeviceFingerprint"` + LimitProperty RateLimitKey `json:"limitProperty" yaml:"limitProperty" validate:"omitempty,oneof=PlacementID MerchantReference CorrelationID BillingProfileID IP Currency UserAgent DeviceType DeviceBrowser DeviceBrowserVersion DeviceFingerprint"` // IPOptions allows for additional rate limiting options for IP based rate limits IPOptions *RateLimitIPOptions `json:"ipOptions" yaml:"ipOptions" validate:"required_if=LimitProperty IP"` // HardLimit is the maximum number of requests allowed in the window