ONSdigital / design-system

ONS Design System
https://service-manual.ons.gov.uk/design-system
MIT License
28 stars 17 forks source link

Refactor timeline macro for compatibility with Jinja2 templates #3180

Open SriHV opened 1 month ago

SriHV commented 1 month ago

What is the context of this PR?

3171 ...

BREAKING CHANGE

We have made a breaking change to the timeline macro by renaming the items parameter to timelineItems. This change affects all instances where the timeline macro is used. Below, we provide detailed instructions on how to update your service to accommodate this change.

How to Update Your Code To update your service, you need to replace the items parameter with timelineItems wherever the timeline macro is used. Here is an example of how to make this change:

Before: {{ onsTimeline({ "items": [. . . ] }) }}

After: {{ onsTimeline({ "timelineItems": [. . . ] }) }}

How to review this PR

Checklist

This needs to be completed by the person raising the PR.

netlify[bot] commented 1 month ago

Deploy Preview for ons-design-system-preview ready!

Name Link
Latest commit 03c48ae7cea38ccc6314c889276f6a4f6ad2808e
Latest deploy log https://app.netlify.com/sites/ons-design-system-preview/deploys/667011a18f8f780008dde58a
Deploy Preview https://deploy-preview-3180--ons-design-system-preview.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

SriHV commented 1 month ago

I am not sure I understand what has been changed? Looks like a parameter name has been changed from items to items_timeline but I didn't see any .items() functions?

oh sorry I wasn't clear. Items is a reserved name mainly used as a built-in function for dictionary data structure. So when trying to iterate over this parameter named 'items', we get this error 'builtin_function_or_method' object is not iterable.

rmccar commented 1 month ago

I am not sure I understand what has been changed? Looks like a parameter name has been changed from items to items_timeline but I didn't see any .items() functions?

oh sorry I wasn't clear. Items is a reserved name mainly used as a built-in function for dictionary data structure. So when trying to iterate over this parameter named 'items', we get this error 'builtin_function_or_method' object is not iterable.

Can this information be put into the description

rmccar commented 1 month ago

Can we have a "breaking changes" section added to the description that tells the user how to update their service to fix the breaking change we have introduced