Alternate routes with the JSON-LD format

Hello,

I'm working on the API Platform framework where our preferred format is JSON-LD. We want to refactor how our "Resources" are defined and we're introducing the concept of "Alternate Routes". Let's say we have an Answer resource, that you can request through "/answers/1", the response is:

    {
      "@context": "/contexts/Answer",
      "@id": "/answers/1",
      "@type": "Answer",
      "content": "42",
      "question": "/questions/1"
    }

We now define an Alternate route "/questions/1/answer". The answer is the same but we're wondering what the "@id" should be:

Answer A:

    {
      "@context": "/contexts/Answer",
      "@id": "/questions/1/answer",
      "@type": "Answer",
      "content": "42",
      "question": "/questions/1"
    }

Answer B:

    {
      "@context": "/contexts/Answer",
      "@id": "/answers/1",
      "@type": "Answer",
      "content": "42",
      "question": "/questions/1"
    }

Thank you for your insight on the subject.

Received on Thursday, 1 July 2021 10:14:25 UTC