-
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.
Merge pull request #24 from criteria-labs/invalid-openapi-guards
Guard against invalid OpenAPI documents when dereferencing
- Loading branch information
Showing
2 changed files
with
98 additions
and
3 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
packages/criteria-openapi/src/specification/v3.1/visitOpenAPIObjects.test.ts
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,17 @@ | ||
import { visitOpenAPIObjects } from './visitOpenAPIObjects' | ||
|
||
describe('visitOpenAPIObjects()', () => { | ||
describe('with invalid OpenAPI document', () => { | ||
test('should not throw', () => { | ||
const openAPI = { | ||
openapi: '3.1.0', | ||
paths: { | ||
'/endpoint': null // not an object | ||
} | ||
} | ||
expect(() => { | ||
visitOpenAPIObjects(openAPI, 'openapi', {}, () => {}) | ||
}).not.toThrow() | ||
}) | ||
}) | ||
}) |
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