UNPKG

9.3 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}
15export interface InfoObject extends ISpecificationExtension {
16 title: string;
17 description?: string;
18 termsOfService?: string;
19 contact?: ContactObject;
20 license?: LicenseObject;
21 version: string;
22}
23export interface ContactObject extends ISpecificationExtension {
24 name?: string;
25 url?: string;
26 email?: string;
27}
28export interface LicenseObject extends ISpecificationExtension {
29 name: string;
30 url?: string;
31}
32export 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}
61export interface PathsObject extends ISpecificationExtension {
62 [path: string]: PathItemObject;
63}
64export type PathObject = PathsObject;
65export declare function getPath(pathsObject: PathsObject, path: string): PathItemObject | undefined;
66export 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}
81export 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}
95export interface ExternalDocumentationObject extends ISpecificationExtension {
96 description?: string;
97 url: string;
98}
99export type ParameterLocation = 'query' | 'header' | 'path' | 'cookie';
100export type ParameterStyle = 'matrix' | 'label' | 'form' | 'simple' | 'spaceDelimited' | 'pipeDelimited' | 'deepObject';
101export 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}
116export interface ParameterObject extends BaseParameterObject {
117 name: string;
118 in: ParameterLocation;
119}
120export interface RequestBodyObject extends ISpecificationExtension {
121 description?: string;
122 content: ContentObject;
123 required?: boolean;
124}
125export interface ContentObject {
126 [mediatype: string]: MediaTypeObject;
127}
128export interface MediaTypeObject extends ISpecificationExtension {
129 schema?: SchemaObject | ReferenceObject;
130 examples?: ExamplesObject;
131 example?: any;
132 encoding?: EncodingObject;
133}
134export interface EncodingObject extends ISpecificationExtension {
135 [property: string]: EncodingPropertyObject | any;
136}
137export 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}
147export interface ResponsesObject extends ISpecificationExtension {
148 default?: ResponseObject | ReferenceObject;
149 [statuscode: string]: ResponseObject | ReferenceObject | any;
150}
151export interface ResponseObject extends ISpecificationExtension {
152 description: string;
153 headers?: HeadersObject;
154 content?: ContentObject;
155 links?: LinksObject;
156}
157export interface CallbacksObject extends ISpecificationExtension {
158 [name: string]: CallbackObject | ReferenceObject | any;
159}
160export interface CallbackObject extends ISpecificationExtension {
161 [name: string]: PathItemObject | any;
162}
163export interface HeadersObject {
164 [name: string]: HeaderObject | ReferenceObject;
165}
166export interface ExampleObject {
167 summary?: string;
168 description?: string;
169 value?: any;
170 externalValue?: string;
171 [property: string]: any;
172}
173export interface LinksObject {
174 [name: string]: LinkObject | ReferenceObject;
175}
176export 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}
185export interface LinkParametersObject {
186 [name: string]: any | string;
187}
188export interface HeaderObject extends BaseParameterObject {
189 $ref?: string;
190}
191export interface TagObject extends ISpecificationExtension {
192 name: string;
193 description?: string;
194 externalDocs?: ExternalDocumentationObject;
195 [extension: string]: any;
196}
197export interface ExamplesObject {
198 [name: string]: ExampleObject | ReferenceObject;
199}
200export interface ReferenceObject {
201 $ref: string;
202}
203export declare function isReferenceObject(obj: any): obj is ReferenceObject;
204export type SchemaObjectType = 'integer' | 'number' | 'string' | 'boolean' | 'object' | 'null' | 'array';
205export type SchemaObjectFormat = 'int32' | 'int64' | 'float' | 'double' | 'byte' | 'binary' | 'date' | 'date-time' | 'password' | string;
206export 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}
246export declare function isSchemaObject(schema: SchemaObject | ReferenceObject): schema is SchemaObject;
247export interface SchemasObject {
248 [schema: string]: SchemaObject;
249}
250export interface DiscriminatorObject {
251 propertyName: string;
252 mapping?: {
253 [key: string]: string;
254 };
255}
256export interface XmlObject extends ISpecificationExtension {
257 name?: string;
258 namespace?: string;
259 prefix?: string;
260 attribute?: boolean;
261 wrapped?: boolean;
262}
263export type SecuritySchemeType = 'apiKey' | 'http' | 'oauth2' | 'openIdConnect';
264export 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}
274export interface OAuthFlowsObject extends ISpecificationExtension {
275 implicit?: OAuthFlowObject;
276 password?: OAuthFlowObject;
277 clientCredentials?: OAuthFlowObject;
278 authorizationCode?: OAuthFlowObject;
279}
280export interface OAuthFlowObject extends ISpecificationExtension {
281 authorizationUrl?: string;
282 tokenUrl?: string;
283 refreshUrl?: string;
284 scopes: ScopesObject;
285}
286export interface ScopesObject extends ISpecificationExtension {
287 [scope: string]: any;
288}
289export interface SecurityRequirementObject {
290 [name: string]: string[];
291}