Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ChrisBAshton opened this issue Oct 10, 2019 · 0 comments

Comments

@ChrisBAshton
Copy link
Contributor

ChrisBAshton commented Oct 10, 2019

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.

thomasleese added a commit that referenced this issue Nov 8, 2019
This is one step towards solving #632 and avoids unnecessary confusion
over their being two fields for accessing the links.

There are only 310 content items left which have something in the
`links`:

```rb
irb(main):005:0> ContentItem.where(:links.nin => [{}, nil]).count
=> 310
```

I don't think we need to write a migration to remove this field because
as new content is presented to the content store, it'll get overwritten
anyway.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant