@redocly/cli
Version:
[@Redocly](https://redocly.com) CLI is your all-in-one API documentation utility. It builds, manages, improves, and quality-checks your API descriptions, all of which comes in handy for various phases of the API Lifecycle. Create your own rulesets to make
17 lines • 857 B
JavaScript
import { isString } from '@redocly/openapi-core';
import { yellow } from 'colorette';
import { exitWithError } from '../../../utils/error.js';
export function getInfoPrefix(info, prefixArg, type) {
if (!prefixArg)
return '';
if (!info)
exitWithError('Info section is not found in specification.');
if (!info[prefixArg])
exitWithError(`${yellow(`prefix-${type}-with-info-prop`)} argument value is not found in info section.`);
if (!isString(info[prefixArg]))
exitWithError(`${yellow(`prefix-${type}-with-info-prop`)} argument value should be string.`);
if (info[prefixArg].length > 50)
exitWithError(`${yellow(`prefix-${type}-with-info-prop`)} argument value length should not exceed 50 characters.`);
return info[prefixArg].replaceAll(/\s/g, '_');
}
//# sourceMappingURL=get-info-prefix.js.map