This repository was archived by the owner on Aug 28, 2024. It is now read-only.
File tree 4 files changed +23
-31
lines changed
packages/openapi-parser/src
4 files changed +23
-31
lines changed Original file line number Diff line number Diff line change 1
- import type {
2
- AnyObject ,
3
- DereferenceResult ,
4
- DetailsResult ,
5
- Filesystem ,
6
- OpenAPI ,
7
- } from './types'
1
+ import type { AnyObject , DetailsResult , Filesystem } from './types'
8
2
import {
9
3
dereference ,
10
4
details ,
Original file line number Diff line number Diff line change 1
- import { ERRORS } from '../configuration'
1
+ import { ERRORS , OpenApiVersion } from '../configuration'
2
2
import type { OpenAPI } from './openapi-types'
3
3
4
4
export type {
@@ -32,7 +32,7 @@ export type FilterResult = {
32
32
}
33
33
34
34
export type DetailsResult = {
35
- version : string
35
+ version : OpenApiVersion
36
36
specificationType : string
37
37
specificationVersion : string
38
38
}
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ export function details(specification: AnyObject): DetailsResult {
11
11
12
12
if ( typeof value === 'string' && value . startsWith ( version ) ) {
13
13
return {
14
- version : version as OpenApiVersion ,
14
+ version : version ,
15
15
specificationType,
16
16
specificationVersion : value ,
17
17
}
Original file line number Diff line number Diff line change 1
1
import type { Queue } from '../pipeline'
2
- import type { DereferenceResult , Filesystem } from '../types'
3
- import { makeFilesystem } from './makeFilesystem'
2
+ import type {
3
+ DereferenceResult ,
4
+ Filesystem ,
5
+ FilterResult ,
6
+ LoadResult ,
7
+ UpgradeResult ,
8
+ ValidateResult ,
9
+ } from '../types'
10
+
11
+ type WorkThroughQueueResult = Partial <
12
+ LoadResult &
13
+ DereferenceResult &
14
+ ValidateResult &
15
+ UpgradeResult &
16
+ FilterResult & {
17
+ filesystem : Filesystem
18
+ }
19
+ >
4
20
5
21
/**
6
22
* Run through a queue of tasks
7
23
*/
8
24
export async function workThroughQueue ( queue : Queue ) : // TODO: Better type
9
- Promise <
10
- Partial <
11
- DereferenceResult & {
12
- filesystem : Filesystem
13
- }
14
- >
15
- > {
25
+ Promise < WorkThroughQueueResult > {
16
26
let specification = queue . specification
17
27
18
- // TODO: Be more specific
19
28
let result : any
20
29
21
30
// Run through all tasks in the queue
@@ -40,16 +49,5 @@ Promise<
40
49
}
41
50
}
42
51
43
- /**
44
- * TODO: This is a terrible hack. All functions should return the same format, but they don’t.
45
- * The dereference function returns a DereferenceResult, but others return a Filesystem.
46
- */
47
- // const isMoreThanJustTheSpecification = Object.keys(specification).includes(
48
- // 'specificationVersion',
49
- // )
50
-
51
52
return result
52
- // return isMoreThanJustTheSpecification
53
- // ? (specification as any)
54
- // : makeFilesystem(specification as Filesystem)
55
53
}
You can’t perform that action at this time.
0 commit comments