All files / src/openapi index.ts

0% Statements 0/6
0% Branches 0/2
100% Functions 0/0
0% Lines 0/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19                                     
import { default as app } from '../index';
import fs from 'node:fs';
 
try {
  const doc = app.getOpenAPI31Document({
    openapi: '3.1.0',
    info: {
      title: 'Echo API',
      version: '1.0.0',
      description: '受け取った入力値をそのまま応答するAPI',
    },
  });
  fs.writeFileSync('../frontend/openapi.json', JSON.stringify(doc, null, 2));
  console.info('OpenAPI document generated successfully');
} catch (error: unknown) {
  console.error('Failed to generate OpenAPI document');
  console.error(`Error Message: ${error instanceof Error ? error.message : JSON.stringify(error)}`);
}