Closed mpadge closed 3 years ago
Great catch, as always, @mpadge. I can fully reproduce this behaviour in my computer as well.
Regarding the check_gtfs_format()
function you propose, I suggest using assert_gtfs()
, which I created as a validator for the gtfs
class (the name is not great, I know, but both {gtfstools}
and {tidytransit}
had their own validate_gtfs()
already, so I opted for the current one). \
Currently it checks if all elements inside the GTFS are named and if they inherit from data.frame, but it doesn't check the content of their names. What do you think?
The names are official, and so checking them should be part of assert_gtfs()
. I would suggest that it should assert that all required names exist, and that any other names match one of the optional names and nothing else. I'll leave you to do that, and i'll PR with a fix for this. Thanks!!
The
zip::zip_list()
does not necessarily return file names without paths - see?zip::zip
for details. The following code demonstrates (in a possibly OS-dependent manner, so don't worry if you can't reproduce):Created on 2021-06-21 by the reprex package (v2.0.0.9000)
In such cases, the names of the items read in
import_gtfs
will be the full paths, and the returned object retains those names. Everything works, but any other packages expecting a gtfs feed to have standard names will then fail. This is what happens:Created on 2021-06-21 by the reprex package (v2.0.0.9000)
I'll submit a PR to fix the names once #16 has been merged. The package will then need a final
check_gtfs_format()
orgtfsio_is_valid()
or similar function that confirms that everything has the expected format - that all required tables are present, and that all required columns of required tables are also present. We can worry about that once #16 and this issue have been addressed. :+1: