mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-04-21 11:27:27 +08:00
docs: 引入 Fumadocs
ci: set up github actions
This commit is contained in:
23
docs/lib/media-adapter.ts
Normal file
23
docs/lib/media-adapter.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import type { MediaAdapter } from 'fumadocs-openapi';
|
||||
|
||||
export const OpenIsleMediaAdapter: MediaAdapter = {
|
||||
encode(data) {
|
||||
return JSON.stringify(data.body);
|
||||
},
|
||||
// returns code that inits a `body` variable, used for request body
|
||||
generateExample(data, ctx) {
|
||||
if (ctx.lang === 'js') {
|
||||
return `const body = "hello world"`;
|
||||
}
|
||||
|
||||
if (ctx.lang === 'python') {
|
||||
return `body = "hello world"`;
|
||||
}
|
||||
|
||||
if (ctx.lang === 'go' && 'addImport' in ctx) {
|
||||
ctx.addImport('strings');
|
||||
|
||||
return `body := strings.NewReader("hello world")`;
|
||||
}
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user