openactive / open-booking-api

Repository for the Open Booking API specification
Other
2 stars 3 forks source link

Why does this spec use `@type` rather than `type` as in other specs? #122

Closed lukehesluke closed 4 years ago

lukehesluke commented 4 years ago

In the opportunity modelling spec (https://www.openactive.io/modelling-opportunity-data/), all objects have a type field e.g.

{
  "@context": "https://openactive.io/",
  "type": "Event",
  "id": "http://host.opportunity-data.com/id/12345",
  "url": "http://my-leisure-centre.example.org/events/1",
  "name": "Tai chi Class"
}

Whereas in this Booking API spec, the same field is @type e.g.

"lease": {
  "@type": "Lease",
  "leaseExpires": "2018-10-01T11:00:00Z"
}

Since the Booking API spec refers to the same sorts of objects as in the modelling spec e.g.

"orderedItem": {
  "@type": "ScheduledSession",
  "@id": "https://example.com/events/452/subEvents/132"
}

this may cause issues with implementations that utilise both specs.

Where can I find the rationale? And should both specs be normalized?

Thanks :relaxed:

Luke

lukehesluke commented 4 years ago

Forgot to say: This same question also applies for @id / id

nickevansuk commented 4 years ago

Great question, the answer to which can be found in https://github.com/openactive/modelling-opportunity-data/issues/219, and also in the video for today's W3C call.

The conclusion from today was that both @type/@id and type/id will continue to be supported, with a preference to deprecate type/id in future and to encourage all tooling to support both for deserialisation and @type/@id for serialisation.