Skip to content

Commit

Permalink
Added YAML tags to struct fields for Client, Pool, and Proxy types
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
sinadarbouy committed Jul 28, 2024
1 parent 754a426 commit b783f9d
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions config/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit b783f9d

Please sign in to comment.