Files
gitbook/packages/openapi-parser/src/v2.test.ts
T
Greg Bergé f1a6dec951 Less strict OpenAPI parser (#3529)
Co-authored-by: Nolann Biron <biron.nolann@gmail.com>
2025-08-05 08:45:45 +00:00

17 lines
628 B
TypeScript

import { describe, expect, it } from 'bun:test';
import { convertOpenAPIV2ToOpenAPIV3 } from './v2';
const specV2 = await Bun.file(new URL('./fixtures/spec-v2.json', import.meta.url)).text();
describe('#convertOpenAPIV2ToOpenAPIV3', () => {
it('converts an OpenAPIV2 in V3', async () => {
const result = await convertOpenAPIV2ToOpenAPIV3({
value: specV2,
rootURL: null,
});
// Ensure the structure returned is not recursive (not dereferenced).
JSON.stringify(result.filesystem);
expect(result.filesystem[0]?.specification.openapi).toBe('3.1.1');
});
});