Skip to content

when agency_url is missing, only issue a warning #280

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions tl/gtfs_agency.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package tl

import "github.com/interline-io/transitland-lib/tl/tt"
import (
"github.com/interline-io/transitland-lib/tl/tt"
)

// Agency agency.txt
type Agency struct {
AgencyID string
AgencyName string `csv:",required"`
AgencyURL string `csv:",required"`
AgencyURL string
AgencyTimezone string `csv:",required"`
AgencyLang string
AgencyPhone string
Expand All @@ -29,7 +31,6 @@ func (ent *Agency) EntityKey() string {
func (ent *Agency) Errors() (errs []error) {
errs = append(errs, ent.BaseEntity.Errors()...)
errs = append(errs, tt.CheckPresent("agency_name", ent.AgencyName)...)
errs = append(errs, tt.CheckPresent("agency_url", ent.AgencyURL)...)
errs = append(errs, tt.CheckPresent("agency_timezone", ent.AgencyTimezone)...)
errs = append(errs, tt.CheckTimezone("agency_timezone", ent.AgencyTimezone)...)
errs = append(errs, tt.CheckURL("agency_url", ent.AgencyURL)...)
Expand All @@ -39,6 +40,13 @@ func (ent *Agency) Errors() (errs []error) {
return errs
}

// Warnings for this entity
func (ent *Agency) Warnings() (warns []error) {
warns = append(warns, ent.BaseEntity.Warnings()...)
warns = append(warns, tt.CheckPresent("agency_url", ent.AgencyURL)...)
return warns
}

// Filename agency.txt
func (ent *Agency) Filename() string {
return "agency.txt"
Expand Down