stop_times API: add center coordinate parameter#1288
stop_times API: add center coordinate parameter#1288felixguendling merged 12 commits intomotis-project:masterfrom
Conversation
|
Our aim is to always have tests :) |
# Conflicts: # src/tag_lookup.cc
| utl::verify<net::bad_request_exception>( | ||
| center.has_value(), "no coordinates: stop_found={}, center_parsed={}", | ||
| query_stop.has_value(), query_center.has_value()); | ||
|
|
||
| utl::verify<net::bad_request_exception>( | ||
| query_stop.has_value() || | ||
| (query_center.has_value() && query.radius_.has_value()), | ||
| "no radius: stop_found={}, center_parsed={}", query_stop.has_value(), | ||
| query_center.has_value()); | ||
|
|
There was a problem hiding this comment.
I think it would be good if at least in the standard case (just a stop id is given and this stop id doesn't exist), we still return a 404 as before.
There was a problem hiding this comment.
Yes for the itinerary use case, we said that for that reason you will just give the center anyways.
I just meant that if a client is requesting just with a stopid, no center (i.e. same request as before), and if then no stop with that stop id exists, we should return a 404, because the client hasn't created a "bad request", it's just that the stop was not found.
(Conversely, one could return 400 already when center is set without radius, even if stopid is set and exists, but that is a minor detail.)
| schema: | ||
| type: string | ||
| required: false | ||
| description: Anchor coordination (can be used instead of stopId) |
There was a problem hiding this comment.
I think it would be useful to describe the fallback behavior in case both are given (because my idea was that clients can actually use that if they remember the position from a previous query – currently we get a lot of 404s due to queries with old stopids).
Center field is added to stoptimes_ep
The behavior:
check if id is set and exists in the timetable -> just use id like before
otherwise -> use center as anchor coordinate instead
in case center is also null -> panic
Note:
radius is required when using center without stopId