fork of hey-api/openapi-ts because I need some additional things
at feat/skip-token 35 lines 911 B view raw
1import type { DefinePlugin, IR } from '@hey-api/openapi-ts'; 2 3// import { createOpencode } from '@opencode-ai/sdk'; 4import { PetStore } from './.gen/sdk.gen.ts'; 5 6type MyPluginConfig = { readonly name: 'myplugin' }; 7type MyPlugin = DefinePlugin<MyPluginConfig>; 8 9export function f(schema: IR.SchemaObject, plugin: MyPlugin['Instance']) { 10 plugin.context.resolveIrRef(schema.$ref!); 11} 12 13export const handler: MyPlugin['Handler'] = ({ plugin }) => { 14 plugin.forEach('schema', 'operation', (event) => { 15 console.log(event); 16 }); 17}; 18 19async function run() { 20 // const { client, server } = await createOpencode(); 21 // console.log(client, server); 22 const client = new PetStore(); 23 client.tui.publish({ 24 body: { 25 properties: { 26 message: 'Hello from Hey API OpenAPI TS Playground!', 27 variant: 'success', 28 }, 29 type: 'tui.toast.show', 30 }, 31 directory: 'main', 32 }); 33} 34 35run();