@redocly/openapi-core
Version:
See https://github.com/Redocly/openapi-cli
18 lines (17 loc) • 659 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.OperationIdUrlSafe = void 0;
const validUrlSymbols = /^[A-Za-z0-9-._~:/?#\[\]@!\$&'()*+,;=]*$/;
const OperationIdUrlSafe = () => {
return {
Operation(operation, { report, location }) {
if (operation.operationId && !validUrlSymbols.test(operation.operationId)) {
report({
message: 'Operation `operationId` should not have URL invalid characters.',
location: location.child(['operationId']),
});
}
},
};
};
exports.OperationIdUrlSafe = OperationIdUrlSafe;