persona-community-5/.pnpm-store/v3/files/e0/56347d6fa2b16c1b06d6a9b3ea55a02bbc3b913d500b97ed972cbe40bf976806490533ea47d53292f947ecdcee4db9c1f7328d5e755f5524821287f18fbf6d
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

25 lines
923 B
Plaintext

import type { Oas3Rule, Oas2Rule } from '../../visitors';
import type { UserContext } from '../../walk';
import type { Oas3Paths } from '../../typings/openapi';
import type { Oas2Paths } from '../../typings/swagger';
export const NoIdenticalPaths: Oas3Rule | Oas2Rule = () => {
return {
Paths(pathMap: Oas3Paths | Oas2Paths, { report, location }: UserContext) {
const Paths = new Map<string, string>();
for (const pathName of Object.keys(pathMap)) {
const id = pathName.replace(/{.+?}/g, '{VARIABLE}');
const existingSamePath = Paths.get(id);
if (existingSamePath) {
report({
message: `The path already exists which differs only by path parameter name(s): \`${existingSamePath}\` and \`${pathName}\`.`,
location: location.child([pathName]).key(),
});
} else {
Paths.set(id, pathName);
}
}
},
};
};