Skip to content

Commit

Permalink
fix: config-service validator throws warnings
Browse files Browse the repository at this point in the history
In multiple unit tests the config-validator of the config service throws
warnings as the validate function is finding properties on the instances
of plugins and the corresponding schema is NOT providing the related
schema definition required by the plugin interface.

Signed-off-by: Michael Courtin <michael.courtin@accenture.com>
  • Loading branch information
m-courtin authored and petermetz committed Dec 27, 2021
1 parent 0e76bf6 commit 877dcab
Showing 1 changed file with 26 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export class ConfigService {
const accepted = Object.values(AuthorizationProtocol);
const acceptedCsv = accepted.join(",");
if (!accepted.includes(value)) {
const m = `Accepted authz protocols: ${acceptedCsv} Got: ${value}`;
const m = `Accepted auth protocols: ${acceptedCsv} Got: ${value}`;
throw new Error(m);
}
},
Expand All @@ -141,11 +141,35 @@ export class ConfigService {
env: "PLUGINS",
arg: "plugins",
pluginSchema: {
packageName: "*",
action: {
format: (value: PluginImportAction) => {
ConfigService.formatNonBlankString(value);
const accepted = Object.values(PluginImportAction);
const acceptedCsv = accepted.join(",");
if (!accepted.includes(value)) {
const m = `Accepted plugin import actions: ${acceptedCsv} Got: ${value}`;
throw new Error(m);
}
},
default: PluginImportAction.Install,
},
options: {
format: Object,
default: {},
},
packageName: "*",
type: {
format: (value: PluginImportType) => {
ConfigService.formatNonBlankString(value);
const accepted = Object.values(PluginImportType);
const acceptedCsv = accepted.join(",");
if (!accepted.includes(value)) {
const m = `Accepted plugin import types: ${acceptedCsv} Got: ${value}`;
throw new Error(m);
}
},
default: PluginImportType.Local,
},
},
} as SchemaObj<PluginImport[]>,
configFile: {
Expand Down

0 comments on commit 877dcab

Please sign in to comment.