Skip to content

Commit

Permalink
feat: added GtfsNetworkSchema (#1660)
Browse files Browse the repository at this point in the history
* added GtfsNetworkSchema

* formatted code

* networks.txt is not required

---------

Co-authored-by: jcpitre <106176106+jcpitre@users.noreply.github.com>
  • Loading branch information
qcdyx and jcpitre authored Jan 25, 2024
1 parent 48facc3 commit 6dcb8e7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public class FeedMetadata {
new Pair<>("Zone-Based Fares", GtfsArea.FILENAME),
new Pair<>("Transfer Fares", GtfsFareTransferRule.FILENAME),
new Pair<>("Time-Based Fares", GtfsTimeframe.FILENAME),
new Pair<>("Route-Based Fares", GtfsNetwork.FILENAME),
new Pair<>("Levels", GtfsLevel.FILENAME));

protected FeedMetadata() {}
Expand Down Expand Up @@ -185,9 +186,10 @@ private void loadRouteBasedFaresComponent(GtfsFeedContainer feedContainer) {
specFeatures.put(
"Route-Based Fares",
hasAtLeastOneRecordForFields(
feedContainer,
GtfsRoute.FILENAME,
List.of((Function<GtfsRoute, Boolean>) GtfsRoute::hasNetworkId)));
feedContainer,
GtfsRoute.FILENAME,
List.of((Function<GtfsRoute, Boolean>) GtfsRoute::hasNetworkId))
|| hasAtLeastOneRecordInFile(feedContainer, GtfsNetwork.FILENAME));
}

private void loadBlocksComponent(GtfsFeedContainer feedContainer) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package org.mobilitydata.gtfsvalidator.table;

import org.mobilitydata.gtfsvalidator.annotation.*;

@GtfsTable("networks.txt")
public interface GtfsNetworkSchema extends GtfsEntity {
@FieldType(FieldTypeEnum.ID)
@PrimaryKey
@Required
String networkId();

@MixedCase
String networkName();
}

0 comments on commit 6dcb8e7

Please sign in to comment.