Something went wrong. Try again.
fork of hey-api/openapi-ts because I need some additional things
Something went wrong. Try again.
910 B · 35 lines
TypeScript
at commit cc01aa2d
123456789101112131415161718192021222324252627282930313233343536import type { UserConfig } from '@hey-api/openapi-python';
export type PluginConfig = NonNullable<NonNullable<UserConfig['plugins']>[number]>;
export const presets = { sdk: () => [ /** SDK */ { name: '@hey-api/python-sdk', operations: { containerName: 'OpenCode', strategy: 'single', }, paramsStructure: 'flat', }, ], validated: () => [ /** SDK + Pydantic validation */ { name: '@hey-api/python-sdk', paramsStructure: 'flat', }, 'pydantic', ],} as const satisfies Record<string, () => ReadonlyArray<PluginConfig>>;
export type PresetKey = keyof typeof presets;
export function getPreset(key: PresetKey = (process.env.PRESET as PresetKey) || 'sdk') { const preset = presets[key]; if (!preset) { throw new Error(`Unknown preset: ${key}. Available: ${Object.keys(presets).join(', ')}`); } return preset();}