Files
weatherfeeder/internal/normalizers/builtins.go
Eric Rakestraw d0b58a4734
All checks were successful
ci/woodpecker/push/build-image Pipeline was successful
Updates to track feedkit v0.7.2 and to add a dedupe processor
2026-03-16 18:35:44 -05:00

36 lines
1.3 KiB
Go

// FILE: ./internal/normalizers/builtins.go
package normalizers
import (
fknormalize "gitea.maximumdirect.net/ejr/feedkit/processors/normalize"
"gitea.maximumdirect.net/ejr/weatherfeeder/internal/normalizers/nws"
"gitea.maximumdirect.net/ejr/weatherfeeder/internal/normalizers/openmeteo"
"gitea.maximumdirect.net/ejr/weatherfeeder/internal/normalizers/openweather"
)
// RegisterBuiltins registers all normalizers shipped with this binary.
//
// This mirrors internal/sources.RegisterBuiltins, but note the selection model:
//
// - sources are built by name (cfg.Driver -> factory)
// - normalizers are selected by Match() (event.Schema -> first match wins)
//
// Registration order matters because feedkit normalize.Processor is "first match wins".
// In weatherfeeder we avoid ambiguity by matching strictly on schema constants, but
// we still keep ordering stable as a best practice.
func RegisterBuiltins(in []fknormalize.Normalizer) []fknormalize.Normalizer {
out := in
// Keep this intentionally boring: delegate registration to provider subpackages
// so main.go stays clean and each provider owns its own mapping logic.
//
// Order here should be stable across releases to reduce surprises when adding
// new normalizers.
out = nws.Register(out)
out = openmeteo.Register(out)
out = openweather.Register(out)
return out
}