persona-community-5/.pnpm-store/v3/files/ea/693e958bf975dc7888738ff0b1e49984133c81bf3c6b47f138c35a94289b16b7ac28a16de8f8b1e4290680aea9623593a73a47d5db74e699861b6ddfc95539
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

21 lines
781 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';
// eslint-disable-next-line no-useless-escape
const validUrlSymbols = /^[A-Za-z0-9-._~:/?#\[\]@!\$&'()*+,;=]*$/;
export const OperationIdUrlSafe: Oas3Rule | Oas2Rule = () => {
return {
Operation(operation: Oas2Operation | Oas3Operation, { report, location }: UserContext) {
if (operation.operationId && !validUrlSymbols.test(operation.operationId)) {
report({
message: 'Operation `operationId` should not have URL invalid characters.',
location: location.child(['operationId']),
});
}
},
};
};