diff --git a/dotcom-rendering/src/frontend/feFront.ts b/dotcom-rendering/src/frontend/feFront.ts index e7a8eca76cf..3e576294bd0 100644 --- a/dotcom-rendering/src/frontend/feFront.ts +++ b/dotcom-rendering/src/frontend/feFront.ts @@ -322,6 +322,13 @@ export type FECollection = { }; export type FEFrontConfig = { + /** + * Server-side AB tests. Optional from `frontend`; a default of + * `{}` is applied by AJV during request validation (see `useDefaults` in + * `validate.ts`), so this is always present after enhancing. + * + * @default {} + */ abTests: ServerSideTests; adUnit: string; ajaxUrl: string; diff --git a/dotcom-rendering/src/frontend/schemas/feArticle.json b/dotcom-rendering/src/frontend/schemas/feArticle.json index 3c7cdf9ab7d..ad6ee70f43d 100644 --- a/dotcom-rendering/src/frontend/schemas/feArticle.json +++ b/dotcom-rendering/src/frontend/schemas/feArticle.json @@ -5164,7 +5164,8 @@ "type": "object", "properties": { "abTests": { - "description": "Narrowest representation of the server-side tests\nobject shape, which is [defined in `frontend`](https://github.com/guardian/frontend/blob/23743723030a041e4f4f59fa265ee2be0bb51825/common/app/experiments/ExperimentsDefinition.scala#L24-L26).\n\n**Note:** This type is not support by JSON-schema, it evaluates as `object`", + "description": "Server-side AB tests. Optional from `frontend`; a default of\n`{}` is applied by AJV during request validation (see `useDefaults` in\n`validate.ts`), so this is always present after enhancing.", + "default": {}, "type": "object" }, "adUnit": { diff --git a/dotcom-rendering/src/frontend/schemas/feCricketMatchPage.json b/dotcom-rendering/src/frontend/schemas/feCricketMatchPage.json index a56ab5a3aa4..b886c7b1c70 100644 --- a/dotcom-rendering/src/frontend/schemas/feCricketMatchPage.json +++ b/dotcom-rendering/src/frontend/schemas/feCricketMatchPage.json @@ -573,7 +573,8 @@ "type": "string" }, "abTests": { - "description": "Narrowest representation of the server-side tests\nobject shape, which is [defined in `frontend`](https://github.com/guardian/frontend/blob/23743723030a041e4f4f59fa265ee2be0bb51825/common/app/experiments/ExperimentsDefinition.scala#L24-L26).\n\n**Note:** This type is not support by JSON-schema, it evaluates as `object`", + "description": "Server-side AB tests. Optional from `frontend`; a default of\n`{}` is applied by AJV during request validation (see `useDefaults` in\n`validate.ts`), so this is always present after enhancing.", + "default": {}, "type": "object" }, "ajaxUrl": { diff --git a/dotcom-rendering/src/frontend/schemas/feFootballMatchInfoPage.json b/dotcom-rendering/src/frontend/schemas/feFootballMatchInfoPage.json index 3b3e7dccd76..13ea7bf0f51 100644 --- a/dotcom-rendering/src/frontend/schemas/feFootballMatchInfoPage.json +++ b/dotcom-rendering/src/frontend/schemas/feFootballMatchInfoPage.json @@ -480,7 +480,8 @@ "type": "string" }, "abTests": { - "description": "Narrowest representation of the server-side tests\nobject shape, which is [defined in `frontend`](https://github.com/guardian/frontend/blob/23743723030a041e4f4f59fa265ee2be0bb51825/common/app/experiments/ExperimentsDefinition.scala#L24-L26).\n\n**Note:** This type is not support by JSON-schema, it evaluates as `object`", + "description": "Server-side AB tests. Optional from `frontend`; a default of\n`{}` is applied by AJV during request validation (see `useDefaults` in\n`validate.ts`), so this is always present after enhancing.", + "default": {}, "type": "object" }, "ajaxUrl": { diff --git a/dotcom-rendering/src/frontend/schemas/feFootballMatchListPage.json b/dotcom-rendering/src/frontend/schemas/feFootballMatchListPage.json index 359ef7e84e8..d050b811dcf 100644 --- a/dotcom-rendering/src/frontend/schemas/feFootballMatchListPage.json +++ b/dotcom-rendering/src/frontend/schemas/feFootballMatchListPage.json @@ -358,7 +358,8 @@ "type": "string" }, "abTests": { - "description": "Narrowest representation of the server-side tests\nobject shape, which is [defined in `frontend`](https://github.com/guardian/frontend/blob/23743723030a041e4f4f59fa265ee2be0bb51825/common/app/experiments/ExperimentsDefinition.scala#L24-L26).\n\n**Note:** This type is not support by JSON-schema, it evaluates as `object`", + "description": "Server-side AB tests. Optional from `frontend`; a default of\n`{}` is applied by AJV during request validation (see `useDefaults` in\n`validate.ts`), so this is always present after enhancing.", + "default": {}, "type": "object" }, "ajaxUrl": { diff --git a/dotcom-rendering/src/frontend/schemas/feFootballTablesPage.json b/dotcom-rendering/src/frontend/schemas/feFootballTablesPage.json index 24a25d47027..7493767d744 100644 --- a/dotcom-rendering/src/frontend/schemas/feFootballTablesPage.json +++ b/dotcom-rendering/src/frontend/schemas/feFootballTablesPage.json @@ -351,7 +351,8 @@ "type": "string" }, "abTests": { - "description": "Narrowest representation of the server-side tests\nobject shape, which is [defined in `frontend`](https://github.com/guardian/frontend/blob/23743723030a041e4f4f59fa265ee2be0bb51825/common/app/experiments/ExperimentsDefinition.scala#L24-L26).\n\n**Note:** This type is not support by JSON-schema, it evaluates as `object`", + "description": "Server-side AB tests. Optional from `frontend`; a default of\n`{}` is applied by AJV during request validation (see `useDefaults` in\n`validate.ts`), so this is always present after enhancing.", + "default": {}, "type": "object" }, "ajaxUrl": { diff --git a/dotcom-rendering/src/frontend/schemas/feFront.json b/dotcom-rendering/src/frontend/schemas/feFront.json index dfd5240e9e6..676aa1a8ebd 100644 --- a/dotcom-rendering/src/frontend/schemas/feFront.json +++ b/dotcom-rendering/src/frontend/schemas/feFront.json @@ -3479,7 +3479,8 @@ "type": "object", "properties": { "abTests": { - "description": "Narrowest representation of the server-side tests\nobject shape, which is [defined in `frontend`](https://github.com/guardian/frontend/blob/23743723030a041e4f4f59fa265ee2be0bb51825/common/app/experiments/ExperimentsDefinition.scala#L24-L26).\n\n**Note:** This type is not support by JSON-schema, it evaluates as `object`", + "description": "Server-side AB tests. Optional from `frontend`; a default of\n`{}` is applied by AJV during request validation (see `useDefaults` in\n`validate.ts`), so this is always present after enhancing.", + "default": {}, "type": "object" }, "adUnit": { diff --git a/dotcom-rendering/src/frontend/schemas/feTagPage.json b/dotcom-rendering/src/frontend/schemas/feTagPage.json index 066ed439a43..67cf9a5b7bc 100644 --- a/dotcom-rendering/src/frontend/schemas/feTagPage.json +++ b/dotcom-rendering/src/frontend/schemas/feTagPage.json @@ -1639,7 +1639,8 @@ "type": "object", "properties": { "abTests": { - "description": "Narrowest representation of the server-side tests\nobject shape, which is [defined in `frontend`](https://github.com/guardian/frontend/blob/23743723030a041e4f4f59fa265ee2be0bb51825/common/app/experiments/ExperimentsDefinition.scala#L24-L26).\n\n**Note:** This type is not support by JSON-schema, it evaluates as `object`", + "description": "Server-side AB tests. Optional from `frontend`; a default of\n`{}` is applied by AJV during request validation (see `useDefaults` in\n`validate.ts`), so this is always present after enhancing.", + "default": {}, "type": "object" }, "adUnit": { diff --git a/dotcom-rendering/src/model/newsletter-page-schema.json b/dotcom-rendering/src/model/newsletter-page-schema.json index 100a26025ad..9f87ec4ef83 100644 --- a/dotcom-rendering/src/model/newsletter-page-schema.json +++ b/dotcom-rendering/src/model/newsletter-page-schema.json @@ -130,7 +130,8 @@ "$ref": "#/definitions/Switches" }, "abTests": { - "description": "Narrowest representation of the server-side tests\nobject shape, which is [defined in `frontend`](https://github.com/guardian/frontend/blob/23743723030a041e4f4f59fa265ee2be0bb51825/common/app/experiments/ExperimentsDefinition.scala#L24-L26).\n\n**Note:** This type is not support by JSON-schema, it evaluates as `object`", + "description": "Server-side AB tests. Optional from `frontend`; a default of\n`{}` is applied by AJV during request validation (see `useDefaults` in\n`validate.ts`), so this is always present after enhancing.", + "default": {}, "type": "object" }, "serverSideABTests": { diff --git a/dotcom-rendering/src/types/config.ts b/dotcom-rendering/src/types/config.ts index 65f711a8d4c..e89cfa30622 100644 --- a/dotcom-rendering/src/types/config.ts +++ b/dotcom-rendering/src/types/config.ts @@ -44,6 +44,13 @@ export interface Switches { * this data could eventually be defined in dotcom-rendering */ export interface ConfigType extends CommercialConfigType, LegacyConfig { + /** + * Server-side AB tests. Optional from `frontend`; a default of + * `{}` is applied by AJV during request validation (see `useDefaults` in + * `validate.ts`), so this is always present after enhancing. + * + * @default {} + */ abTests: ServerSideTests; adUnit: string; ajaxUrl: string; diff --git a/dotcom-rendering/src/types/newslettersPage.ts b/dotcom-rendering/src/types/newslettersPage.ts index b2220d43022..12791ea9ec7 100644 --- a/dotcom-rendering/src/types/newslettersPage.ts +++ b/dotcom-rendering/src/types/newslettersPage.ts @@ -14,6 +14,13 @@ type FENewslettersConfigType = { sentryHost: string; dcrSentryDsn: string; // used in dotcom-rendering/src/client/sentryLoader/sentry.ts switches: Switches; + /** + * Server-side AB tests. Optional from `frontend`; a default of + * `{}` is applied by AJV during request validation (see `useDefaults` in + * `validate.ts`), so this is always present after enhancing. + * + * @default {} + */ abTests: ServerSideTests; serverSideABTests: Record; dfpAccountId: string;