forked from ghermeto/sway
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
123 lines (106 loc) · 3.01 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
export declare function create(options : Options) : Promise<SwaggerApi>
declare type Options = {
defintion: Object | string,
jsonRefs?: Object,
customValidatiors?: ValidatorCallback[]
}
declare type ValidatorCallback = (api : SwaggerApi) => ValidationResults
declare class SwaggerApi{
customValidators: ValidatorCallback[]
definition: Object
definitionRemotesResolved: Object
definitionFullyResolved: Object
documentationUrl: string
pathObjects: Path[]
options: Object
references: Object
version: string
getOperation(pathOrRequest : string | Request, method ?: string): Operation
getOperations(path ?: string): Operation[]
getOperationsByTag(tag ?: string): Operation[]
getPath(pathOrRequest : string | Request): Path
getPaths(): Path[]
registerValidator(validator: ValidatorCallback): void
validate(): ValidationResults
}
//TODO confirm this is all any of them use
declare interface Request {
[index: string]: any
url: string
}
declare class Operation{
definition: Object
definitionFullyResolved: Object
method: string
pathObject: Path
pathToDefinition: string[]
parameterObjects: Parameter[]
ptr: string
securityDefinitions: Object
getParameter(name : string, location ?: string) : Parameter
getParameters() : Parameter[]
getResponse(statusCode ?: number | string) : Response
getResponses() : Response[]
getSecurity() : Object//Security
validateRequest(request : Request) : ValidationResults
validateResponse(response : Response) : ValidationResults
}
declare type ValidationResults = {
errors: ValidationEntry[],
warnings: ValidationEntry[]
}
declare type ValidationEntry = {
code: string
error: string
errors: ValidationEntry[] //for nested errors
lineage: string[]
message: string
name: string
params: Object[]
path: string[]
schemaId: string
}
declare class Response{
definition: Object
definitionFullyResolved: Object
operationObject: Operation
pathToDefinition: string[]
ptr: string
statusCode: string
getExample(mimeType: string): string
getSample(): Object
validateResponse(response: Response): ValidationResults
}
declare class Parameter{
definition: Object
definitionFullyResolved: Object
operationObject: Operation
pathObject: Path
pathToDefinition: string[]
ptr: string
schema: Object
getSample() : Object
getValue(request : Request): ParameterValue
}
declare class Path{
api: SwaggerApi
definition: Object
definitionFullyResolved: Object
operationObjects: Operation[]
parameterObjects: Parameter[]
path: string
pathToDefinition: string[]
ptr: string
regexp: RegExp
getOperation(method : string): Operation[]
getOperations(): Operation[]
getOperationsByTag(tag): Operation[]
getParameters(): Parameter[]
}
declare class ParameterValue{
error: Error
parameterObject: Parameter
raw: Object
valid: boolean
value: Object
}