persona-community-5/.pnpm-store/v3/files/c8/fb13ac6beb70b64f6980fe89119c1f001600e915725b06a07d819562d9c86705b7499b59f03e87d767a937cbe7f7cfadc0989eefc74a4331ca12af88e5b61e
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

24 lines
916 B
Plaintext

import type { Oas2Rule, Oas3Rule } from '../../visitors';
import type { Oas2PathItem } from '../../typings/swagger';
import type { Oas3PathItem } from '../../typings/openapi';
import type { UserContext } from '../../walk';
export const PathExcludesPatterns: Oas3Rule | Oas2Rule = ({ patterns }) => {
return {
PathItem(_path: Oas2PathItem | Oas3PathItem, { report, key, location }: UserContext) {
if (!patterns)
throw new Error(`Parameter "patterns" is not provided for "path-excludes-patterns" rule`);
const pathKey = key.toString();
if (pathKey.startsWith('/')) {
const matches = patterns.filter((pattern: string) => pathKey.match(pattern));
for (const match of matches) {
report({
message: `path \`${pathKey}\` should not match regex pattern: \`${match}\``,
location: location.key(),
});
}
}
},
};
};