feat(swagger): Add Swagger API reference, and fixes #28

Merged
Gandalf merged 28 commits from develop into main 2026-05-21 20:14:36 +01:00
Showing only changes of commit db9b3e7a30 - Show all commits
+17 -7
View File
@@ -9,22 +9,32 @@
* - Required security schemes are referenced
*/
const { describe, it, expect } = require('vitest');
const request = require('supertest');
const { createApp } = require('../../server/app');
const YAML = require('yamljs');
const fs = require('fs');
const path = require('path');
import { describe, it, expect, beforeAll } from 'vitest';
import request from 'supertest';
import { createApp } from '../../server/app.js';
import fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
// Load YAML using dynamic import for yamljs which is CommonJS
async function loadYAML() {
const YAML = await import('yamljs');
return YAML;
}
describe('Swagger Coverage', () => {
let app;
let openapiSpec;
let swaggerSpec;
beforeAll(() => {
beforeAll(async () => {
// Load the base OpenAPI spec from YAML
const yamlPath = path.join(__dirname, '../../server/openapi.yaml');
const yamlContent = fs.readFileSync(yamlPath, 'utf8');
const YAML = await loadYAML();
openapiSpec = YAML.parse(yamlContent);
// Create app and get the merged swagger spec