Skip to content

Commit 7ff6474

Browse files
authored
ensure storylinesContent is marked clearly as nullable in tag page schema (#15118)
1 parent 4c24724 commit 7ff6474

File tree

4 files changed

+105
-95
lines changed

4 files changed

+105
-95
lines changed

dotcom-rendering/src/frontend/feTagPage.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,7 @@ export type FETagPage = {
2626
forceDay: boolean;
2727
canonicalUrl?: string;
2828
contributionsServiceUrl: string;
29-
storylinesContent?: StorylinesContent;
29+
// This comment is needed to ensure null is recognised properly in the schema
30+
/** @nullable true */
31+
storylinesContent?: StorylinesContent | null;
3032
};

dotcom-rendering/src/frontend/schemas/feTagPage.json

Lines changed: 89 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1285,105 +1285,112 @@
12851285
"type": "string"
12861286
},
12871287
"storylinesContent": {
1288-
"type": "object",
1289-
"properties": {
1290-
"created": {
1291-
"type": "string"
1292-
},
1293-
"tag": {
1294-
"type": "string"
1295-
},
1296-
"storylines": {
1297-
"type": "array",
1298-
"items": {
1299-
"type": "object",
1300-
"properties": {
1301-
"title": {
1302-
"type": "string"
1303-
},
1304-
"content": {
1305-
"type": "array",
1306-
"items": {
1307-
"type": "object",
1308-
"properties": {
1309-
"category": {
1310-
"type": "string"
1311-
},
1312-
"articles": {
1313-
"type": "array",
1314-
"items": {
1315-
"type": "object",
1316-
"properties": {
1317-
"url": {
1318-
"type": "string"
1319-
},
1320-
"headline": {
1321-
"type": "string"
1322-
},
1323-
"byline": {
1324-
"type": "string"
1325-
},
1326-
"publicationTime": {
1327-
"type": "string"
1328-
},
1329-
"image": {
1288+
"anyOf": [
1289+
{
1290+
"type": "object",
1291+
"properties": {
1292+
"created": {
1293+
"type": "string"
1294+
},
1295+
"tag": {
1296+
"type": "string"
1297+
},
1298+
"storylines": {
1299+
"type": "array",
1300+
"items": {
1301+
"type": "object",
1302+
"properties": {
1303+
"title": {
1304+
"type": "string"
1305+
},
1306+
"content": {
1307+
"type": "array",
1308+
"items": {
1309+
"type": "object",
1310+
"properties": {
1311+
"category": {
1312+
"type": "string"
1313+
},
1314+
"articles": {
1315+
"type": "array",
1316+
"items": {
13301317
"type": "object",
13311318
"properties": {
1332-
"src": {
1319+
"url": {
1320+
"type": "string"
1321+
},
1322+
"headline": {
13331323
"type": "string"
13341324
},
1335-
"altText": {
1325+
"byline": {
13361326
"type": "string"
13371327
},
1338-
"isAvatar": {
1339-
"type": "boolean"
1328+
"publicationTime": {
1329+
"type": "string"
13401330
},
1341-
"mediaData": {
1342-
"$ref": "#/definitions/MainMedia"
1331+
"image": {
1332+
"type": "object",
1333+
"properties": {
1334+
"src": {
1335+
"type": "string"
1336+
},
1337+
"altText": {
1338+
"type": "string"
1339+
},
1340+
"isAvatar": {
1341+
"type": "boolean"
1342+
},
1343+
"mediaData": {
1344+
"$ref": "#/definitions/MainMedia"
1345+
}
1346+
},
1347+
"required": [
1348+
"altText",
1349+
"isAvatar",
1350+
"src"
1351+
]
13431352
}
13441353
},
13451354
"required": [
1346-
"altText",
1347-
"isAvatar",
1348-
"src"
1355+
"headline",
1356+
"publicationTime",
1357+
"url"
13491358
]
13501359
}
1351-
},
1352-
"required": [
1353-
"headline",
1354-
"publicationTime",
1355-
"url"
1356-
]
1357-
}
1360+
}
1361+
},
1362+
"required": [
1363+
"articles",
1364+
"category"
1365+
]
13581366
}
1359-
},
1360-
"required": [
1361-
"articles",
1362-
"category"
1363-
]
1364-
}
1367+
}
1368+
},
1369+
"required": [
1370+
"content",
1371+
"title"
1372+
]
13651373
}
13661374
},
1367-
"required": [
1368-
"content",
1369-
"title"
1370-
]
1371-
}
1372-
},
1373-
"articleCount": {
1374-
"type": "number"
1375-
},
1376-
"earliestArticleTime": {
1377-
"type": "string"
1375+
"articleCount": {
1376+
"type": "number"
1377+
},
1378+
"earliestArticleTime": {
1379+
"type": "string"
1380+
},
1381+
"latestArticleTime": {
1382+
"type": "string"
1383+
}
1384+
},
1385+
"required": [
1386+
"created",
1387+
"storylines",
1388+
"tag"
1389+
]
13781390
},
1379-
"latestArticleTime": {
1380-
"type": "string"
1391+
{
1392+
"type": "null"
13811393
}
1382-
},
1383-
"required": [
1384-
"created",
1385-
"storylines",
1386-
"tag"
13871394
]
13881395
}
13891396
},

dotcom-rendering/src/server/handler.front.web.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ const enhanceTagPage = (body: unknown): TagPage => {
156156
},
157157
branding: tagPageBranding,
158158
canonicalUrl: data.canonicalUrl,
159+
storylinesContent: data.storylinesContent ?? undefined,
159160
};
160161
};
161162

pnpm-lock.yaml

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)