@redocly/openapi-core
Version:
See https://github.com/Redocly/redocly-cli
20 lines (19 loc) • 769 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ChannelsKebabCase = void 0;
const ChannelsKebabCase = () => {
return {
Channel(channel, { report }) {
const segments = (channel.address || '')
.split(/[/.:]/) // split on / or : as likely channel namespacers
.filter((s) => s !== ''); // filter out empty segments
if (!segments.every((segment) => /^{.+}$/.test(segment) || /^[a-z0-9-.]+$/.test(segment))) {
report({
message: `\`${channel.address}\` does not use kebab-case.`,
location: { reportOnKey: true },
});
}
},
};
};
exports.ChannelsKebabCase = ChannelsKebabCase;