persona-community-5/.pnpm-store/v3/files/3a/31632e41d26c6cc3f09140815fef001d33e0bfd64e51fb8a5a870352830a00f3f6dfdee21985e245248d7259d072eb4839be8e3a22b3c2620d3fe68caa111b
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

22 lines
760 B
Plaintext

import type { Oas3Rule, Oas2Rule } from '../../visitors';
import type { Oas2Operation } from '../../typings/swagger';
import type { Oas3Operation } from '../../typings/openapi';
import type { UserContext } from '../../walk';
export const OperationIdUnique: Oas3Rule | Oas2Rule = () => {
const seenOperations = new Set();
return {
Operation(operation: Oas2Operation | Oas3Operation, { report, location }: UserContext) {
if (!operation.operationId) return;
if (seenOperations.has(operation.operationId)) {
report({
message: 'Every operation must have a unique `operationId`.',
location: location.child([operation.operationId]),
});
}
seenOperations.add(operation.operationId);
},
};
};