openapi-axios
Version:
OpenAPI(2.0/3.0/3.1) Schema → Type-safe Axios
67 lines (66 loc) • 1.7 kB
TypeScript
import { OpenAPILatest } from '../types/openapi';
import { OpenApiLatest_Parameter } from './helpers';
import { Named } from './Named';
import { PrinterOptions } from './types';
import { VarPath } from './VarPath';
export type ArgKind = 'path' | 'headers' | 'cookies' | 'params' | 'data' | 'config' | 'response';
export interface ArgProp {
name: string;
parameter: OpenAPILatest.ParameterObject;
schema: OpenAPILatest.SchemaObject;
}
export declare class Arg {
readonly kind: ArgKind;
readonly operationName: string;
readonly docNamed: Named;
readonly argNamed: Named;
readonly printOptions: PrinterOptions;
/**
* 是否单参数(如 data、config、response)
*/
readonly isSingle: boolean;
parameters: OpenApiLatest_Parameter[];
originName: string;
/**
* 作为属性的名称
*/
propName: string;
/**
* 作为参数的注释名称
*/
docName: string;
/**
* 作为参数的变量名称
*/
argName: string;
/**
* 作为 zod 的变量名称
*/
zodName: string;
/**
* 是否必填
*/
required: boolean;
/**
* 类型名称
*/
typeName: string;
/**
* 类型值
*/
typeValue: string;
/**
* zod 值
*/
zodValue: string;
comments: Record<string, unknown>;
props: ArgProp[];
constructor(kind: ArgKind, operationName: string, docNamed: Named, argNamed: Named, printOptions: PrinterOptions,
/**
* 是否单参数(如 data、config、response)
*/
isSingle?: boolean);
varPath: VarPath;
add(parameter?: OpenApiLatest_Parameter): void;
parse(): Arg | null;
}