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:
@@ -1,23 +1,24 @@
|
||||
// FILE: internal/model/alert.go
|
||||
package model
|
||||
|
||||
import "time"
|
||||
|
||||
// Placeholder for NWS alerts (GeoJSON feature properties are rich).
|
||||
type WeatherAlert struct {
|
||||
ID string
|
||||
ID string `json:"id"`
|
||||
|
||||
Event string
|
||||
Headline string
|
||||
Description string
|
||||
Instruction string
|
||||
Event string `json:"event,omitempty"`
|
||||
Headline string `json:"headline,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
Instruction string `json:"instruction,omitempty"`
|
||||
|
||||
Severity string
|
||||
Urgency string
|
||||
Certainty string
|
||||
Severity string `json:"severity,omitempty"`
|
||||
Urgency string `json:"urgency,omitempty"`
|
||||
Certainty string `json:"certainty,omitempty"`
|
||||
|
||||
Sent *time.Time
|
||||
Effective *time.Time
|
||||
Expires *time.Time
|
||||
Sent *time.Time `json:"sent,omitempty"`
|
||||
Effective *time.Time `json:"effective,omitempty"`
|
||||
Expires *time.Time `json:"expires,omitempty"`
|
||||
|
||||
Areas []string
|
||||
Areas []string `json:"areas,omitempty"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user