Skip to content

Conversation

@cemms1
Copy link
Contributor

@cemms1 cemms1 commented Jan 12, 2026

What does this change?

Adds a nullable type hint comment to the new storylinesContent field in the frontend tag page type to ensure the schema treats the field as nullable

Why?

Seems typescript-json-schema doesn't recognise nullable types well when translating from types. See YousefED/typescript-json-schema#419

Since the addition of storylinesContent (#15008), I have had problems rendering tag pages locally using DCR due to schema check failures

This is affecting the Playwright runs in the commercial repo due to it needing to run DCR locally

Screenshots

Before After
before after

Example tag page with null storylinesContent: https://www.theguardian.com/politics/industrial-policy

@cemms1 cemms1 added the fix Departmental tracking: fix label Jan 12, 2026
canonicalUrl?: string;
contributionsServiceUrl: string;
storylinesContent?: StorylinesContent;
// This comment is needed to ensure null is recognised properly in the schema
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is deliberately not a JSDoc comment to avoid this appearing in the schema itself

},
branding: tagPageBranding,
canonicalUrl: data.canonicalUrl,
storylinesContent: data.storylinesContent ?? undefined,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use nullish coalescing operator to convert to undefined for rest of DCR to use if null

@cemms1 cemms1 added the run_chromatic Runs chromatic when label is applied label Jan 12, 2026
@cemms1 cemms1 requested a review from Georges-GNM January 12, 2026 16:07
@cemms1 cemms1 marked this pull request as ready for review January 12, 2026 16:07
@cemms1 cemms1 requested a review from a team as a code owner January 12, 2026 16:07
@github-actions github-actions bot removed the run_chromatic Runs chromatic when label is applied label Jan 12, 2026
@cemms1 cemms1 requested a review from a team January 12, 2026 16:18
Copy link
Contributor

@deedeeh deedeeh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for fixing that @cemms1 🙏🏼

@Georges-GNM
Copy link
Contributor

Thanks, hadn't spotted this as an issue when adding the value 😅

@cemms1 cemms1 merged commit 7ff6474 into main Jan 12, 2026
36 of 37 checks passed
@cemms1 cemms1 deleted the cemms1/fix-local-tagpage-validation branch January 12, 2026 16:35
@gu-prout
Copy link

gu-prout bot commented Jan 12, 2026

Seen on PROD (merged by @cemms1 9 minutes and 1 second ago) Please check your changes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Departmental tracking: fix Seen-on-PROD

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants