npm package diff
Package: @forge/manifest
Versions: 7.5.2-next.0-experimental-10722bc - 7.7.0-next.13
File: package/out/validators/modules-validators/jira/validate-custom-field.js
Index: package/out/validators/modules-validators/jira/validate-custom-field.js
===================================================================
--- package/out/validators/modules-validators/jira/validate-custom-field.js
+++ package/out/validators/modules-validators/jira/validate-custom-field.js
@@ -0,0 +1,31 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.validateJiraCustomField = void 0;
+const types_1 = require("../../../types");
+const text_1 = require("../../../text");
+const utils_1 = require("../../../utils");
+function validateJiraCustomField(modules, yamlContentByLine) {
+ const validationErrors = [];
+ [types_1.AllModuleTypes.JiraCustomField, types_1.AllModuleTypes.JiraCustomFieldType].forEach((moduleType) => {
+ modules[moduleType]?.forEach((module) => {
+ if (!module || module.type !== 'object' || !module.schema)
+ return;
+ const getAliases = (properties = {}) => Object.values(properties)
+ .map((v) => [v.searchAlias, ...getAliases(v.properties)])
+ .reduce((acc, val) => acc.concat(val), [])
+ .filter(Boolean);
+ const aliases = getAliases(module.schema.properties);
+ const duplicates = Array.from(new Set(aliases.filter((item, index) => aliases.indexOf(item) != index)));
+ if (duplicates.length) {
+ validationErrors.push({
+ message: text_1.errors.modules.customFields.searchAlias(duplicates),
+ reference: text_1.References.Modules,
+ level: 'error',
+ ...(0, utils_1.findPosition)(module.key, yamlContentByLine)
+ });
+ }
+ });
+ });
+ return validationErrors;
+}
+exports.validateJiraCustomField = validateJiraCustomField;