Skip to content

Commit 9fea880

Browse files
authored
Merge pull request #270 from conveyal/dev
Next release
2 parents 1d1ae24 + 40da0fb commit 9fea880

File tree

4 files changed

+42
-1
lines changed

4 files changed

+42
-1
lines changed

src/main/java/com/conveyal/gtfs/graphql/GraphQLGtfsSchema.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,7 @@ public class GraphQLGtfsSchema {
457457
.field(string("type"))
458458
.field(intt("count"))
459459
.field(string("message"))
460+
.field(string("priority"))
460461
.build();
461462

462463
/**

src/main/java/com/conveyal/gtfs/graphql/fetchers/ErrorCountFetcher.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import com.conveyal.gtfs.error.NewGTFSErrorType;
44
import com.conveyal.gtfs.graphql.GTFSGraphQL;
5+
import com.conveyal.gtfs.validator.model.Priority;
56
import graphql.schema.DataFetcher;
67
import graphql.schema.DataFetchingEnvironment;
78
import org.apache.commons.dbutils.DbUtils;
@@ -41,7 +42,12 @@ public Object get(DataFetchingEnvironment environment) {
4142
try {
4243
connection = GTFSGraphQL.getConnection();
4344
Statement statement = connection.createStatement();
44-
String sql = String.format("select error_type, count(*) from %s.errors group by error_type", namespace);
45+
String sql = String.format(
46+
// this order_by is only needed to make sure that the testing snapshots are consistently in the same
47+
// order during every test
48+
"select error_type, count(*) from %s.errors group by error_type order by error_type",
49+
namespace
50+
);
4551
LOG.info("SQL: {}", sql);
4652
if (statement.execute(sql)) {
4753
ResultSet resultSet = statement.getResultSet();
@@ -61,11 +67,13 @@ public static class ErrorCount {
6167
public NewGTFSErrorType type;
6268
public int count;
6369
public String message;
70+
public Priority priority;
6471

6572
public ErrorCount(NewGTFSErrorType errorType, int count) {
6673
this.type = errorType;
6774
this.count = count;
6875
this.message = errorType.englishMessage;
76+
this.priority = errorType.priority;
6977
}
7078
}
7179

src/test/resources/graphql/feedErrors.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
query($namespace: String) {
22
feed(namespace: $namespace) {
33
feed_version
4+
error_counts {
5+
count
6+
message
7+
priority
8+
type
9+
}
410
errors {
511
bad_value
612
error_id

src/test/resources/snapshots/com/conveyal/gtfs/graphql/GTFSGraphQLTest/canFetchErrors-0.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,32 @@
11
{
22
"data" : {
33
"feed" : {
4+
"error_counts" : [ {
5+
"count" : 1,
6+
"message" : "No service_ids were active on a date within the range of dates with defined service.",
7+
"priority" : "MEDIUM",
8+
"type" : "DATE_NO_SERVICE"
9+
}, {
10+
"count" : 1,
11+
"message" : "All travel times in the feed are rounded to the minute, which may cause unexpected results in routing applications where travel times are zero.",
12+
"priority" : "LOW",
13+
"type" : "FEED_TRAVEL_TIMES_ROUNDED"
14+
}, {
15+
"count" : 1,
16+
"message" : "A required field was missing or empty in a particular row.",
17+
"priority" : "MEDIUM",
18+
"type" : "MISSING_FIELD"
19+
}, {
20+
"count" : 1,
21+
"message" : "The long name of a route should complement the short name, not include it.",
22+
"priority" : "LOW",
23+
"type" : "ROUTE_LONG_NAME_CONTAINS_SHORT_NAME"
24+
}, {
25+
"count" : 1,
26+
"message" : "This stop is not referenced by any trips.",
27+
"priority" : "MEDIUM",
28+
"type" : "STOP_UNUSED"
29+
} ],
430
"errors" : [ {
531
"bad_value" : "agency_url",
632
"entity_id" : null,

0 commit comments

Comments
 (0)