From b783f9df4f3d977d08cd6a7694b09fe80af9b403 Mon Sep 17 00:00:00 2001 From: sinadarbouy Date: Sat, 27 Jul 2024 19:40:35 +0200 Subject: [PATCH] Added YAML tags to struct fields for Client, Pool, and Proxy types - Enhanced the Client struct by adding YAML tags to all fields, ensuring compatibility with YAML parsers. - Added YAML tags to the Size field in the Pool struct. - Included YAML tags for the HealthCheckPeriod field in the Proxy struct. These changes address limitations of the YAML parser and ensure proper serialization and deserialization of configuration data. --- config/types.go | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/config/types.go b/config/types.go index d8925dab..f08e3787 100644 --- a/config/types.go +++ b/config/types.go @@ -44,19 +44,19 @@ type ActionRedisConfig struct { } type Client struct { - Network string `json:"network" jsonschema:"enum=tcp,enum=udp,enum=unix"` - Address string `json:"address"` - TCPKeepAlive bool `json:"tcpKeepAlive"` - TCPKeepAlivePeriod time.Duration `json:"tcpKeepAlivePeriod" jsonschema:"oneof_type=string;integer"` - ReceiveChunkSize int `json:"receiveChunkSize"` - ReceiveDeadline time.Duration `json:"receiveDeadline" jsonschema:"oneof_type=string;integer"` - ReceiveTimeout time.Duration `json:"receiveTimeout" jsonschema:"oneof_type=string;integer"` - SendDeadline time.Duration `json:"sendDeadline" jsonschema:"oneof_type=string;integer"` - DialTimeout time.Duration `json:"dialTimeout" jsonschema:"oneof_type=string;integer"` - Retries int `json:"retries"` - Backoff time.Duration `json:"backoff" jsonschema:"oneof_type=string;integer"` - BackoffMultiplier float64 `json:"backoffMultiplier"` - DisableBackoffCaps bool `json:"disableBackoffCaps"` + Network string `json:"network" jsonschema:"enum=tcp,enum=udp,enum=unix" yaml:"network"` + Address string `json:"address" yaml:"address"` + TCPKeepAlive bool `json:"tcpKeepAlive" yaml:"tcpKeepAlive"` + TCPKeepAlivePeriod time.Duration `json:"tcpKeepAlivePeriod" jsonschema:"oneof_type=string;integer" yaml:"tcpKeepAlivePeriod"` + ReceiveChunkSize int `json:"receiveChunkSize" yaml:"receiveChunkSize"` + ReceiveDeadline time.Duration `json:"receiveDeadline" jsonschema:"oneof_type=string;integer" yaml:"receiveDeadline"` + ReceiveTimeout time.Duration `json:"receiveTimeout" jsonschema:"oneof_type=string;integer" yaml:"receiveTimeout"` + SendDeadline time.Duration `json:"sendDeadline" jsonschema:"oneof_type=string;integer" yaml:"sendDeadline"` + DialTimeout time.Duration `json:"dialTimeout" jsonschema:"oneof_type=string;integer" yaml:"dialTimeout"` + Retries int `json:"retries" yaml:"retries"` + Backoff time.Duration `json:"backoff" jsonschema:"oneof_type=string;integer" yaml:"backoff"` + BackoffMultiplier float64 `json:"backoffMultiplier" yaml:"backoffMultiplier"` + DisableBackoffCaps bool `json:"disableBackoffCaps" yaml:"disableBackoffCaps"` } type Logger struct { @@ -89,11 +89,11 @@ type Metrics struct { } type Pool struct { - Size int `json:"size"` + Size int `json:"size" yaml:"size"` } type Proxy struct { - HealthCheckPeriod time.Duration `json:"healthCheckPeriod" jsonschema:"oneof_type=string;integer"` + HealthCheckPeriod time.Duration `json:"healthCheckPeriod" jsonschema:"oneof_type=string;integer" yaml:"healthCheckPeriod"` } type LoadBalancer struct {