How to represent a table structure in jsonapi
How to represent a table structure in jsonapi
Have the following problem.
We are implementing a REST API very much based on JsonApi specification.
We are importing table structured files.
Where:
- part of the row is the metadata of Object1
- column header is the link to an external Object2
- cell value is the 'expression' of the relationship between Object1 and Object2.
For example:
You have biological sample (Object2) and run experiment to see if a specific mutation (Object 1) is available to that sample. The cell value can have different values which specifically state that a mutation for that sample is present, partially present or non present.
How using JSONAPI we would be able to represent such relationship. In which object the cell value should be saved? Object1? The relationship object?
UPD: Forgot to mention. If we use only the "green" part of the row (metadata), we would be able to create unique objects. Which could be reused across files and linked to new objects, which may have different 'relationship values'(cell values).
Thank you for any help!
@ShaiAharoni well yeah. Forgot to add the following comment: If we use only the "green" part of the row, we would be able to create unique objects. Which could be reused across files and linked to new objects, which may have different 'relationship values'
– Mike
Jun 29 at 16:58
This does not sounds like a question about JSON API spec but more about your database design. My first guess would be a many-to-many through relationship where the intermediate model hold the "cell value".
– jelhan
2 days ago
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Well.. each row represents one object (Object1, Object3) so maybe the value should be part of these objects
– Shai Aharoni
Jun 29 at 16:16