feat(feedkit): add optional normalization hook and document external API
Introduce an optional normalization stage for feedkit pipelines via the new normalize package. This adds: - normalize.Normalizer interface with flexible Match() semantics - normalize.Registry for ordered normalizer selection (first match wins) - normalize.Processor adapter implementing pipeline.Processor - Pass-through behavior when no normalizer matches (normalization is optional) - Func helper for ergonomic normalizer definitions Update root doc.go to fully document the normalization model, its role in the pipeline, recommended conventions (Schema-based matching, raw vs normalized events), and concrete wiring examples. The documentation now serves as a complete external-facing API specification for downstream daemons such as weatherfeeder. This change preserves feedkit’s non-framework philosophy while enabling a clean separation between data collection and domain normalization.
This commit is contained in:
17
normalize/doc.go
Normal file
17
normalize/doc.go
Normal file
@@ -0,0 +1,17 @@
|
||||
// Package normalize provides an OPTIONAL normalization hook for feedkit pipelines.
|
||||
//
|
||||
// Motivation:
|
||||
// Many daemons have sources that:
|
||||
// 1. fetch raw upstream data (often JSON), and
|
||||
// 2. transform it into a domain's normalized payload format.
|
||||
//
|
||||
// Doing both steps inside Source.Poll works, but tends to make sources large and
|
||||
// encourages duplication (unit conversions, common mapping helpers, etc.).
|
||||
//
|
||||
// This package lets a source emit a "raw" event (e.g., Schema="raw.openweather.current.v1",
|
||||
// Payload=json.RawMessage), and then a normalization processor can convert it into a
|
||||
// normalized event (e.g., Schema="weather.observation.v1", Payload=WeatherObservation{}).
|
||||
//
|
||||
// Key property: normalization is optional.
|
||||
// If no registered Normalizer matches an event, it passes through unchanged.
|
||||
package normalize
|
||||
Reference in New Issue
Block a user