Compare commits
1 Commits
30c5dc8508
...
ff9aec8702
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ff9aec8702 |
@@ -37,7 +37,10 @@ class OutputUtils {
|
|||||||
const changedFields = this.checkForChanges(output,format);
|
const changedFields = this.checkForChanges(output,format);
|
||||||
|
|
||||||
if (Object.keys(changedFields).length > 0) {
|
if (Object.keys(changedFields).length > 0) {
|
||||||
const measurement = config.general.name;
|
// Fall back to `<softwareType>_<id>` when `general.name` is unset —
|
||||||
|
// the original convention before name became a registered config field.
|
||||||
|
const measurement = config.general.name
|
||||||
|
|| `${config.functionality?.softwareType}_${config.general.id}`;
|
||||||
const flatTags = this.flattenTags(this.extractRelevantConfig(config));
|
const flatTags = this.flattenTags(this.extractRelevantConfig(config));
|
||||||
const formatterName = this.resolveFormatterName(config, format);
|
const formatterName = this.resolveFormatterName(config, format);
|
||||||
const formatter = getFormatter(formatterName);
|
const formatter = getFormatter(formatterName);
|
||||||
|
|||||||
@@ -233,6 +233,13 @@ class ValidationUtils {
|
|||||||
return fieldSchema.default;
|
return fieldSchema.default;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Public wrapper for the curve validator — exposes the helper so
|
||||||
|
// callers (and tests) can validate a raw curve without going
|
||||||
|
// through validateSchema.
|
||||||
|
validateCurve(input, defaultCurve) {
|
||||||
|
return validateCurve(input, defaultCurve, this.logger);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = ValidationUtils;
|
module.exports = ValidationUtils;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ function validateArray(configValue, rules, fieldSchema, name, key, logger) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.slice(0, rules.maxLength || Infinity);
|
.slice(0, rules.maxLength || Infinity);
|
||||||
if (validatedArray.length < (rules.minLength || 1)) {
|
if (validatedArray.length < (rules.minLength ?? 1)) {
|
||||||
logger.warn(
|
logger.warn(
|
||||||
`${name}.${key} contains fewer items than allowed (${rules.minLength}). Using default value.`
|
`${name}.${key} contains fewer items than allowed (${rules.minLength}). Using default value.`
|
||||||
);
|
);
|
||||||
@@ -41,7 +41,7 @@ function validateSet(configValue, rules, fieldSchema, name, key, logger) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.slice(0, rules.maxLength || Infinity);
|
.slice(0, rules.maxLength || Infinity);
|
||||||
if (validatedArray.length < (rules.minLength || 1)) {
|
if (validatedArray.length < (rules.minLength ?? 1)) {
|
||||||
logger.warn(
|
logger.warn(
|
||||||
`${name}.${key} contains fewer items than allowed (${rules.minLength}). Using default value.`
|
`${name}.${key} contains fewer items than allowed (${rules.minLength}). Using default value.`
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user