-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.ts
More file actions
121 lines (110 loc) · 3.04 KB
/
types.ts
File metadata and controls
121 lines (110 loc) · 3.04 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
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
import type {SwaggerUiOptions} from 'swagger-ui-express';
import type {AppRouteDescription, AuthPolicy} from '@gravity-ui/expresskit';
// OpenAPI Security Scheme Object types
export interface SecuritySchemeObject {
type: 'apiKey' | 'http' | 'oauth2' | 'openIdConnect';
description?: string;
// apiKey
in?: 'query' | 'header' | 'cookie';
name?: string;
// http
scheme?: string;
bearerFormat?: string;
// oauth2
flows?: {
implicit?: {
authorizationUrl: string;
refreshUrl?: string;
scopes: Record<string, string>;
};
password?: {
tokenUrl: string;
refreshUrl?: string;
scopes: Record<string, string>;
};
clientCredentials?: {
tokenUrl: string;
refreshUrl?: string;
scopes: Record<string, string>;
};
authorizationCode?: {
authorizationUrl: string;
tokenUrl: string;
refreshUrl?: string;
scopes: Record<string, string>;
};
};
// openIdConnect
openIdConnectUrl?: string;
}
export interface OpenApiRegistryConfig {
enabled?: boolean;
path?: string;
version?: string;
title?: string;
description?: string;
contact?: {
name?: string;
email?: string;
url?: string;
};
license?: {
name?: string;
url?: string;
};
servers?: {
url: string;
description?: string;
}[];
swaggerUi?: SwaggerUiOptions;
swaggerJsonPath?: string;
authPolicy?: AuthPolicy;
securitySchemes?: Record<string, SecuritySchemeObject>;
transformOperation?: (
operation: OpenApiOperation,
context: {
method: HttpMethod;
path: string;
route: AppRouteDescription;
},
) => OpenApiOperation;
}
export type OpenApiSecurityRequirement = Record<string, string[]>;
export interface OpenApiOperation {
tags?: string[];
summary?: string;
description?: string;
operationId?: string;
parameters?: Record<string, unknown>[];
requestBody?: Record<string, unknown>;
responses?: Record<string, unknown>;
security?: OpenApiSecurityRequirement[];
[key: string]: unknown;
}
export interface OpenApiSchemaObject {
openapi: string;
info: {
title: string;
version: string;
description?: string;
[key: string]: unknown;
};
servers?: Array<{url: string; [key: string]: unknown}>;
paths: Record<string, Record<string, unknown>>;
components?: {
schemas?: Record<string, unknown>;
securitySchemes?: Record<string, SecuritySchemeObject>;
[key: string]: unknown;
};
[key: string]: unknown;
}
export type HttpMethod = 'get' | 'post' | 'put' | 'patch' | 'delete' | 'head' | 'options';
declare module '@gravity-ui/expresskit' {
interface RouteContract {
name?: string;
operationId?: string;
summary?: string;
description?: string;
tags?: string[];
}
}