mirror of
https://github.com/LukeHagar/redocly-cli.git
synced 2025-12-09 20:57:44 +00:00
chore: move remove-unused-components decorator to decorators folder (#1316)
This commit is contained in:
@@ -17,8 +17,8 @@ import { reportUnresolvedRef } from './rules/no-unresolved-refs';
|
||||
import { isPlainObject, isTruthy } from './utils';
|
||||
import { OasRef } from './typings/openapi';
|
||||
import { isRedoclyRegistryURL } from './redocly';
|
||||
import { RemoveUnusedComponents as RemoveUnusedComponentsOas2 } from './rules/oas2/remove-unused-components';
|
||||
import { RemoveUnusedComponents as RemoveUnusedComponentsOas3 } from './rules/oas3/remove-unused-components';
|
||||
import { RemoveUnusedComponents as RemoveUnusedComponentsOas2 } from './decorators/oas2/remove-unused-components';
|
||||
import { RemoveUnusedComponents as RemoveUnusedComponentsOas3 } from './decorators/oas3/remove-unused-components';
|
||||
|
||||
import type { Config, StyleguideConfig } from './config';
|
||||
|
||||
@@ -126,8 +126,8 @@ export async function bundleDocument(opts: {
|
||||
config
|
||||
);
|
||||
|
||||
const preprocessors = initRules(rules as any, config, 'preprocessors', specVersion);
|
||||
const decorators = initRules(rules as any, config, 'decorators', specVersion);
|
||||
const preprocessors = initRules(rules, config, 'preprocessors', specVersion);
|
||||
const decorators = initRules(rules, config, 'decorators', specVersion);
|
||||
|
||||
const ctx: BundleContext = {
|
||||
problems: [],
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { Oas2Rule } from '../../visitors';
|
||||
import type { Oas2Decorator } from '../../visitors';
|
||||
import { Location } from '../../ref-utils';
|
||||
import { Oas2Components } from '../../typings/swagger';
|
||||
import type { Oas2Components } from '../../typings/swagger';
|
||||
import { isEmptyObject } from '../../utils';
|
||||
|
||||
export const RemoveUnusedComponents: Oas2Rule = () => {
|
||||
export const RemoveUnusedComponents: Oas2Decorator = () => {
|
||||
const components = new Map<
|
||||
string,
|
||||
{ used: boolean; componentType?: keyof Oas2Components; name: string }
|
||||
@@ -1,9 +1,9 @@
|
||||
import { Oas3Rule } from '../../visitors';
|
||||
import type { Oas3Decorator } from '../../visitors';
|
||||
import { Location } from '../../ref-utils';
|
||||
import { Oas3Components } from '../../typings/openapi';
|
||||
import type { Oas3Components } from '../../typings/openapi';
|
||||
import { isEmptyObject } from '../../utils';
|
||||
|
||||
export const RemoveUnusedComponents: Oas3Rule = () => {
|
||||
export const RemoveUnusedComponents: Oas3Decorator = () => {
|
||||
const components = new Map<
|
||||
string,
|
||||
{ used: boolean; componentType?: keyof Oas3Components; name: string }
|
||||
@@ -204,6 +204,7 @@ type Oas2FlatVisitor = {
|
||||
NamedResponses?: VisitFunctionOrObject<Record<string, Oas2Response>>;
|
||||
NamedParameters?: VisitFunctionOrObject<Record<string, Oas2Parameter>>;
|
||||
SecurityScheme?: VisitFunctionOrObject<Oas2SecurityScheme>;
|
||||
NamedSecuritySchemes?: VisitFunctionOrObject<Record<string, Oas2SecurityScheme>>;
|
||||
SpecExtension?: VisitFunctionOrObject<unknown>;
|
||||
};
|
||||
|
||||
@@ -255,18 +256,6 @@ export type Async2Visitor = BaseVisitor &
|
||||
Async2NestedVisitor &
|
||||
Record<string, VisitFunction<any> | NestedVisitObject<any, Async2NestedVisitor>>;
|
||||
|
||||
export type Oas3TransformVisitor = BaseVisitor &
|
||||
Oas3FlatVisitor &
|
||||
Record<string, VisitFunction<any> | VisitObject<any>>;
|
||||
|
||||
export type Oas2TransformVisitor = BaseVisitor &
|
||||
Oas2FlatVisitor &
|
||||
Record<string, VisitFunction<any> | VisitObject<any>>;
|
||||
|
||||
export type Async2TransformVisitor = BaseVisitor &
|
||||
Async2FlatVisitor &
|
||||
Record<string, VisitFunction<any> | VisitObject<any>>;
|
||||
|
||||
export type NestedVisitor<T> = Exclude<T, 'any' | 'ref' | 'Root'>;
|
||||
|
||||
export type NormalizedOasVisitors<T extends BaseVisitor> = {
|
||||
@@ -289,12 +278,12 @@ export type NormalizedOasVisitors<T extends BaseVisitor> = {
|
||||
export type Oas3Rule = (options: Record<string, any>) => Oas3Visitor | Oas3Visitor[];
|
||||
export type Oas2Rule = (options: Record<string, any>) => Oas2Visitor | Oas2Visitor[];
|
||||
export type Async2Rule = (options: Record<string, any>) => Async2Visitor | Async2Visitor[];
|
||||
export type Oas3Preprocessor = (options: Record<string, any>) => Oas3TransformVisitor;
|
||||
export type Oas2Preprocessor = (options: Record<string, any>) => Oas2TransformVisitor;
|
||||
export type Async2Preprocessor = (options: Record<string, any>) => Async2TransformVisitor;
|
||||
export type Oas3Decorator = (options: Record<string, any>) => Oas3TransformVisitor;
|
||||
export type Oas2Decorator = (options: Record<string, any>) => Oas2TransformVisitor;
|
||||
export type Async2Decorator = (options: Record<string, any>) => Async2TransformVisitor;
|
||||
export type Oas3Preprocessor = (options: Record<string, any>) => Oas3Visitor;
|
||||
export type Oas2Preprocessor = (options: Record<string, any>) => Oas2Visitor;
|
||||
export type Async2Preprocessor = (options: Record<string, any>) => Async2Visitor;
|
||||
export type Oas3Decorator = (options: Record<string, any>) => Oas3Visitor;
|
||||
export type Oas2Decorator = (options: Record<string, any>) => Oas2Visitor;
|
||||
export type Async2Decorator = (options: Record<string, any>) => Async2Visitor;
|
||||
|
||||
// alias for the latest version supported
|
||||
// every time we update it - consider semver
|
||||
|
||||
Reference in New Issue
Block a user