Files
klz-cables.com/.pnpm-store/v10/files/1a/a2712c97ad27ea8b5ea0079e770548f4133044ab557268109dd449368470af83441f957f071c52b982e1e8dfcdf9f6dc6ac36910f5b6fbf5ef9a857a1a9e3e
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

45 lines
1.2 KiB
Plaintext

import { groupBy } from '../../jsutils/groupBy.mjs';
import { GraphQLError } from '../../error/GraphQLError.mjs';
/**
* Unique argument names
*
* A GraphQL field or directive is only valid if all supplied arguments are
* uniquely named.
*
* See https://spec.graphql.org/draft/#sec-Argument-Names
*/
export function UniqueArgumentNamesRule(context) {
return {
Field: checkArgUniqueness,
Directive: checkArgUniqueness,
};
function checkArgUniqueness(parentNode) {
var _parentNode$arguments;
// FIXME: https://github.com/graphql/graphql-js/issues/2203
/* c8 ignore next */
const argumentNodes =
(_parentNode$arguments = parentNode.arguments) !== null &&
_parentNode$arguments !== void 0
? _parentNode$arguments
: [];
const seenArgs = groupBy(argumentNodes, (arg) => arg.name.value);
for (const [argName, argNodes] of seenArgs) {
if (argNodes.length > 1) {
context.reportError(
new GraphQLError(
`There can be only one argument named "${argName}".`,
{
nodes: argNodes.map((node) => node.name),
},
),
);
}
}
}
}