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