From 54b03dfc6d91ea923de87f3b71f350bf171d5052 Mon Sep 17 00:00:00 2001 From: Simun Sprem Date: Tue, 4 Feb 2025 11:11:43 +0100 Subject: [PATCH] refactor: rename ValidateHeaders to ValidateHeader --- validator/internal/centralconsumer/centralconsumer.go | 8 ++++---- validator/internal/config/centralconsumer.go | 2 +- validator/internal/janitorctl/run.go | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/validator/internal/centralconsumer/centralconsumer.go b/validator/internal/centralconsumer/centralconsumer.go index 0d0c5a2..ff5d808 100644 --- a/validator/internal/centralconsumer/centralconsumer.go +++ b/validator/internal/centralconsumer/centralconsumer.go @@ -97,8 +97,8 @@ type Settings struct { // NumInferrers defines the maximum amount of inflight destination topic inference jobs (validation and routing). NumInferrers int - // ValidateHeaders defines if the messages' headers will be validated - ValidateHeaders bool + // ValidateHeader defines if the messages' headers will be validated + ValidateHeader bool // DefaultHeaderSchemaId is default ID of the header schema DefaultHeaderSchemaId string @@ -143,7 +143,7 @@ func New(registry registry.SchemaRegistry, publisher broker.Publisher, validator if settings.NumInferrers > 0 { validatorsSem = make(chan struct{}, settings.NumInferrers) } - if settings.ValidateHeaders { + if settings.ValidateHeader { _, ok := validators["json"] if !ok { // if json validation is turned off, this version of json validator is used by default for validating message header @@ -200,7 +200,7 @@ func New(registry registry.SchemaRegistry, publisher broker.Publisher, validator Specification: schemaVersion.Specification, }, encryptionKey: encryptionKey, - validateHeaders: settings.ValidateHeaders, + validateHeaders: settings.ValidateHeader, defaultHeaderSchema: config.DefaultHeaderSchema{ DefaultHeaderSchemaId: settings.DefaultHeaderSchemaId, DefaultHeaderSchemaVersion: settings.DefaultHeaderSchemaVersion, diff --git a/validator/internal/config/centralconsumer.go b/validator/internal/config/centralconsumer.go index c31a0e4..aeec02c 100644 --- a/validator/internal/config/centralconsumer.go +++ b/validator/internal/config/centralconsumer.go @@ -30,7 +30,7 @@ type CentralConsumer struct { ShouldLog CentralConsumerShouldLog `toml:"should_log"` NumSchemaCollectors int `toml:"num_schema_collectors" default:"-1"` NumInferrers int `toml:"num_inferrers" default:"-1"` - ValidateHeaders bool `toml:"validate_headers"` + ValidateHeader bool `toml:"validate_header"` DefaultHeaderSchema DefaultHeaderSchema `toml:"default_header_schema"` MetricsLoggingInterval time.Duration `toml:"metrics_logging_interval" default:"5s"` RunOptions RunOptions `toml:"run_option"` diff --git a/validator/internal/janitorctl/run.go b/validator/internal/janitorctl/run.go index 1132656..57425cc 100644 --- a/validator/internal/janitorctl/run.go +++ b/validator/internal/janitorctl/run.go @@ -86,7 +86,7 @@ func RunCentralConsumer(configFile string) { centralconsumer.Settings{ NumSchemaCollectors: cfg.NumSchemaCollectors, NumInferrers: cfg.NumInferrers, - ValidateHeaders: cfg.ValidateHeaders, + ValidateHeader: cfg.ValidateHeader, DefaultHeaderSchemaId: cfg.DefaultHeaderSchema.DefaultHeaderSchemaId, DefaultHeaderSchemaVersion: cfg.DefaultHeaderSchema.DefaultHeaderSchemaVersion, },