@moccona/apicodegen
Version:
A powerful OpenAPI code generator that automatically generates TypeScript API client code from OpenAPI specifications.
39 lines (38 loc) • 1.24 kB
text/typescript
import { PluginOption } from "vite";
//#region src/vite-plugin/index.d.ts
type ApiCodeGenPluginOptions = {
/** Human-readable name for this API config (required) */name: string; /** OpenAPI spec file path or URL */
spec?: string; /** Output file path */
output?: string; /** HTTP client adaptor */
adaptor?: 'fetch' | 'axios'; /** Base URL for API endpoints */
baseURL?: string; /** Custom client import source path */
importClientSource?: string; /** Enable verbose logging */
verbose?: boolean; /** Run type check after generation (default: true) */
typeCheck?: boolean;
};
/**
* Main Vite plugin function
*
* @example
* ```ts
* // vite.config.ts
* import { apiCodeGenPlugin } from '@moccona/apicodegen/vite';
*
* export default defineConfig({
* plugins: [
* apiCodeGenPlugin([
* {
* name: 'my-api',
* spec: './openapi.json',
* output: './src/api/generated.ts',
* baseURL: 'https://api.example.com',
* },
* ]),
* ],
* });
* ```
*/
declare function apiCodeGenPlugin(options: ApiCodeGenPluginOptions[]): PluginOption;
//#endregion
export { ApiCodeGenPluginOptions, apiCodeGenPlugin, apiCodeGenPlugin as default };
//# sourceMappingURL=index.d.mts.map