bc-ferries-api icon indicating copy to clipboard operation
bc-ferries-api copied to clipboard

Inconsistent time formats and bad string data in "arrivalTime"

Open pbadams opened this issue 1 year ago • 1 comments

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 string Sailingsonly,. 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.

pbadams avatar Feb 04 '24 20:02 pbadams

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.

samuel-pratt avatar Feb 07 '24 21:02 samuel-pratt

PR looked good to me, closing this issue. Sorry for the slow turnaround on review.

samuel-pratt avatar Aug 17 '24 16:08 samuel-pratt