bc-ferries-api
bc-ferries-api copied to clipboard
Inconsistent time formats and bad string data in "arrivalTime"
Hi,
I've written a JSON Schema for the V2 API (See PR 43). When I use it against JSON returned from the V2 end point it fails due to:
- Many (40+)
arrivalTime
values have no space between the time and period indicator (am/pm). This is a consistent error. - Some
arrivalTime
values contain the stringSailingsonly,
. This seems to be timing dependent, as it does not always appear in the JSON.
This had been tested using the following JSON validators:
- https://www.jsonschemavalidator.net
- https://extendsclass.com/json-schema-validator.html
While this is not a big issue for apps that only use the time fields as display strings, it is problematic for consuming apps that need a consistent time format so they can reliably convert the time elements into native Datetime objects in their preferred language.
Thanks for raising this, I'll take a look.
Do you know what conditions cause Sailingsonly
to appear in the JSON so I can test it? What I'm thinking is I'm just going to add a regex match to the arrivalTime so it pulls the timestamp out if there is a longer string.
PR looked good to me, closing this issue. Sorry for the slow turnaround on review.