persona-community-5/.pnpm-store/v3/files/cd/894224e0ec49706c1e23a2056928bc80ad848ca14fe360a655abac879a03e8bc3fcf4dffaa2f965474c11d5f1c3838173518b8d0028c4d16dd80df8bdd4557
rdev-worker a1d0d1bf1c
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
build: /implement-feature community-ui --requirements 'Build the React commu...
2026-02-24 08:22:30 +00:00

34 lines
972 B
Plaintext

import type { Arazzo1Rule } from '../../visitors';
import type { UserContext } from '../../walk';
export const RequestBodyReplacementsUnique: Arazzo1Rule = () => {
const seenReplacements = new Set();
return {
Step: {
leave() {
seenReplacements.clear();
},
RequestBody: {
enter(requestBody, { report, location }: UserContext) {
if (!requestBody.replacements) return;
for (const replacement of requestBody.replacements) {
if (seenReplacements.has(replacement.target)) {
report({
message: 'Every `replacement` in `requestBody` must be unique.',
location: location.child([
'replacements',
requestBody.replacements.indexOf(replacement),
`target`,
]),
});
}
seenReplacements.add(replacement.target);
}
},
},
},
};
};