mirror of
https://github.com/LukeHagar/redocly-cli.git
synced 2025-12-07 04:21:11 +00:00
fix: show error if apis or rules not provided (#1055)
This commit is contained in:
@@ -22,6 +22,7 @@ import {
|
||||
Oas2Definition,
|
||||
} from '@redocly/openapi-core';
|
||||
import { Totals, outputExtensions, Entrypoint, ConfigApis } from './types';
|
||||
import { isEmptyObject } from '@redocly/openapi-core/lib/utils';
|
||||
|
||||
export async function getFallbackApisOrExit(
|
||||
argsApis: string[] | undefined,
|
||||
@@ -455,3 +456,17 @@ function sortOas3Keys(document: Oas3Definition): Oas3Definition {
|
||||
// merge any other top-level keys (e.g. vendor extensions)
|
||||
return Object.assign(result, document);
|
||||
}
|
||||
|
||||
export function checkIfRulesetExist(rules: typeof StyleguideConfig.prototype.rules) {
|
||||
const ruleset = {
|
||||
...rules.oas2,
|
||||
...rules.oas3_0,
|
||||
...rules.oas3_0,
|
||||
};
|
||||
|
||||
if (isEmptyObject(ruleset)) {
|
||||
exitWithError(
|
||||
'⚠️ No rules were configured. Learn how to configure rules: https://redocly.com/docs/cli/rules/'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user