Skip to content

Commit

Permalink
fix for some uncommon feed URLs that were being removed when formatti…
Browse files Browse the repository at this point in the history
…ng DMFR files (#413)

* fix for some uncommon feed URLs that were being removed when formatting DMFR files; also update to DMFR v0.5.1

closes transitland/transitland-atlas#979

* update DMFR version number in tests
  • Loading branch information
drewda authored Jan 30, 2025
1 parent 53d4ad2 commit 5e84e4d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions dmfr/feed.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,15 @@ func (Feed) TableName() string {
// FeedUrls contains URL values for a Feed.
type FeedUrls struct {
StaticCurrent string `json:"static_current,omitempty"`
StaticPlanned string `json:"static_planner,omitempty"`
StaticPlanned []string `json:"static_planned,omitempty"`
StaticHistoric []string `json:"static_historic,omitempty"`
StaticHypothetical []string `json:"static_hypothetical,omitempty"`
RealtimeVehiclePositions string `json:"realtime_vehicle_positions,omitempty"`
RealtimeTripUpdates string `json:"realtime_trip_updates,omitempty"`
RealtimeAlerts string `json:"realtime_alerts,omitempty"`
GbfsAutoDiscovery string `json:"gbfs_auto_discovery,omitempty"`
GbfsSystemAlerts string `json:"gbfs_system_alerts,omitempty"`
MdsProvider string `json:"mds_provider,omitempty"`
// StaticHypothetical string
// GbfsSystemInformation string
// GbfsStationInformation string
// GbfsStationStatus string
Expand Down
2 changes: 1 addition & 1 deletion dmfr/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func ReadRegistry(reader io.Reader) (*Registry, error) {
reg.Operators = loadReg.Operators
reg.Secrets = loadReg.Secrets
if reg.Schema == "" {
reg.Schema = "https://dmfr.transit.land/json-schema/dmfr.schema-v0.5.0.json"
reg.Schema = "https://dmfr.transit.land/json-schema/dmfr.schema-v0.5.1.json"
}
operators := []Operator{}
for _, rfeed := range loadReg.Feeds {
Expand Down
6 changes: 3 additions & 3 deletions dmfr/registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,17 +139,17 @@ func TestRegistry_Write(t *testing.T) {
{
"feed",
`{"feeds":[{"id":"test","spec":"gtfs"}]}`,
`{"$schema":"https://dmfr.transit.land/json-schema/dmfr.schema-v0.5.0.json","feeds":[{"id":"test","spec":"gtfs"}]}`,
`{"$schema":"https://dmfr.transit.land/json-schema/dmfr.schema-v0.5.1.json","feeds":[{"id":"test","spec":"gtfs"}]}`,
},
{
"feed sorted",
`{"feeds":[{"id":"z","spec":"gtfs"},{"id":"a","spec":"gtfs"}]}`,
`{"$schema":"https://dmfr.transit.land/json-schema/dmfr.schema-v0.5.0.json","feeds":[{"id":"a","spec":"gtfs"},{"id":"z","spec":"gtfs"}]}`,
`{"$schema":"https://dmfr.transit.land/json-schema/dmfr.schema-v0.5.1.json","feeds":[{"id":"a","spec":"gtfs"},{"id":"z","spec":"gtfs"}]}`,
},
{
"nested operators moved to top level",
`{"feeds": [{"id": "z","spec": "gtfs","operators": [{"onestop_id": "o"}]}]}`,
`{"$schema":"https://dmfr.transit.land/json-schema/dmfr.schema-v0.5.0.json","feeds":[{"id":"z","spec":"gtfs"}],"operators":[{"onestop_id":"o","associated_feeds":[{"feed_onestop_id":"z"}]}]}`,
`{"$schema":"https://dmfr.transit.land/json-schema/dmfr.schema-v0.5.1.json","feeds":[{"id":"z","spec":"gtfs"}],"operators":[{"onestop_id":"o","associated_feeds":[{"feed_onestop_id":"z"}]}]}`,
},
}
for _, tc := range tcs {
Expand Down

0 comments on commit 5e84e4d

Please sign in to comment.