generated from toomuchdesign/npm-package-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add failing test case for openAPI propr not convertible to JSON…
… schema
- Loading branch information
1 parent
a8b4e24
commit 9c61a36
Showing
2 changed files
with
47 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
openapi: 3.0.0 | ||
info: | ||
title: Minimal OpenAPI specification to reproduce an issue | ||
version: 1.0.0 | ||
components: | ||
securitySchemes: | ||
bearerAuth: | ||
type: http | ||
scheme: bearer | ||
|
||
schemas: | ||
HelloWorld: | ||
type: object | ||
properties: | ||
message: | ||
type: string | ||
required: | ||
- message | ||
paths: | ||
'/hello': | ||
get: | ||
security: | ||
- bearerAuth: [] | ||
responses: | ||
'200': | ||
description: OK | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/HelloWorld' |
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 path from 'path'; | ||
import { describe, it, expect } from 'vitest'; | ||
import { fixtures, makeTestOutputPath } from './test-utils'; | ||
import { openapiToTsJsonSchema } from '../src'; | ||
|
||
describe('OpenApi security fields', () => { | ||
it('handles schema correctly', async () => { | ||
await expect( | ||
openapiToTsJsonSchema({ | ||
openApiSchema: path.resolve(fixtures, 'security-fields/specs.yaml'), | ||
outputPath: makeTestOutputPath('security-fields'), | ||
definitionPathsToGenerateFrom: ['components.schemas', 'paths'], | ||
silent: true, | ||
}), | ||
).resolves.not.toThrow(); | ||
Check failure on line 15 in test/securityFields.test.ts GitHub Actions / test-and-build (20, ubuntu-latest)test/securityFields.test.ts > OpenApi security fields > handles schema correctly
Check failure on line 15 in test/securityFields.test.ts GitHub Actions / test-and-build (20, macOS-latest)test/securityFields.test.ts > OpenApi security fields > handles schema correctly
|
||
}); | ||
}); |