UNPKG

9.52 kBTypeScriptView Raw
1import { ServerObject } from './oas-common';
2import { ISpecificationExtension } from './specification-extension';
3export * from './oas-common';
4export type { ISpecificationExtension, SpecificationExtension } from './specification-extension';
5export interface OpenAPIObject extends ISpecificationExtension {
6 openapi: string;
7 info: InfoObject;
8 servers?: ServerObject[];
9 paths?: PathsObject;
10 components?: ComponentsObject;
11 security?: SecurityRequirementObject[];
12 tags?: TagObject[];
13 externalDocs?: ExternalDocumentationObject;
14 webhooks?: PathsObject;
15}
16export interface InfoObject extends ISpecificationExtension {
17 title: string;
18 description?: string;
19 termsOfService?: string;
20 contact?: ContactObject;
21 license?: LicenseObject;
22 version: string;
23}
24export interface ContactObject extends ISpecificationExtension {
25 name?: string;
26 url?: string;
27 email?: string;
28}
29export interface LicenseObject extends ISpecificationExtension {
30 name: string;
31 identifier?: string;
32 url?: string;
33}
34export interface ComponentsObject extends ISpecificationExtension {
35 schemas?: {
36 [schema: string]: SchemaObject | ReferenceObject;
37 };
38 responses?: {
39 [response: string]: ResponseObject | ReferenceObject;
40 };
41 parameters?: {
42 [parameter: string]: ParameterObject | ReferenceObject;
43 };
44 examples?: {
45 [example: string]: ExampleObject | ReferenceObject;
46 };
47 requestBodies?: {
48 [request: string]: RequestBodyObject | ReferenceObject;
49 };
50 headers?: {
51 [header: string]: HeaderObject | ReferenceObject;
52 };
53 securitySchemes?: {
54 [securityScheme: string]: SecuritySchemeObject | ReferenceObject;
55 };
56 links?: {
57 [link: string]: LinkObject | ReferenceObject;
58 };
59 callbacks?: {
60 [callback: string]: CallbackObject | ReferenceObject;
61 };
62}
63export interface PathsObject extends ISpecificationExtension {
64 [path: string]: PathItemObject;
65}
66export type PathObject = PathsObject;
67export declare function getPath(pathsObject: PathsObject | undefined, path: string): PathItemObject | undefined;
68export interface PathItemObject extends ISpecificationExtension {
69 $ref?: string;
70 summary?: string;
71 description?: string;
72 get?: OperationObject;
73 put?: OperationObject;
74 post?: OperationObject;
75 delete?: OperationObject;
76 options?: OperationObject;
77 head?: OperationObject;
78 patch?: OperationObject;
79 trace?: OperationObject;
80 servers?: ServerObject[];
81 parameters?: (ParameterObject | ReferenceObject)[];
82}
83export interface OperationObject extends ISpecificationExtension {
84 tags?: string[];
85 summary?: string;
86 description?: string;
87 externalDocs?: ExternalDocumentationObject;
88 operationId?: string;
89 parameters?: (ParameterObject | ReferenceObject)[];
90 requestBody?: RequestBodyObject | ReferenceObject;
91 responses?: ResponsesObject;
92 callbacks?: CallbacksObject;
93 deprecated?: boolean;
94 security?: SecurityRequirementObject[];
95 servers?: ServerObject[];
96}
97export interface ExternalDocumentationObject extends ISpecificationExtension {
98 description?: string;
99 url: string;
100}
101export type ParameterLocation = 'query' | 'header' | 'path' | 'cookie';
102export type ParameterStyle = 'matrix' | 'label' | 'form' | 'simple' | 'spaceDelimited' | 'pipeDelimited' | 'deepObject';
103export interface BaseParameterObject extends ISpecificationExtension {
104 description?: string;
105 required?: boolean;
106 deprecated?: boolean;
107 allowEmptyValue?: boolean;
108 style?: ParameterStyle;
109 explode?: boolean;
110 allowReserved?: boolean;
111 schema?: SchemaObject | ReferenceObject;
112 examples?: {
113 [param: string]: ExampleObject | ReferenceObject;
114 };
115 example?: any;
116 content?: ContentObject;
117}
118export interface ParameterObject extends BaseParameterObject {
119 name: string;
120 in: ParameterLocation;
121}
122export interface RequestBodyObject extends ISpecificationExtension {
123 description?: string;
124 content: ContentObject;
125 required?: boolean;
126}
127export interface ContentObject {
128 [mediatype: string]: MediaTypeObject;
129}
130export interface MediaTypeObject extends ISpecificationExtension {
131 schema?: SchemaObject | ReferenceObject;
132 examples?: ExamplesObject;
133 example?: any;
134 encoding?: EncodingObject;
135}
136export interface EncodingObject extends ISpecificationExtension {
137 [property: string]: EncodingPropertyObject | any;
138}
139export interface EncodingPropertyObject {
140 contentType?: string;
141 headers?: {
142 [key: string]: HeaderObject | ReferenceObject;
143 };
144 style?: string;
145 explode?: boolean;
146 allowReserved?: boolean;
147 [key: string]: any;
148}
149export interface ResponsesObject extends ISpecificationExtension {
150 default?: ResponseObject | ReferenceObject;
151 [statuscode: string]: ResponseObject | ReferenceObject | any;
152}
153export interface ResponseObject extends ISpecificationExtension {
154 description: string;
155 headers?: HeadersObject;
156 content?: ContentObject;
157 links?: LinksObject;
158}
159export interface CallbacksObject extends ISpecificationExtension {
160 [name: string]: CallbackObject | ReferenceObject | any;
161}
162export interface CallbackObject extends ISpecificationExtension {
163 [name: string]: PathItemObject | any;
164}
165export interface HeadersObject {
166 [name: string]: HeaderObject | ReferenceObject;
167}
168export interface ExampleObject {
169 summary?: string;
170 description?: string;
171 value?: any;
172 externalValue?: string;
173 [property: string]: any;
174}
175export interface LinksObject {
176 [name: string]: LinkObject | ReferenceObject;
177}
178export interface LinkObject extends ISpecificationExtension {
179 operationRef?: string;
180 operationId?: string;
181 parameters?: LinkParametersObject;
182 requestBody?: any | string;
183 description?: string;
184 server?: ServerObject;
185 [property: string]: any;
186}
187export interface LinkParametersObject {
188 [name: string]: any | string;
189}
190export interface HeaderObject extends BaseParameterObject {
191 $ref?: string;
192}
193export interface TagObject extends ISpecificationExtension {
194 name: string;
195 description?: string;
196 externalDocs?: ExternalDocumentationObject;
197 [extension: string]: any;
198}
199export interface ExamplesObject {
200 [name: string]: ExampleObject | ReferenceObject;
201}
202export interface ReferenceObject {
203 $ref: string;
204 summary?: string;
205 description?: string;
206}
207export declare function isReferenceObject(obj: any): obj is ReferenceObject;
208export type SchemaObjectType = 'integer' | 'number' | 'string' | 'boolean' | 'object' | 'null' | 'array';
209export interface SchemaObject extends ISpecificationExtension {
210 discriminator?: DiscriminatorObject;
211 readOnly?: boolean;
212 writeOnly?: boolean;
213 xml?: XmlObject;
214 externalDocs?: ExternalDocumentationObject;
215 example?: any;
216 examples?: any[];
217 deprecated?: boolean;
218 type?: SchemaObjectType | SchemaObjectType[];
219 format?: 'int32' | 'int64' | 'float' | 'double' | 'byte' | 'binary' | 'date' | 'date-time' | 'password' | string;
220 allOf?: (SchemaObject | ReferenceObject)[];
221 oneOf?: (SchemaObject | ReferenceObject)[];
222 anyOf?: (SchemaObject | ReferenceObject)[];
223 not?: SchemaObject | ReferenceObject;
224 items?: SchemaObject | ReferenceObject;
225 properties?: {
226 [propertyName: string]: SchemaObject | ReferenceObject;
227 };
228 additionalProperties?: SchemaObject | ReferenceObject | boolean;
229 propertyNames?: SchemaObject | ReferenceObject;
230 description?: string;
231 default?: any;
232 title?: string;
233 multipleOf?: number;
234 maximum?: number;
235 const?: any;
236 exclusiveMaximum?: number;
237 minimum?: number;
238 exclusiveMinimum?: number;
239 maxLength?: number;
240 minLength?: number;
241 pattern?: string;
242 maxItems?: number;
243 minItems?: number;
244 uniqueItems?: boolean;
245 maxProperties?: number;
246 minProperties?: number;
247 required?: string[];
248 enum?: any[];
249 prefixItems?: (SchemaObject | ReferenceObject)[];
250 contentMediaType?: string;
251 contentEncoding?: string;
252}
253export declare function isSchemaObject(schema: SchemaObject | ReferenceObject): schema is SchemaObject;
254export interface SchemasObject {
255 [schema: string]: SchemaObject;
256}
257export interface DiscriminatorObject {
258 propertyName: string;
259 mapping?: {
260 [key: string]: string;
261 };
262}
263export interface XmlObject extends ISpecificationExtension {
264 name?: string;
265 namespace?: string;
266 prefix?: string;
267 attribute?: boolean;
268 wrapped?: boolean;
269}
270export type SecuritySchemeType = 'apiKey' | 'http' | 'oauth2' | 'openIdConnect';
271export interface SecuritySchemeObject extends ISpecificationExtension {
272 type: SecuritySchemeType;
273 description?: string;
274 name?: string;
275 in?: string;
276 scheme?: string;
277 bearerFormat?: string;
278 flows?: OAuthFlowsObject;
279 openIdConnectUrl?: string;
280}
281export interface OAuthFlowsObject extends ISpecificationExtension {
282 implicit?: OAuthFlowObject;
283 password?: OAuthFlowObject;
284 clientCredentials?: OAuthFlowObject;
285 authorizationCode?: OAuthFlowObject;
286}
287export interface OAuthFlowObject extends ISpecificationExtension {
288 authorizationUrl?: string;
289 tokenUrl?: string;
290 refreshUrl?: string;
291 scopes: ScopesObject;
292}
293export interface ScopesObject extends ISpecificationExtension {
294 [scope: string]: any;
295}
296export interface SecurityRequirementObject {
297 [name: string]: string[];
298}