Skip to content

Commit

Permalink
fix(validations): add provider name and remove credentials and connec…
Browse files Browse the repository at this point in the history
…tion_config from interpolation checks (#2894)

## Describe your changes

- Fixes validation errors for #2893 by adding a provider name for better
debugging and also removing `connection_config` and `credentials` from
interpolation errors check
  • Loading branch information
hassan254-prog authored Oct 25, 2024
1 parent 8206e67 commit e0829e3
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions scripts/validation/providers/validate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,14 @@ if (validator.errors) {
}

const invalidInterpolation = /(?<!(\$|]))\{/g;
const match = [...providersYaml.toString().matchAll(invalidInterpolation)];
if (match.length > 0) {
console.error(chalk.red('error'), 'providers.yaml contains interpolation errors. A `{` does not have a `$` in front of it.');
process.exit(1);
for (const [providerKey, provider] of Object.entries(providersJson)) {
const { credentials, connection_config, ...providerWithoutSensitive } = provider;
const strippedProviderYaml = jsYaml.dump({ [providerKey]: providerWithoutSensitive });
const match = [...strippedProviderYaml.matchAll(invalidInterpolation)];
if (match.length > 0) {
console.error(chalk.red('error'), 'Provider', chalk.blue(providerKey), `contains interpolation errors. A \`{\` does not have a \`$\` in front of it.`);
process.exit(1);
}
}

console.log('✅ JSON schema valid');
Expand Down

0 comments on commit e0829e3

Please sign in to comment.