@kubb/plugin-oas
Version:
OpenAPI Specification (OAS) plugin for Kubb, providing core functionality for parsing and processing OpenAPI/Swagger schemas for code generation.
92 lines (91 loc) • 2.94 kB
TypeScript
import { C as Plugin, T as ResolveNameParams, h as Operation, t as Schema, u as Oas, v as FileMetaBase, w as PluginFactoryOptions } from "./SchemaMapper-zzZesrTN.js";
import { d as OperationGenerator, g as OperationSchemas } from "./createGenerator-5F-s3MqT.js";
import { KubbFile } from "@kubb/fabric-core/types";
//#region src/hooks/useOas.d.ts
declare function useOas(): Oas;
//#endregion
//#region src/hooks/useOperationManager.d.ts
type FileMeta$1 = FileMetaBase & {
pluginKey: Plugin['key'];
name: string;
group?: {
tag?: string;
path?: string;
};
};
type SchemaNames = {
request: string | undefined;
parameters: {
path: string | undefined;
query: string | undefined;
header: string | undefined;
};
responses: {
default?: string;
} & Record<number | string, string>;
errors: Record<number | string, string>;
};
type UseOperationManagerResult = {
getName: (operation: Operation, params: {
prefix?: string;
suffix?: string;
pluginKey?: Plugin['key'];
type: ResolveNameParams['type'];
}) => string;
getFile: (operation: Operation, params?: {
prefix?: string;
suffix?: string;
pluginKey?: Plugin['key'];
extname?: KubbFile.Extname;
group?: {
tag?: string;
path?: string;
};
}) => KubbFile.File<FileMeta$1>;
groupSchemasByName: (operation: Operation, params: {
pluginKey?: Plugin['key'];
type: ResolveNameParams['type'];
}) => SchemaNames;
getSchemas: (operation: Operation, params?: {
pluginKey?: Plugin['key'];
type?: ResolveNameParams['type'];
}) => OperationSchemas;
getGroup: (operation: Operation) => FileMeta$1['group'] | undefined;
};
/**
* `useOperationManager` will return some helper functions that can be used to get the operation file, get the operation name.
*/
declare function useOperationManager<TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions>(generator: Omit<OperationGenerator<TPluginOptions>, 'build'>): UseOperationManagerResult;
//#endregion
//#region src/hooks/useSchemaManager.d.ts
type FileMeta = FileMetaBase & {
pluginKey: Plugin['key'];
name: string;
group?: {
tag?: string;
path?: string;
};
};
type UseSchemaManagerResult = {
getName: (name: string, params: {
pluginKey?: Plugin['key'];
type: ResolveNameParams['type'];
}) => string;
getFile: (name: string, params?: {
pluginKey?: Plugin['key'];
mode?: KubbFile.Mode;
extname?: KubbFile.Extname;
group?: {
tag?: string;
path?: string;
};
}) => KubbFile.File<FileMeta>;
getImports: (tree: Array<Schema>) => Array<KubbFile.Import>;
};
/**
* `useSchemaManager` will return some helper functions that can be used to get the schema file, get the schema name.
*/
declare function useSchemaManager(): UseSchemaManagerResult;
//#endregion
export { type SchemaNames, useOas, useOperationManager, useSchemaManager };
//# sourceMappingURL=hooks.d.ts.map