UNPKG

@redocly/openapi-core

Version:

See https://github.com/Redocly/redocly-cli

21 lines (20 loc) 703 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PathsKebabCase = void 0; const PathsKebabCase = () => { return { PathItem(_path, { report, key }) { const segments = key .substr(1) .split('/') .filter((s) => s !== ''); // filter out empty segments if (!segments.every((segment) => /^{.+}$/.test(segment) || /^[a-z0-9-.]+$/.test(segment))) { report({ message: `\`${key}\` does not use kebab-case.`, location: { reportOnKey: true }, }); } }, }; }; exports.PathsKebabCase = PathsKebabCase;