Skip to content

Commit 711f3bf

Browse files
henrymercerCopilot
andcommitted
Remove the checkDefaultSetupConfig wrapper around checkSchema
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent ac4b9b8 commit 711f3bf

2 files changed

Lines changed: 12 additions & 18 deletions

File tree

‎lib/entry-points.js‎

Lines changed: 6 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/config/db-config.ts‎

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -98,17 +98,6 @@ const DEFAULT_SETUP_CONFIG_SCHEMA = {
9898
),
9999
} as const satisfies json.Schema;
100100

101-
/**
102-
* Checks `config` against the properties that Default Setup sets in the `config` input. The result
103-
* lists any other properties in `unknownKeys`, and any properties with invalid values in
104-
* `invalidKeys`.
105-
*/
106-
function checkDefaultSetupConfig(
107-
config: json.UnvalidatedObject<any>,
108-
): json.CheckSchemaResult {
109-
return json.checkSchema(DEFAULT_SETUP_CONFIG_SCHEMA, config);
110-
}
111-
112101
/**
113102
* Returns whether `config` is a mapping that only sets the properties that Default Setup sets in
114103
* the `config` input, to valid values.
@@ -118,7 +107,10 @@ export function matchesDefaultSetupConfigSchema(config: UserConfig): boolean {
118107
if (!json.isObject(config)) {
119108
return false;
120109
}
121-
const result = checkDefaultSetupConfig(config as json.UnvalidatedObject<any>);
110+
const result = json.checkSchema(
111+
DEFAULT_SETUP_CONFIG_SCHEMA,
112+
config as json.UnvalidatedObject<any>,
113+
);
122114
// `valid` doesn't account for unknown properties.
123115
return result.valid && result.unknownKeys.length === 0;
124116
}
@@ -145,7 +137,8 @@ export function mergeDefaultSetupAndUserConfigs(
145137
// Check for unexpected keys in the configuration from the `config` input
146138
// that was provided by Default Setup. This should only contain the keys
147139
// we would expect to receive from Default Setup.
148-
const schemaCheckResult = checkDefaultSetupConfig(
140+
const schemaCheckResult = json.checkSchema(
141+
DEFAULT_SETUP_CONFIG_SCHEMA,
149142
fromConfigInput as json.UnvalidatedObject<any>,
150143
);
151144

0 commit comments

Comments
 (0)