diff --git a/.changeset/fifty-vans-drum.md b/.changeset/fifty-vans-drum.md new file mode 100644 index 0000000000..6b1b920bb9 --- /dev/null +++ b/.changeset/fifty-vans-drum.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-tech-radar': patch +--- + +Update tech-radar documentation on how to use an external json data source with dates. diff --git a/plugins/tech-radar/README.md b/plugins/tech-radar/README.md index 10c7a104c1..5c99541c2a 100644 --- a/plugins/tech-radar/README.md +++ b/plugins/tech-radar/README.md @@ -90,9 +90,17 @@ export class MyOwnClient implements TechRadarApi { const data = await fetch('https://mydata.json').then(res => res.json()); - // maybe you'll need to do some data transformation here to make it look like TechRadarLoaderResponse - - return data; + // For example, this converts the timeline dates into date objects + return { + ...data, + entries: data.entries.map(entry => ({ + ...entry, + timeline: entry.timeline.map(timeline => ({ + ...timeline, + date: new Date(timeline.date), + })), + })), + }; } }