@kubb/plugin-oas
Version:
Generator swagger
122 lines (114 loc) • 3.55 kB
TypeScript
import { Oas, Operation, HttpMethod } from '@kubb/oas';
import { Plugin, ResolveNameParams, FileMetaBase } from '@kubb/core';
import * as KubbFile from '@kubb/fs/types';
import { Mode } from '@kubb/fs/types';
import { w as OperationSchemas, f as Schema } from './OperationGenerator-DiF6WJNP.js';
import { a as SchemaContextProps } from './Schema-BbIxCfn7.js';
import '@kubb/react/types';
import 'react';
declare function useOas(): Oas;
/**
* `useOperation` will return the current `Operation`
*/
declare function useOperation(): Operation;
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(): UseOperationManagerResult;
type UseOperationsProps = {
/**
* Filter based on path
* Weight: 2
*/
path?: string;
/**
* Filter based on method
* Weight: 1
*/
method?: HttpMethod;
};
/**
* `useOperations` will return all the Operations
*/
declare function useOperations({ method, path }?: UseOperationsProps): Operation[];
type UseSchemaResult = SchemaContextProps;
/**
* `useSchema` will return the current `schema properties`
*/
declare function useSchema(): UseSchemaResult;
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?: 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;
export { type SchemaNames, useOas, useOperation, useOperationManager, useOperations, useSchema, useSchemaManager };