Skip to content
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

feat: 1795 timepoint clarification #1867

Merged
merged 10 commits into from
Oct 9, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import org.mobilitydata.gtfsvalidator.annotation.Index;
import org.mobilitydata.gtfsvalidator.annotation.NonNegative;
import org.mobilitydata.gtfsvalidator.annotation.PrimaryKey;
import org.mobilitydata.gtfsvalidator.annotation.RecommendedColumn;
import org.mobilitydata.gtfsvalidator.annotation.Required;
import org.mobilitydata.gtfsvalidator.type.GtfsTime;

Expand Down Expand Up @@ -91,7 +90,6 @@ public interface GtfsStopTimeSchema extends GtfsEntity {
double shapeDistTraveled();

@DefaultValue("1")
@RecommendedColumn
GtfsStopTimeTimepoint timepoint();

@FieldType(FieldTypeEnum.ID)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void validate(NoticeContainer noticeContainer) {
return;
}
for (GtfsStopTime stopTime : stopTimes.getEntities()) {
if (!stopTime.hasTimepoint()) {
if ((stopTime.hasArrivalTime() || stopTime.hasDepartureTime()) && !stopTime.hasTimepoint()) {
noticeContainer.addValidationNotice(new MissingTimepointValueNotice(stopTime));
}
if (isTimepoint(stopTime)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,8 @@ public void nonTimepoint_timesProvided_shouldNotGenerateNotice() {
}

@Test
public void emptyTimepoint_noTimesProvided_shouldGenerateNotice() {
public void
emptyTimepoint_noArrivalTime_noDepartureTime_noTimePointProvided_shouldNotGenerateNotice() {
// setting .setTimepoint(null) is used to define a missing value
// (even if the timepoint value is included in header)
List<GtfsStopTime> stopTimes = new ArrayList<>();
Expand All @@ -216,7 +217,7 @@ public void emptyTimepoint_noTimesProvided_shouldGenerateNotice() {
.setTimepoint((Integer) null)
.build());
assertThat(generateNotices(createHeaderWithTimepointColumn(), stopTimes))
.containsExactly(new MissingTimepointValueNotice(stopTimes.get(0)));
.doesNotContain(new MissingTimepointValueNotice(stopTimes.get(0)));
}

@Test
Expand Down
Loading