Remove the checkDefaultSetupConfig wrapper around checkSchema

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Henry Mercer
2026-10-05 14:24:01 +01:00
co-authored by Copilot App
parent ac4b9b891d
commit 711f3bffae
2 changed files with 12 additions and 18 deletions
+6 -5
View File
@@ -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) {
+6 -13
View File
@@ -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<any>,
): 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<any>);
const result = json.checkSchema(
DEFAULT_SETUP_CONFIG_SCHEMA,
config as json.UnvalidatedObject<any>,
);
// `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<any>,
);