model: add explicit JSON tags and document canonical payload contract

Add lowerCamelCase JSON tags to canonical model types (observation, forecast,
alert) to stabilize the emitted wire format and make payload structure explicit
for downstream sinks.

Introduce internal/model/doc.go to document these structs as versioned,
schema-governed payloads and clarify compatibility expectations (additive
changes preferred; breaking changes require schema bumps).

No functional behavior changes; this formalizes the canonical output contract
ahead of additional sinks and consumers.
This commit is contained in:
2026-01-15 22:39:37 -06:00
parent f13f43cf56
commit e10ba804ca
4 changed files with 56 additions and 63 deletions

View File

@@ -1,17 +1,15 @@
// FILE: internal/model/forecast.go
package model
import "time"
// WeatherForecast identity fields (as you described).
type WeatherForecast struct {
IssuedBy string // e.g. "NWS"
IssuedAt time.Time // when forecast product was issued
ForecastType string // e.g. "hourly", "daily"
ForecastStart time.Time // start of the applicable forecast period
IssuedBy string `json:"issuedBy,omitempty"` // e.g. "NWS"
IssuedAt time.Time `json:"issuedAt"` // when forecast product was issued
ForecastType string `json:"forecastType,omitempty"` // e.g. "hourly", "daily"
ForecastStart time.Time `json:"forecastStart"` // start of the applicable forecast period
// TODO: Youll likely want ForecastEnd too.
// TODO: Add meteorological fields you care about.
// Temperature, precip probability, wind, etc.
// Decide if you want a single "period" model or an array of periods.
}