diff --git a/adminSiteServer/multiDim.ts b/adminSiteServer/multiDim.ts index 63276daf91..7675f41c27 100644 --- a/adminSiteServer/multiDim.ts +++ b/adminSiteServer/multiDim.ts @@ -1,6 +1,7 @@ import { uniq } from "lodash" import { uuidv7 } from "uuidv7" +import { migrateGrapherConfigToLatestVersion } from "@ourworldindata/grapher" import { Base64String, ChartConfigsTableName, @@ -284,11 +285,21 @@ export async function createMultiDimConfig( const enrichedViews = await Promise.all( config.views.map(async (view) => { const variableId = view.indicators.y[0] - const patchGrapherConfig = view.config || {} + let patchGrapherConfig = {} + if (view.config) { + patchGrapherConfig = config.grapherConfigSchema + ? migrateGrapherConfigToLatestVersion({ + ...view.config, + $schema: config.grapherConfigSchema, + }) + : view.config + } const fullGrapherConfig = mergeGrapherConfigs( variableConfigs.get(variableId) ?? {}, patchGrapherConfig, { + $schema: + "https://files.ourworldindata.org/schemas/grapher-schema.005.json", dimensions: MultiDimDataPageConfig.viewToDimensionsConfig(view), selectedEntityNames: config.defaultSelection ?? [], diff --git a/packages/@ourworldindata/types/src/siteTypes/MultiDimDataPage.ts b/packages/@ourworldindata/types/src/siteTypes/MultiDimDataPage.ts index b9eb95f433..7281ef0441 100644 --- a/packages/@ourworldindata/types/src/siteTypes/MultiDimDataPage.ts +++ b/packages/@ourworldindata/types/src/siteTypes/MultiDimDataPage.ts @@ -15,6 +15,7 @@ type Metadata = Omit interface MultiDimDataPageConfigType< IndicatorType extends Record, > { + grapherConfigSchema?: string title: IndicatorTitleWithFragments defaultSelection?: string[] topicTags?: string[]