in libraries/azure-app-configuration-importer/src/internal/parsers/kvSetConfigurationSettingsConverter.ts [47:77]
private validateKvSetElement(element: KvSetConfigurationItem) {
if (!element.key) {
throw new ArgumentError("Configuration key is required, cannot be an empty string");
}
if (typeof element.key !== "string") {
throw new ArgumentError(`Invalid key '${element.key}', key must be a string`);
}
if (element.key === "." || element.key === ".." || element.key.indexOf("%") > -1) {
throw new ArgumentError("Key cannot be a '.' or '..', or contain the '%' character.");
}
if (element.key.startsWith(featureFlagPrefix) && element.content_type !== featureFlagContentType) {
throw new ArgumentError(`Invalid key '${element.key}'. Key cannot start with the reserved prefix for feature flags.`);
}
if (element.value && typeof element.value !== "string") {
throw new ArgumentError(`The 'value' for the key '${element.key}' is not a string.`);
}
if (element.content_type && typeof element.content_type !== "string") {
throw new ArgumentError(`The 'content_type' for the key '${element.key}' is not a string.`);
}
if (element.label && typeof element.label !== "string") {
throw new ArgumentError(`The 'label' for the key '${element.key}' is not a string.`);
}
if (typeof element.tags !== "object") {
throw new ArgumentError(`The value for the tag '${element.tags}' for key '${element.key}' is not in a valid format.`);
}
for (const item in element.tags) {
if (typeof element.tags[item] !== "string") {
throw new ArgumentError(`The value for the tag '${element.tags}' for key '${element.key}' is not in a valid format.`);
}
}
}