-
Notifications
You must be signed in to change notification settings - Fork 124
Expand file tree
/
Copy pathtypes.ts
More file actions
82 lines (73 loc) · 1.81 KB
/
types.ts
File metadata and controls
82 lines (73 loc) · 1.81 KB
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
import { JSONSchema7 } from 'json-schema';
export interface IModels {
name: string;
description: string;
contentType: string;
schema: JSONSchema7;
examples: any[];
example: object;
}
export interface IDefinitionConfig {
title: string;
description: string;
version?: string;
models: IModels[];
}
export interface IDefinitionType {
file: string;
format: 'yaml' | 'json';
indent: number;
}
export interface IServerlessFunctionConfig {
_functionName: string;
handler: string;
description?: string;
environment?: object;
events?: any[];
}
// TODO: We could use another TS based OpenAPI project to get type information
// for OpenAPI definitions.
// @see https://github.com/Mermade/awesome-openapi3#parsersmodelsvalidators
// @see https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/3.0.0.md#operation-object
export interface IOperation {
tags?: string[];
summary?: string;
description?: string;
externalDocs?: any;
operationId?: string;
parameters?: IParameterConfig[];
requestBody?: any;
responses?: any;
callbacks?: any;
deprecated?: boolean;
security?: any[];
servers?: any[];
}
// @see https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/3.0.0.md#parameterObject
export interface IParameterConfig {
name: string;
in: 'path' | 'query' | 'header' | 'cookie';
description: string;
required?: boolean;
schema?: object;
deprecated?: boolean;
allowEmptyValue?: boolean;
style?: 'form' | 'simple';
explode?: boolean;
allowReserved?: boolean;
example?: any;
examples?: any[];
content?: Map<string, any>;
}
// FIXME:
export interface IDefinition {
openapi: string;
info: any;
servers?: any[];
paths: any;
components?: any;
security?: any[];
tags?: any[];
externalDocs: any;
}
export type ILog = (...str: string[]) => void;