From 711f3bffaeaa8d6715928bde4db8929d022cf73e Mon Sep 17 00:00:00 2001 From: Henry Mercer Date: Mon, 5 Oct 2026 14:00:46 +0100 Subject: [PATCH] Remove the `checkDefaultSetupConfig` wrapper around `checkSchema` Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- lib/entry-points.js | 11 ++++++----- src/config/db-config.ts | 19 ++++++------------- 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/lib/entry-points.js b/lib/entry-points.js index e60e79fc8..56ff81be2 100644 --- a/lib/entry-points.js +++ b/lib/entry-points.js @@ -173233,21 +173233,22 @@ var DEFAULT_SETUP_CONFIG_SCHEMA = { object(DEFAULT_SETUP_SCHEMA) ) }; -function checkDefaultSetupConfig(config) { - return checkSchema(DEFAULT_SETUP_CONFIG_SCHEMA, config); -} function matchesDefaultSetupConfigSchema(config) { if (!isObject2(config)) { return false; } - const result = checkDefaultSetupConfig(config); + const result = checkSchema( + DEFAULT_SETUP_CONFIG_SCHEMA, + config + ); return result.valid && result.unknownKeys.length === 0; } function mergeDefaultSetupAndUserConfigs(logger2, fromConfigInput, fromConfigFile) { logger2.debug( "Combining configuration files from 'config' and 'config-file' inputs" ); - const schemaCheckResult = checkDefaultSetupConfig( + const schemaCheckResult = checkSchema( + DEFAULT_SETUP_CONFIG_SCHEMA, fromConfigInput ); if (schemaCheckResult.invalidKeys.length > 0) { diff --git a/src/config/db-config.ts b/src/config/db-config.ts index 04f982e3c..e0e837b7d 100644 --- a/src/config/db-config.ts +++ b/src/config/db-config.ts @@ -98,17 +98,6 @@ const DEFAULT_SETUP_CONFIG_SCHEMA = { ), } as const satisfies json.Schema; -/** - * Checks `config` against the properties that Default Setup sets in the `config` input. The result - * lists any other properties in `unknownKeys`, and any properties with invalid values in - * `invalidKeys`. - */ -function checkDefaultSetupConfig( - config: json.UnvalidatedObject, -): json.CheckSchemaResult { - return json.checkSchema(DEFAULT_SETUP_CONFIG_SCHEMA, config); -} - /** * Returns whether `config` is a mapping that only sets the properties that Default Setup sets in * the `config` input, to valid values. @@ -118,7 +107,10 @@ export function matchesDefaultSetupConfigSchema(config: UserConfig): boolean { if (!json.isObject(config)) { return false; } - const result = checkDefaultSetupConfig(config as json.UnvalidatedObject); + const result = json.checkSchema( + DEFAULT_SETUP_CONFIG_SCHEMA, + config as json.UnvalidatedObject, + ); // `valid` doesn't account for unknown properties. return result.valid && result.unknownKeys.length === 0; } @@ -145,7 +137,8 @@ export function mergeDefaultSetupAndUserConfigs( // Check for unexpected keys in the configuration from the `config` input // that was provided by Default Setup. This should only contain the keys // we would expect to receive from Default Setup. - const schemaCheckResult = checkDefaultSetupConfig( + const schemaCheckResult = json.checkSchema( + DEFAULT_SETUP_CONFIG_SCHEMA, fromConfigInput as json.UnvalidatedObject, );