Skip to content

Commit

Permalink
Merge branch 'dev' into fix-bad-date-npe
Browse files Browse the repository at this point in the history
Conflicts:
	src/test/java/com/conveyal/gtfs/GTFSTest.java
  • Loading branch information
landonreed committed Jan 3, 2019
2 parents 67a5d56 + 057a962 commit 71b5536
Show file tree
Hide file tree
Showing 30 changed files with 667 additions and 278 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ notifications:
# Push results to codecov.io and run semantic-release (releases only created on pushes to the master branch).
after_success:
- bash <(curl -s https://codecov.io/bash)
- semantic-release --prepare @conveyal/maven-semantic-release --publish @semantic-release/github,@conveyal/maven-semantic-release --verify-conditions @semantic-release/github --verify-release @conveyal/maven-semantic-release
- semantic-release --prepare @conveyal/maven-semantic-release --publish @semantic-release/github,@conveyal/maven-semantic-release --verify-conditions @semantic-release/github,@conveyal/maven-semantic-release --verify-release @conveyal/maven-semantic-release --use-conveyal-workflow --dev-branch=dev
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Based on observations over several years of experience using the OneBusAway GTFS

The main design goals are:

- Avoid all reflection tricks and work imperatively even if it is a bit verbose
- Avoid all reflection tricks and use imperative code style even if it is a bit verbose
- Allow loading and processing GTFS feeds (much) bigger than available memory
- Introduce the concept of feed IDs, and do not use agency IDs for this purpose.
- Perform extensive syntax and semantic validation of feed contents
Expand Down Expand Up @@ -197,4 +197,4 @@ or the optional directory specified with the `--json` option.
"validationTime" : 16319
}

```
```
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<groupId>com.conveyal</groupId>
<artifactId>gtfs-lib</artifactId>
<version>4.0.1-SNAPSHOT</version>
<version>4.1.3-SNAPSHOT</version>
<packaging>jar</packaging>

<licenses>
Expand Down Expand Up @@ -353,7 +353,7 @@
<dependency>
<groupId>com.graphql-java</groupId>
<artifactId>graphql-java</artifactId>
<version>4.2</version>
<version>11.0</version>
</dependency>
</dependencies>
</project>
2 changes: 1 addition & 1 deletion src/main/java/com/conveyal/gtfs/GTFS.java
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public static void main (String[] args) throws IOException {
try {
cmd = new DefaultParser().parse(options, args);
} catch (ParseException e) {
LOG.error("Error parsing command line: " + e.getMessage());
LOG.error("Error parsing command line", e);
printHelp(options);
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public enum NewGTFSErrorType {
TABLE_TOO_LONG(Priority.MEDIUM, "Table is too long to record line numbers with a 32-bit integer, overflow will occur."),
TIME_ZONE_FORMAT(Priority.MEDIUM, "Time zone format should be X."),
REQUIRED_TABLE_EMPTY(Priority.MEDIUM, "This table is required by the GTFS specification but is empty."),
FEED_TRAVEL_TIMES_ROUNDED(Priority.LOW, "All travel times in the feed are rounded to the minute, which may cause unexpected results in routing applications where travel times are zero."),
ROUTE_DESCRIPTION_SAME_AS_NAME(Priority.LOW, "The description of a route is identical to its name, so does not add any information."),
ROUTE_LONG_NAME_CONTAINS_SHORT_NAME(Priority.LOW, "The long name of a route should complement the short name, not include it."),
ROUTE_SHORT_AND_LONG_NAME_MISSING(Priority.MEDIUM, "A route has neither a long nor a short name."),
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/com/conveyal/gtfs/error/SQLErrorStorage.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Map;
import java.util.Set;

import static com.conveyal.gtfs.util.Util.ensureValidNamespace;

Expand Down Expand Up @@ -86,6 +87,12 @@ public void storeError (NewGTFSError error) {
}
}

public void storeErrors (Set<NewGTFSError> errors) {
for (NewGTFSError error : errors) {
storeError(error);
}
}

/**
* Commits any outstanding error inserts and returns the error count via a SQL query.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ public class GraphQLGtfsSchema {
public static final GraphQLObjectType fareType = newObject().name("fare_attributes")
.description("A GTFS agency object")
.field(MapFetcher.field("id", GraphQLInt))
.field(MapFetcher.field("agency_id"))
.field(MapFetcher.field("fare_id"))
.field(MapFetcher.field("price", GraphQLFloat))
.field(MapFetcher.field("currency_type"))
Expand Down Expand Up @@ -269,6 +270,7 @@ public class GraphQLGtfsSchema {
.field(MapFetcher.field("wheelchair_accessible"))
.field(MapFetcher.field("publicly_visible", GraphQLInt))
.field(MapFetcher.field("status", GraphQLInt))
.field(MapFetcher.field("route_sort_order"))
// FIXME ^^
.field(RowCountFetcher.field("trip_count", "trips", "route_id"))
.field(RowCountFetcher.field("pattern_count", "patterns", "route_id"))
Expand Down Expand Up @@ -347,6 +349,7 @@ public class GraphQLGtfsSchema {
.type(new GraphQLList(routeType))
.argument(stringArg("namespace"))
.argument(stringArg(SEARCH_ARG))
.argument(intArg(LIMIT_ARG))
.dataFetcher(new NestedJDBCFetcher(
new JDBCFetcher("pattern_stops", "stop_id", null, false),
new JDBCFetcher("patterns", "pattern_id", null, false),
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/conveyal/gtfs/graphql/GraphQLUtil.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.conveyal.gtfs.graphql;

import graphql.schema.FieldDataFetcher;
import graphql.schema.GraphQLArgument;
import graphql.schema.GraphQLFieldDefinition;
import graphql.schema.GraphQLList;
import graphql.schema.PropertyDataFetcher;

import static graphql.Scalars.GraphQLFloat;
import static graphql.Scalars.GraphQLInt;
Expand All @@ -17,15 +17,15 @@ public static GraphQLFieldDefinition string (String name) {
return newFieldDefinition()
.name(name)
.type(GraphQLString)
.dataFetcher(new FieldDataFetcher(name))
.dataFetcher(new PropertyDataFetcher(name))
.build();
}

public static GraphQLFieldDefinition intt (String name) {
return newFieldDefinition()
.name(name)
.type(GraphQLInt)
.dataFetcher(new FieldDataFetcher(name))
.dataFetcher(new PropertyDataFetcher(name))
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
import java.util.HashMap;
import java.util.Map;

import static com.conveyal.gtfs.graphql.fetchers.JDBCFetcher.validateNamespace;

/**
* Fetch the summary row for a particular loaded feed, based on its namespace.
* This essentially gets the row from the top-level summary table of all feeds that have been loaded into the database.
Expand All @@ -25,6 +27,7 @@ public class FeedFetcher implements DataFetcher {
@Override
public Map<String, Object> get (DataFetchingEnvironment environment) {
String namespace = environment.getArgument("namespace"); // This is the unique table prefix (the "schema").
validateNamespace(namespace);
StringBuilder sqlBuilder = new StringBuilder();
sqlBuilder.append(String.format("select * from feeds where namespace = '%s'", namespace));
Connection connection = null;
Expand Down
Loading

0 comments on commit 71b5536

Please sign in to comment.