UnionInternationalCheminsdeFer / OSDM

Projects related to an open sales & distribution API for public transportation.
https://osdm.io
Apache License 2.0
50 stars 20 forks source link

Purchaser verbs are inconsistent #602

Open nixxus1030 opened 2 weeks ago

nixxus1030 commented 2 weeks ago

The verbs for the purchaser are inconsistent, making it a half-baked resource: we have a get and a patch as if it was a resource, but no post.

we should either have a proper post so that it becomes completely a resource, or remove the patch and get, make the purchaser a data structure and make it accessible via patch booking. Note the former (adding a post) is non-breaking while the latter is

Right now some parties are trying to create a purchaser using a patch purchaser, which is from a REST standpoint a big no-no

jspetrak commented 2 weeks ago

@nixxus1030 It is not a long ago since we removed ID from the purchaser. I think we head towards Purchasers being modified from patch booking endpoint. Or just highlight that purchaser always exist for booking, and therefore patch is the correct way to modify it, but the creation can't be trigerred from the client side.

CGantert345 commented 2 weeks ago

For GDPR reasons the purchaser exists only within a booking, not as a resource on its own (same as for passengers). The patch is essentially a patch of the booking with the limited scope of adding/changing the purchaser data structure of the booking.

nixxus1030 commented 2 weeks ago

if we don't want purchaser to be a subresources (you are correct @CGantert345 , it cannot be a resource. However it could be a subresource, which exactly matches what you state - that it only exists within the context of the booking, url would be like booking/id/purchaser) and not make a post purchaser, then we either

Note however that unless we indeed do not want to accept a booking that does not have a purchaser, my preference would be to make of the purchaser an actual subresource, because

all 3 solutions are REST acceptable - we need to align on which one we prefer. Since it is a bug, we may get way with introducing a breaking change in the fix without major bump version (we did it in the past) - but again the non breaking approach is cleaner IMO

rolandkla commented 1 week ago

The current specs does lead to unharmonised implementations:

It would be good to align here to make sure OSDM clients will only have 1 scenario to worry about and not different behaviours.

I think introducing a POST will solve all of the above. This gives the OSDM client the flexibility to update or add a purchaser and prevents the need to provide fake or dummy data during booking time (as this information is often not known upfront).

schlpbch commented 1 week ago

--> Align with Nicloas.