Something went wrong. Try again.
fork of hey-api/openapi-ts because I need some additional things
Something went wrong. Try again.
TypeScript
12345678910111213141516171819202122232425262728293031323334353637import type { Input } from '../../config/input/types';import { heyApiRegistryBaseUrl, inputToHeyApiPath } from './heyApi';import { inputToReadmePath } from './readme';import { inputToScalarPath } from './scalar';
export function inputToApiRegistry( input: Input & { path: string; },) { if (input.path.startsWith('readme:')) { Object.assign(input, inputToReadmePath(input.path)); return; }
if (input.path.startsWith('scalar:')) { Object.assign(input, inputToScalarPath(input.path)); return; }
if (input.path.startsWith('.')) { return; }
if (input.path.startsWith(heyApiRegistryBaseUrl)) { input.path = input.path.slice(heyApiRegistryBaseUrl.length + 1); Object.assign(input, inputToHeyApiPath(input as Input & { path: string })); return; }
const parts = input.path.split('/'); if (parts.length === 2 && parts.filter(Boolean).length === 2) { Object.assign(input, inputToHeyApiPath(input as Input & { path: string })); return; }}