Skip to content

Commit

Permalink
Merge pull request #1022 from Financial-Times/content-type
Browse files Browse the repository at this point in the history
CPP-1757: loosen appContext.contentType schema
  • Loading branch information
apaleslimghost authored Jan 23, 2024
2 parents b33c591 + ae7ec45 commit 62eab2b
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 12 deletions.
10 changes: 9 additions & 1 deletion packages/dotcom-server-app-context/schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ The type or sub-type of the content on the current page

Additional restrictions:

* Regex pattern: `^(article|video|audio|podcast|package|live-blog)$`
* Regex pattern: `^.+$`

## `edition` (string)

Expand Down Expand Up @@ -95,3 +95,11 @@ The publish reference of the content on the current page
Additional restrictions:

* Regex pattern: `^.+$`

## `pageKitVersion` (string)

The version of Page Kit powering the app

Additional restrictions:

* Regex pattern: `^.+$`
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const validAppContext = Object.freeze({
product: 'next',
abTestState: 'subscriberCohort:on,premiumCohort:on,topicTracker_UIDemo:100-percent',
contentId: 'c5935758-7730-11e9-bbad-7c18c0ea0201',
contentType: 'article',
contentType: 'Article',
conceptId: 'c5935738-7730-11e9-bbad-7c18c0ea8201',
conceptType: 'http://www.ft.com/ontology/Location',
isProduction: true,
Expand Down
44 changes: 34 additions & 10 deletions packages/dotcom-server-app-context/src/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,49 +6,71 @@
"abTestState": {
"type": "string",
"description": "The A/B test flags data as a comma delimited string",
"examples": ["subscriberCohort:on,premiumCohort:on,nonUSACohort:on"],
"examples": [
"subscriberCohort:on,premiumCohort:on,nonUSACohort:on"
],
"pattern": "^,*([0-9A-Za-z-_]+:[0-9A-Za-z-_]+,*)+$"
},
"appName": {
"type": "string",
"description": "The name of the application",
"examples": ["front-page", "stream-page", "article-page"],
"examples": [
"front-page",
"stream-page",
"article-page"
],
"pattern": "^.+$"
},
"appVersion": {
"type": "string",
"description": "The running version of the app (usually a Git commit hash)",
"examples": ["882797258625531f20d604f6441ef8cfcb2d772b"],
"examples": [
"882797258625531f20d604f6441ef8cfcb2d772b"
],
"pattern": "^.+$"
},
"conceptId": {
"type": "string",
"description": "The UUID of the concept on the current page",
"examples": ["c5935758-7730-11e9-bbad-7c18c0ea0201"],
"examples": [
"c5935758-7730-11e9-bbad-7c18c0ea0201"
],
"pattern": "^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$"
},
"conceptType": {
"type": "string",
"description": "The type of concept on the current page",
"examples": ["http://www.ft.com/ontology/product/Brand", "http://www.ft.com/ontology/Location"],
"examples": [
"http://www.ft.com/ontology/product/Brand",
"http://www.ft.com/ontology/Location"
],
"pattern": "^http://www.ft.com/ontology/.+$"
},
"contentId": {
"type": "string",
"description": "The UUID of the content on the current page",
"examples": ["c5935758-7730-11e9-bbad-7c18c0ea0201"],
"examples": [
"c5935758-7730-11e9-bbad-7c18c0ea0201"
],
"pattern": "^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$"
},
"contentType": {
"type": "string",
"description": "The type or sub-type of the content on the current page",
"examples": ["article", "video", "audio", "podcast", "package", "live-blog"],
"pattern": "^(article|video|audio|podcast|package|live-blog)$"
"examples": [
"Article",
"LiveBlogPost",
"Video"
],
"pattern": "^.+$"
},
"edition": {
"type": "string",
"description": "The selected FT edition",
"examples": ["uk", "international"],
"examples": [
"uk",
"international"
],
"pattern": "^(uk|international)$"
},
"isProduction": {
Expand Down Expand Up @@ -80,7 +102,9 @@
"pageKitVersion": {
"type": "string",
"description": "The version of Page Kit powering the app",
"examples": ["1.0.0"],
"examples": [
"1.0.0"
],
"pattern": "^.+$"
}
},
Expand Down

0 comments on commit 62eab2b

Please sign in to comment.