content-store icon indicating copy to clipboard operation
content-store copied to clipboard

Legacy 'links' field is not exposed in API, but 'expanded_links' is... as 'links'

Open ChrisBAshton opened this issue 5 years ago • 0 comments

Documenting a 'gotcha' here in case it comes in useful to somebody, and serves as a reminder of a bit of legacy we can clear up next time we work on content store.

Consider this item:

item = ContentItem.in(content_id: "5ede6386-9f7b-47f7-9510-36c05fac6d48").to_a[0]

It has a links field which is empty:

item.links => {}

But it has expanded_links which contains content:

item.expanded_links => (lots of things)

But these come through as links in the API (which is pretty confusing for a newcomer!):

https://www.gov.uk/api/content/dispose-hazardous-waste

My understanding from talking to Kevin is that the links field is legacy and should be removed. In my opinion we would then rename expanded_links to links in content-store so that it stays consistent with how we expose it in the API.

ChrisBAshton avatar Oct 10 '19 12:10 ChrisBAshton