Closed jelz closed 7 years ago
Hey @jelz thank you very much for the response :) To be honest I was simply trying to understand the content model for the project I started working on, and this visual representation could have helped me in doing so.
And your comments are really helpful, because I wasn't aware of those small peculiarities. I'll make some amends to the script, having this knowledge.
Thanks!
Thanks @jelz once again for the comments, added corresponding checks and included Management API for the singular links.
Hi there,
Jakub from Contentful here. Thank you for contributing to our open source ecosystem. There are some issues with https://github.com/lotas/contentful-graph/blob/master/src/get-relations.js. Allow me to list them to help you with making your project better:
field.items.validations
. It works only with multiple references fields (array of links). For singular links you'd have to checkfield.validations
.field.validations
: they are not available in CDA (contentful
npm module). You'd have to use CMA (contentful-management
npm module) response for the/content_types
endpoint call.linkContentType
validation (validation.linkContentType.map
). It can fail for some other validations (e.g. array size validation) wherelinkContentType
isundefined
.linkContentType
can be either an array or a string. If it's a string, it's an ID of a singular linked content type.Please let me know if there's something I could help with.
J.