-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Maximum call stack size exceeded error when dereferencing large O…
…penAPI document
- Loading branch information
Showing
3 changed files
with
281,577 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* eslint-env jest */ | ||
import { resolve } from 'path' | ||
import { dereferenceOpenAPI } from '../../../src/v3.0' | ||
import retrieveFromFilesystem from '../../util/retrieveFromFilesystem' | ||
import openAPI from './openapi.json' | ||
|
||
describe('GitHub OpenAPI', () => { | ||
describe('dereferenceOpenAPI()', () => { | ||
describe('synchronous', () => { | ||
test('does not result in Maximum call stack size exceeded', () => { | ||
const output = dereferenceOpenAPI(openAPI as any, { | ||
baseURI: resolve(__dirname, 'openapi.json'), | ||
retrieve: retrieveFromFilesystem | ||
}) as any | ||
expect(output).toMatchObject({ openapi: '3.0.3' }) | ||
}) | ||
}) | ||
describe('asynchronous', () => { | ||
test('does not result in Maximum call stack size exceeded', async () => { | ||
const output = (await dereferenceOpenAPI(openAPI as any, { | ||
baseURI: resolve(__dirname, 'openapi.json'), | ||
retrieve: async (uri) => await retrieveFromFilesystem(uri) | ||
})) as any | ||
expect(output).toMatchObject({ openapi: '3.0.3' }) | ||
}) | ||
}) | ||
}) | ||
}) |
Oops, something went wrong.