Skip to content

Commit

Permalink
Merge 31288ef into 0dd730a
Browse files Browse the repository at this point in the history
  • Loading branch information
bdferris-v2 authored Apr 30, 2023
2 parents 0dd730a + 31288ef commit 3192170
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import java.util.logging.Level;
import org.mobilitydata.gtfsvalidator.annotation.GtfsTable;
import org.mobilitydata.gtfsvalidator.annotation.GtfsValidationNotice;
import org.mobilitydata.gtfsvalidator.annotation.GtfsValidationNotice.SectionRef;
import org.mobilitydata.gtfsvalidator.annotation.GtfsValidationNotice.UrlRef;
import org.mobilitydata.gtfsvalidator.notice.Notice;
import org.mobilitydata.gtfsvalidator.notice.NoticeDocComments;
Expand Down Expand Up @@ -128,6 +129,9 @@ private static ReferencesSchema generateReferences(GtfsValidationNotice noticeAn
.map(NoticeSchemaGenerator::getFileIdForTableClass)
.flatMap(Optional::stream)
.forEach(schema::addBestPracticesFileReference);
Arrays.stream(noticeAnnotation.sections().value())
.map(SectionRef::id)
.forEach(schema::addSectionReference);
Arrays.stream(noticeAnnotation.urls())
.map(NoticeSchemaGenerator::convertUrlRef)
.forEach(schema::addUrlReference);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,15 @@ public class ReferencesSchema {
/** References to files in the GTFS Best Practices document (e.g. `stops.txt`). */
private final List<String> bestPracticesFileReferences = new ArrayList();

private final List<String> sectionReferences = new ArrayList<>();

/** References to arbitrary URLs. */
private final List<UrlReference> urlReferences = new ArrayList<>();

public boolean isEmpty() {
return fileReferences.isEmpty()
&& bestPracticesFileReferences.isEmpty()
&& sectionReferences.isEmpty()
&& urlReferences.isEmpty();
}

Expand All @@ -44,6 +47,14 @@ public void addBestPracticesFileReference(String fileName) {
bestPracticesFileReferences.add(fileName);
}

public List<String> getSectionReferences() {
return this.sectionReferences;
}

public void addSectionReference(String sectionReference) {
this.sectionReferences.add(sectionReference);
}

public List<UrlReference> getUrlReferences() {
return this.urlReferences;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
"references": {
"fileReferences": [],
"bestPracticesFileReferences": [],
"sectionReferences": [
"file-requirements"
],
"urlReferences": [
{
"label": "Original Python validator implementation",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ enum SectionRef {
this.id = id;
}

String id() {
public String id() {
return this.id;
}
}
Expand Down

0 comments on commit 3192170

Please sign in to comment.