fork of hey-api/openapi-ts because I need some additional things
1import type { PluginContext } from '@hey-api/shared';
2
3import type { UserConfig } from '../types';
4import type { ExamplesConfig } from './types';
5
6type Config = Omit<UserConfig, 'name'>;
7
8export function resolveExamples(config: Config, context: PluginContext): ExamplesConfig {
9 return context.valueToObject({
10 defaultValue: {
11 enabled: Boolean(config.examples),
12 language: 'Python',
13 },
14 mappers: {
15 boolean: (enabled) => ({ enabled }),
16 },
17 value: config.examples,
18 }) as ExamplesConfig;
19}