Skip to content

Commit

Permalink
Merge pull request #270 from conveyal/dev
Browse files Browse the repository at this point in the history
Next release
  • Loading branch information
evansiroky authored Jan 27, 2020
2 parents 1d1ae24 + 40da0fb commit 9fea880
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,7 @@ public class GraphQLGtfsSchema {
.field(string("type"))
.field(intt("count"))
.field(string("message"))
.field(string("priority"))
.build();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.conveyal.gtfs.error.NewGTFSErrorType;
import com.conveyal.gtfs.graphql.GTFSGraphQL;
import com.conveyal.gtfs.validator.model.Priority;
import graphql.schema.DataFetcher;
import graphql.schema.DataFetchingEnvironment;
import org.apache.commons.dbutils.DbUtils;
Expand Down Expand Up @@ -41,7 +42,12 @@ public Object get(DataFetchingEnvironment environment) {
try {
connection = GTFSGraphQL.getConnection();
Statement statement = connection.createStatement();
String sql = String.format("select error_type, count(*) from %s.errors group by error_type", namespace);
String sql = String.format(
// this order_by is only needed to make sure that the testing snapshots are consistently in the same
// order during every test
"select error_type, count(*) from %s.errors group by error_type order by error_type",
namespace
);
LOG.info("SQL: {}", sql);
if (statement.execute(sql)) {
ResultSet resultSet = statement.getResultSet();
Expand All @@ -61,11 +67,13 @@ public static class ErrorCount {
public NewGTFSErrorType type;
public int count;
public String message;
public Priority priority;

public ErrorCount(NewGTFSErrorType errorType, int count) {
this.type = errorType;
this.count = count;
this.message = errorType.englishMessage;
this.priority = errorType.priority;
}
}

Expand Down
6 changes: 6 additions & 0 deletions src/test/resources/graphql/feedErrors.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
query($namespace: String) {
feed(namespace: $namespace) {
feed_version
error_counts {
count
message
priority
type
}
errors {
bad_value
error_id
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,32 @@
{
"data" : {
"feed" : {
"error_counts" : [ {
"count" : 1,
"message" : "No service_ids were active on a date within the range of dates with defined service.",
"priority" : "MEDIUM",
"type" : "DATE_NO_SERVICE"
}, {
"count" : 1,
"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.",
"priority" : "LOW",
"type" : "FEED_TRAVEL_TIMES_ROUNDED"
}, {
"count" : 1,
"message" : "A required field was missing or empty in a particular row.",
"priority" : "MEDIUM",
"type" : "MISSING_FIELD"
}, {
"count" : 1,
"message" : "The long name of a route should complement the short name, not include it.",
"priority" : "LOW",
"type" : "ROUTE_LONG_NAME_CONTAINS_SHORT_NAME"
}, {
"count" : 1,
"message" : "This stop is not referenced by any trips.",
"priority" : "MEDIUM",
"type" : "STOP_UNUSED"
} ],
"errors" : [ {
"bad_value" : "agency_url",
"entity_id" : null,
Expand Down

0 comments on commit 9fea880

Please sign in to comment.