Reputation: 13617
I'd like to find out is it correct according to json-api standards. I'd like to have item like calendar_day at the top level. Is it correct that data would contain items like
{:data=>[{:id=>"2020-04-15", :type=>:calendar_day, :attributes=>{:date=>"2020-04-15"}} ...
and than some relationships for each calendar_day item.
Worth to mention that calendar_day is not actually the "real" record in my db, it's just the app concept although I'v got a model defined to make json-api serializer work with it easy.
Upvotes: 1
Views: 241
Reputation: 371
Even though there isn't a standard format for dates in json api specification, ISO 8601 is recommended. As far as that goes, your example is fine.
All id
keys must have string values.
Having said that, you have to be careful since datestrings aren't unique by themselves. You could use a timestamp just to be sure that you have the right document. With that, you can get any date info that you need down to the millisecond.
Upvotes: 1