From 4df6f0456ea4e86b615544004a7d63c8b524e6bd Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Thu, 20 Jul 2023 21:21:12 +0100 Subject: [PATCH] Add omitempty --- pkg/upstreamApi/vstp.go | 52 ++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/pkg/upstreamApi/vstp.go b/pkg/upstreamApi/vstp.go index baf4141..a503614 100644 --- a/pkg/upstreamApi/vstp.go +++ b/pkg/upstreamApi/vstp.go @@ -1,46 +1,46 @@ package upstreamApi type MsgData struct { - Data VstpMsg `json:"VSTPCIFMsgV1"` + Data VstpMsg `json:"VSTPCIFMsgV1,omitempty"` } type VstpMsg struct { - CIFMsg Schedule `json:"schedule"` + CIFMsg Schedule `json:"schedule,omitempty"` } type Schedule struct { - TransactionType string `json:"transaction_type"` - ScheduleStartDate string `json:"schedule_start_date"` - ScheduleEndDate string `json:"schedule_end_date"` - ScheduleDaysRun string `json:"schedule_days_runs"` - CIFTrainUID string `json:"CIF_train_uid"` - CIFSTPIndicator string `json:"CIF_stp_indicator"` - ScheduleSegment []ScheduleSegment `json:"schedule_segment"` + TransactionType string `json:"transaction_type,omitempty"` + ScheduleStartDate string `json:"schedule_start_date,omitempty"` + ScheduleEndDate string `json:"schedule_end_date,omitempty"` + ScheduleDaysRun string `json:"schedule_days_runs,omitempty"` + CIFTrainUID string `json:"CIF_train_uid,omitempty"` + CIFSTPIndicator string `json:"CIF_stp_indicator,omitempty"` + ScheduleSegment []ScheduleSegment `json:"schedule_segment,omitempty"` } type ScheduleSegment struct { - SignallingID string `json:"signalling_id"` - ATOCCode string `json:"atoc_code"` - CIFTrainCategory string `json:"CIF_train_category"` - CIFHeadcode string `json:"CIF_headcode"` - CIFPowerType string `json:"CIF_power_type"` - CIFSpeed string `json:"CIF_speed"` - ScheduleLocation []ScheduleLocation `json:"schedule_location"` + SignallingID string `json:"signalling_id,omitempty"` + ATOCCode string `json:"atoc_code,omitempty"` + CIFTrainCategory string `json:"CIF_train_category,omitempty"` + CIFHeadcode string `json:"CIF_headcode,omitempty"` + CIFPowerType string `json:"CIF_power_type,omitempty"` + CIFSpeed string `json:"CIF_speed,omitempty"` + ScheduleLocation []ScheduleLocation `json:"schedule_location,omitempty"` } type ScheduleLocation struct { - ScheduledArrivalTime string `json:"scheduled_arrival_time"` - ScheduledDepartureTime string `json:"scheduled_departure_time"` - ScheduledPassTime string `json:"scheduled_pass_time"` - PublicArrivalTime string `json:"public_arrival_time"` - PublicDepartureTime string `json:"public_departure_time"` - CIFPlatform string `json:"CIF_platform"` - CIFLine string `json:"CIF_line"` - Tiploc LocationTiploc `json:"location"` + ScheduledArrivalTime string `json:"scheduled_arrival_time,omitempty"` + ScheduledDepartureTime string `json:"scheduled_departure_time,omitempty"` + ScheduledPassTime string `json:"scheduled_pass_time,omitempty"` + PublicArrivalTime string `json:"public_arrival_time,omitempty"` + PublicDepartureTime string `json:"public_departure_time,omitempty"` + CIFPlatform string `json:"CIF_platform,omitempty"` + CIFLine string `json:"CIF_line,omitempty"` + Tiploc LocationTiploc `json:"location,omitempty"` } type LocationTiploc struct { Tiploc struct { - TiplocId string `json:"tiploc_id"` - } `json:"tiploc"` + TiplocId string `json:"tiploc_id,omitempty"` + } `json:"tiploc,omitempty"` }