Document development workflow and internals
This commit is contained in:
@@ -70,7 +70,7 @@
|
||||
//
|
||||
// weather.<kind>.vN
|
||||
//
|
||||
// weatherfeeder centralizes schema strings in internal/standards/schema.go.
|
||||
// weatherfeeder centralizes schema strings in standards/schema.go.
|
||||
// Always use those constants (do not inline schema strings).
|
||||
//
|
||||
// Example mappings:
|
||||
@@ -101,8 +101,8 @@
|
||||
// Every normalizer type must have a doc comment that states:
|
||||
//
|
||||
// - what it converts (e.g., “OpenWeather current -> WeatherObservation”)
|
||||
// - which raw schema it matches (constant identifier from internal/standards)
|
||||
// - which canonical schema it produces (constant identifier from internal/standards)
|
||||
// - which raw schema it matches (constant identifier from standards)
|
||||
// - which canonical schema it produces (constant identifier from standards)
|
||||
// - any special caveats (units, day/night inference, missing fields, etc.)
|
||||
//
|
||||
// Including literal schema string values is optional,
|
||||
|
||||
@@ -37,7 +37,7 @@ func (AlertsNormalizer) Match(e event.Event) bool {
|
||||
}
|
||||
|
||||
func (AlertsNormalizer) Normalize(ctx context.Context, in event.Event) (*event.Event, error) {
|
||||
_ = ctx // normalization is pure/CPU; keep ctx for future expensive steps
|
||||
_ = ctx // normalization is pure/CPU; keep signature aligned with Normalizer.
|
||||
|
||||
// If we can't derive AsOf from the payload, fall back to the existing event envelope.
|
||||
fallbackAsOf := in.EmittedAt.UTC()
|
||||
|
||||
@@ -42,7 +42,7 @@ func (ForecastNormalizer) Match(e event.Event) bool {
|
||||
}
|
||||
|
||||
func (ForecastNormalizer) Normalize(ctx context.Context, in event.Event) (*event.Event, error) {
|
||||
_ = ctx // normalization is pure/CPU; keep ctx for future expensive steps
|
||||
_ = ctx // normalization is pure/CPU; keep signature aligned with Normalizer.
|
||||
|
||||
return normalizeForecastEventBySchema(in)
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ func (ObservationNormalizer) Match(e event.Event) bool {
|
||||
}
|
||||
|
||||
func (ObservationNormalizer) Normalize(ctx context.Context, in event.Event) (*event.Event, error) {
|
||||
_ = ctx // normalization is pure/CPU; keep ctx for future expensive steps
|
||||
_ = ctx // normalization is pure/CPU; keep signature aligned with Normalizer.
|
||||
|
||||
return normcommon.NormalizeJSON(
|
||||
in,
|
||||
|
||||
@@ -33,7 +33,7 @@ func (ForecastNormalizer) Match(e event.Event) bool {
|
||||
}
|
||||
|
||||
func (ForecastNormalizer) Normalize(ctx context.Context, in event.Event) (*event.Event, error) {
|
||||
_ = ctx // normalization is pure/CPU; keep ctx for future expensive steps
|
||||
_ = ctx // normalization is pure/CPU; keep signature aligned with Normalizer.
|
||||
|
||||
// If present, prefer the existing event EmittedAt as IssuedAt.
|
||||
var fallbackIssued time.Time
|
||||
|
||||
@@ -40,7 +40,7 @@ func (ObservationNormalizer) Match(e event.Event) bool {
|
||||
}
|
||||
|
||||
func (ObservationNormalizer) Normalize(ctx context.Context, in event.Event) (*event.Event, error) {
|
||||
_ = ctx // normalization is pure/CPU; keep ctx for future expensive steps
|
||||
_ = ctx // normalization is pure/CPU; keep signature aligned with Normalizer.
|
||||
|
||||
return normcommon.NormalizeJSON(
|
||||
in,
|
||||
|
||||
@@ -8,8 +8,7 @@ import (
|
||||
normcommon "gitea.maximumdirect.net/ejr/weatherfeeder/internal/normalizers/common"
|
||||
)
|
||||
|
||||
// This file holds provider-specific helpers that are shared across multiple
|
||||
// OpenWeather normalizers (observations today; forecasts/alerts later).
|
||||
// This file holds provider-specific helpers for OpenWeather normalizers.
|
||||
// Keeping these out of observation.go helps preserve the "one normalizer per file"
|
||||
// convention while avoiding duplication.
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ func (ObservationNormalizer) Match(e event.Event) bool {
|
||||
}
|
||||
|
||||
func (ObservationNormalizer) Normalize(ctx context.Context, in event.Event) (*event.Event, error) {
|
||||
_ = ctx // normalization is pure/CPU; keep ctx for future expensive steps
|
||||
_ = ctx // normalization is pure/CPU; keep signature aligned with Normalizer.
|
||||
|
||||
return normcommon.NormalizeJSON(
|
||||
in,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Package openweather contains provider-specific helper code for OpenWeather used by
|
||||
// both sources and normalizers.
|
||||
// Package openweather contains provider-specific helper code for OpenWeather
|
||||
// used by sources and normalizers.
|
||||
//
|
||||
// Rules:
|
||||
// - No network I/O here.
|
||||
|
||||
Reference in New Issue
Block a user