fork of hey-api/openapi-ts because I need some additional things
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at feat/use-query-options 37 lines 885 B view raw
1import type { SchemaWithType } from '@hey-api/shared'; 2 3import { $ } from '../../../../py-dsl'; 4import type { NeverResolverContext } from '../../resolvers'; 5import type { PydanticType } from '../../shared/types'; 6import type { PydanticPlugin } from '../../types'; 7 8function baseNode(ctx: NeverResolverContext): PydanticType { 9 const { plugin } = ctx; 10 return { 11 type: plugin.external('typing.NoReturn'), 12 }; 13} 14 15function neverResolver(ctx: NeverResolverContext): PydanticType { 16 return ctx.nodes.base(ctx); 17} 18 19export function neverToType({ 20 plugin, 21 schema, 22}: { 23 plugin: PydanticPlugin['Instance']; 24 schema: SchemaWithType<'never'>; 25}): PydanticType { 26 const ctx: NeverResolverContext = { 27 $, 28 nodes: { 29 base: baseNode, 30 }, 31 plugin, 32 schema, 33 }; 34 35 const resolver = plugin.config['~resolvers']?.never; 36 return resolver?.(ctx) ?? neverResolver(ctx); 37}