fork of hey-api/openapi-ts because I need some additional things
at feat/use-mutation-hooks 27 lines 1.1 kB view raw
1import path from 'node:path'; 2 3import { getSpecsPath } from '../packages/openapi-ts-tests/utils'; 4 5export const inputs = { 6 circular: path.resolve(getSpecsPath(), '3.0.x', 'circular.yaml'), 7 full: path.resolve(getSpecsPath(), '3.1.x', 'full.yaml'), 8 local: 'http://localhost:8000/openapi.json', 9 opencode: path.resolve(getSpecsPath(), '3.1.x', 'opencode.yaml'), 10 petstore: 11 'https://raw.githubusercontent.com/swagger-api/swagger-petstore/master/src/main/resources/openapi.yaml', 12 redfish: 13 'https://raw.githubusercontent.com/DMTF/Redfish-Publications/refs/heads/main/openapi/openapi.yaml', 14 scalar: 'scalar:@scalar/access-service', 15 transformers: path.resolve(getSpecsPath(), '3.1.x', 'transformers.json'), 16 validators: path.resolve(getSpecsPath(), '3.1.x', 'validators.yaml'), 17} as const; 18 19export type InputKey = keyof typeof inputs; 20 21export function getInput(key: InputKey = (process.env.INPUT as InputKey) || 'opencode') { 22 const input = inputs[key]; 23 if (!input) { 24 throw new Error(`Unknown input: ${key}. Available: ${Object.keys(inputs).join(', ')}`); 25 } 26 return input; 27}