-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
81 changed files
with
2,070 additions
and
4,635 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
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,9 @@ | ||
import { TransformerContext } from './types'; | ||
import { maybeResolveLocalRef } from './utils'; | ||
|
||
export function createContext<T extends Record<string, unknown>>(document: T): TransformerContext<T> { | ||
return { | ||
document, | ||
maybeResolveLocalRef: maybeResolveLocalRef.bind(null, document), | ||
}; | ||
} |
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,15 @@ | ||
export function isNonNullable<T>(value: T): value is NonNullable<T> { | ||
return value !== undefined && value !== null; | ||
} | ||
|
||
export function isBoolean(input: unknown): input is boolean { | ||
return typeof input === 'boolean'; | ||
} | ||
|
||
export function isString(value: unknown): value is string { | ||
return typeof value === 'string'; | ||
} | ||
|
||
export function isSerializablePrimitive(value: unknown): value is string | number | boolean | null { | ||
return isBoolean(value) || isString(value) || typeof value === 'number' || value === null; | ||
} |
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,5 @@ | ||
export * from './oas'; | ||
export * from './oas2'; | ||
export * from './oas3'; | ||
export * from './postman'; | ||
export * from './types'; |
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
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 |
---|---|---|
@@ -1,24 +1,26 @@ | ||
import { OpenAPIObject } from 'openapi3-ts'; | ||
import { Spec } from 'swagger-schema-official'; | ||
// import { OpenAPIObject } from 'openapi3-ts'; | ||
// import { Spec } from 'swagger-schema-official'; | ||
// | ||
// import { transformOas2Operations } from '../../oas2/operation'; | ||
// import { transformOas3Operations } from '../../oas3/operation'; | ||
// | ||
// const oas2KitchenSinkJson: Spec = require('./__fixtures__/oas2-kitchen-sink.json'); | ||
// const oas3KitchenSinkJson: OpenAPIObject = require('./__fixtures__/oas3-kitchen-sink.json'); | ||
// | ||
// describe('oas operation', () => { | ||
// it('openapi v2', () => { | ||
// const result = transformOas2Operations(oas2KitchenSinkJson); | ||
// | ||
// expect(result).toHaveLength(5); | ||
// expect(result).toMatchSnapshot(); | ||
// }); | ||
// | ||
// it('openapi v3', () => { | ||
// const result = transformOas3Operations(oas3KitchenSinkJson); | ||
// | ||
// expect(result).toHaveLength(3); | ||
// expect(result).toMatchSnapshot(); | ||
// }); | ||
// }); | ||
|
||
import { transformOas2Operations } from '../../oas2/operation'; | ||
import { transformOas3Operations } from '../../oas3/operation'; | ||
|
||
const oas2KitchenSinkJson: Spec = require('./fixtures/oas2-kitchen-sink.json'); | ||
const oas3KitchenSinkJson: OpenAPIObject = require('./fixtures/oas3-kitchen-sink.json'); | ||
|
||
describe('oas operation', () => { | ||
it('openapi v2', () => { | ||
const result = transformOas2Operations(oas2KitchenSinkJson); | ||
|
||
expect(result).toHaveLength(5); | ||
expect(result).toMatchSnapshot(); | ||
}); | ||
|
||
it('openapi v3', () => { | ||
const result = transformOas3Operations(oas3KitchenSinkJson); | ||
|
||
expect(result).toHaveLength(3); | ||
expect(result).toMatchSnapshot(); | ||
}); | ||
}); | ||
test.todo('acx'); |
Oops, something went wrong.