@scalar/openapi-types 0.0.1 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,957 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-namespace */
2
- /* eslint-disable @typescript-eslint/ban-types */
3
- /**
4
- * TODO these are the "old" types from the parser, will get @hans to update this to the new types when he is back
5
- *
6
- * These types are copied from openapi-types, with two modifications:
7
- *
8
- * - all attributes are optional, you can’t rely on the specification for user input
9
- * - extensions (basically any attributes, not only prefixed with an `x-`) are allowed
10
- *
11
- * We deal with user input and can’t assume they really stick to any official specification.
12
- */
13
-
14
- /** any other attribute, for example x-* extensions */
15
- type AnyOtherAttribute = {
16
- /** OpenAPI extension */
17
- [customExtension: `x-${string}`]: any
18
- /** Unknown attribute */
19
- [key: string]: any
20
- }
21
-
22
- export namespace OpenAPI {
23
- // OpenAPI extensions can be declared using generics
24
- // e.g.:
25
- // OpenAPI.Document<{
26
- // 'x-foobar': Foobar
27
- // }>
28
- export type Document<T extends AnyOtherAttribute = {}> =
29
- | OpenAPIV2.Document<T>
30
- | OpenAPIV3.Document<T>
31
- | OpenAPIV3_1.Document<T>
32
-
33
- export type Operation<T = {}> =
34
- | OpenAPIV2.OperationObject<T>
35
- | OpenAPIV3.OperationObject<T>
36
- | OpenAPIV3_1.OperationObject<T>
37
-
38
- export type Request = {
39
- body?: any
40
- headers?: object
41
- params?: object
42
- query?: object
43
- }
44
-
45
- export type ResponseObject =
46
- | OpenAPIV2.ResponseObject
47
- | OpenAPIV3.ResponseObject
48
- | OpenAPIV3_1.ResponseObject
49
-
50
- export type Parameter =
51
- | OpenAPIV3_1.ReferenceObject
52
- | OpenAPIV3_1.ParameterObject
53
- | OpenAPIV3.ReferenceObject
54
- | OpenAPIV3.ParameterObject
55
- | OpenAPIV2.ReferenceObject
56
- | OpenAPIV2.Parameter
57
-
58
- export type Parameters =
59
- | (OpenAPIV3_1.ReferenceObject | OpenAPIV3_1.ParameterObject)[]
60
- | (OpenAPIV3.ReferenceObject | OpenAPIV3.ParameterObject)[]
61
- | (OpenAPIV2.ReferenceObject | OpenAPIV2.Parameter)[]
62
-
63
- export type ExampleObject =
64
- | OpenAPIV2.ExampleObject
65
- | OpenAPIV3.ExampleObject
66
- | OpenAPIV3_1.ExampleObject
67
-
68
- export type SchemaObject =
69
- | OpenAPIV2.SchemaObject
70
- | OpenAPIV3.SchemaObject
71
- | OpenAPIV3_1.SchemaObject
72
- }
73
-
74
- export namespace OpenAPIV3_1 {
75
- type Modify<T, R> = Omit<T, keyof R> & R
76
-
77
- type PathsWebhooksComponents<T = {}> = {
78
- paths?: PathsObject<T>
79
- webhooks?: Record<string, PathItemObject | ReferenceObject>
80
- components?: ComponentsObject
81
- }
82
-
83
- export type Document<T = {}> = Modify<
84
- Omit<OpenAPIV3.Document<T>, 'paths' | 'components'>,
85
- {
86
- /**
87
- * Version of the OpenAPI specification
88
- * @see https://github.com/OAI/OpenAPI-Specification/tree/main/versions
89
- */
90
- openapi?: '3.1.0'
91
- info?: InfoObject
92
- jsonSchemaDialect?: string
93
- servers?: ServerObject[]
94
- } & (
95
- | (Pick<PathsWebhooksComponents<T>, 'paths'> &
96
- Omit<Partial<PathsWebhooksComponents<T>>, 'paths'>)
97
- | (Pick<PathsWebhooksComponents<T>, 'webhooks'> &
98
- Omit<Partial<PathsWebhooksComponents<T>>, 'webhooks'>)
99
- | (Pick<PathsWebhooksComponents<T>, 'components'> &
100
- Omit<Partial<PathsWebhooksComponents<T>>, 'components'>)
101
- ) &
102
- T &
103
- AnyOtherAttribute
104
- >
105
-
106
- export type InfoObject = Modify<
107
- OpenAPIV3.InfoObject,
108
- {
109
- summary?: string
110
- license?: LicenseObject
111
- }
112
- >
113
-
114
- export type ContactObject = OpenAPIV3.ContactObject
115
-
116
- export type LicenseObject = Modify<
117
- OpenAPIV3.LicenseObject,
118
- {
119
- identifier?: string
120
- }
121
- >
122
-
123
- export type ServerObject = Modify<
124
- OpenAPIV3.ServerObject,
125
- {
126
- url?: string
127
- description?: string
128
- variables?: Record<string, ServerVariableObject>
129
- }
130
- >
131
-
132
- export type ServerVariableObject = Modify<
133
- OpenAPIV3.ServerVariableObject,
134
- {
135
- enum?: [string, ...string[]]
136
- }
137
- >
138
-
139
- export type PathsObject<T = {}, P extends {} = {}> = Record<
140
- string,
141
- (PathItemObject<T> & P) | undefined
142
- >
143
-
144
- export type HttpMethods = OpenAPIV3.HttpMethods
145
-
146
- export type PathItemObject<T = {}> = Modify<
147
- OpenAPIV3.PathItemObject<T>,
148
- {
149
- servers?: ServerObject[]
150
- parameters?: (ReferenceObject | ParameterObject)[]
151
- }
152
- > & {
153
- [method in HttpMethods]?: OperationObject<T>
154
- }
155
-
156
- export type OperationObject<T = {}> = Modify<
157
- OpenAPIV3.OperationObject<T>,
158
- {
159
- parameters?: (ReferenceObject | ParameterObject)[]
160
- requestBody?: ReferenceObject | RequestBodyObject
161
- responses?: ResponsesObject
162
- callbacks?: Record<string, ReferenceObject | CallbackObject>
163
- servers?: ServerObject[]
164
- }
165
- > &
166
- T
167
-
168
- export type ExternalDocumentationObject =
169
- OpenAPIV3.ExternalDocumentationObject
170
-
171
- export type ParameterObject = OpenAPIV3.ParameterObject
172
-
173
- export type HeaderObject = OpenAPIV3.HeaderObject
174
-
175
- export type ParameterBaseObject = OpenAPIV3.ParameterBaseObject
176
-
177
- export type NonArraySchemaObjectType =
178
- | OpenAPIV3.NonArraySchemaObjectType
179
- | 'null'
180
-
181
- export type ArraySchemaObjectType = OpenAPIV3.ArraySchemaObjectType
182
-
183
- /**
184
- * There is no way to tell typescript to require items when type is either 'array' or array containing 'array' type
185
- * 'items' will be always visible as optional
186
- * Casting schema object to ArraySchemaObject or NonArraySchemaObject will work fine
187
- */
188
- export type SchemaObject = (
189
- | ArraySchemaObject
190
- | NonArraySchemaObject
191
- | MixedSchemaObject
192
- | boolean
193
- ) &
194
- AnyOtherAttribute
195
-
196
- export type ArraySchemaObject = {
197
- type?: ArraySchemaObjectType
198
- items?: ReferenceObject | SchemaObject
199
- } & BaseSchemaObject
200
-
201
- export type NonArraySchemaObject = {
202
- type?: NonArraySchemaObjectType
203
- } & BaseSchemaObject
204
-
205
- type MixedSchemaObject = {
206
- type?: (ArraySchemaObjectType | NonArraySchemaObjectType)[]
207
- items?: ReferenceObject | SchemaObject
208
- } & BaseSchemaObject
209
-
210
- export type BaseSchemaObject = Modify<
211
- Omit<OpenAPIV3.BaseSchemaObject, 'nullable'>,
212
- {
213
- examples?: OpenAPIV3.BaseSchemaObject['example'][]
214
- exclusiveMinimum?: boolean | number
215
- exclusiveMaximum?: boolean | number
216
- contentMediaType?: string
217
- $schema?: string
218
- additionalProperties?: boolean | ReferenceObject | SchemaObject
219
- properties?: {
220
- [name: string]: ReferenceObject | SchemaObject
221
- }
222
- allOf?: (ReferenceObject | SchemaObject)[]
223
- oneOf?: (ReferenceObject | SchemaObject)[]
224
- anyOf?: (ReferenceObject | SchemaObject)[]
225
- not?: ReferenceObject | SchemaObject
226
- discriminator?: DiscriminatorObject
227
- externalDocs?: ExternalDocumentationObject
228
- xml?: XMLObject
229
- const?: any
230
- }
231
- >
232
-
233
- export type DiscriminatorObject = OpenAPIV3.DiscriminatorObject
234
-
235
- export type XMLObject = OpenAPIV3.XMLObject
236
-
237
- export type ReferenceObject = Modify<
238
- OpenAPIV3.ReferenceObject,
239
- {
240
- summary?: string
241
- description?: string
242
- }
243
- >
244
-
245
- export type ExampleObject = OpenAPIV3.ExampleObject
246
-
247
- export type MediaTypeObject = Modify<
248
- OpenAPIV3.MediaTypeObject,
249
- {
250
- schema?: SchemaObject | ReferenceObject
251
- examples?: Record<string, ReferenceObject | ExampleObject>
252
- }
253
- >
254
-
255
- export type EncodingObject = OpenAPIV3.EncodingObject
256
-
257
- export type RequestBodyObject = Modify<
258
- OpenAPIV3.RequestBodyObject,
259
- {
260
- content?: { [media: string]: MediaTypeObject }
261
- }
262
- >
263
-
264
- export type ResponsesObject = Record<string, ReferenceObject | ResponseObject>
265
-
266
- export type ResponseObject = Modify<
267
- OpenAPIV3.ResponseObject,
268
- {
269
- headers?: { [header: string]: ReferenceObject | HeaderObject }
270
- content?: { [media: string]: MediaTypeObject }
271
- links?: { [link: string]: ReferenceObject | LinkObject }
272
- }
273
- >
274
-
275
- export type LinkObject = Modify<
276
- OpenAPIV3.LinkObject,
277
- {
278
- server?: ServerObject
279
- }
280
- >
281
-
282
- export type CallbackObject = Record<string, PathItemObject | ReferenceObject>
283
-
284
- export type SecurityRequirementObject = OpenAPIV3.SecurityRequirementObject
285
-
286
- export type ComponentsObject = Modify<
287
- OpenAPIV3.ComponentsObject,
288
- {
289
- schemas?: Record<string, SchemaObject>
290
- responses?: Record<string, ReferenceObject | ResponseObject>
291
- parameters?: Record<string, ReferenceObject | ParameterObject>
292
- examples?: Record<string, ReferenceObject | ExampleObject>
293
- requestBodies?: Record<string, ReferenceObject | RequestBodyObject>
294
- headers?: Record<string, ReferenceObject | HeaderObject>
295
- securitySchemes?: Record<string, ReferenceObject | SecuritySchemeObject>
296
- links?: Record<string, ReferenceObject | LinkObject>
297
- callbacks?: Record<string, ReferenceObject | CallbackObject>
298
- pathItems?: Record<string, ReferenceObject | PathItemObject>
299
- }
300
- >
301
-
302
- export type SecuritySchemeObject = OpenAPIV3.SecuritySchemeObject
303
-
304
- export type HttpSecurityScheme = OpenAPIV3.HttpSecurityScheme
305
-
306
- export type ApiKeySecurityScheme = OpenAPIV3.ApiKeySecurityScheme
307
-
308
- export type OAuth2SecurityScheme = OpenAPIV3.OAuth2SecurityScheme
309
-
310
- export type OpenIdSecurityScheme = OpenAPIV3.OpenIdSecurityScheme
311
-
312
- export type TagObject = OpenAPIV3.TagObject
313
- }
314
-
315
- export namespace OpenAPIV3 {
316
- export type Document<T = {}> = {
317
- /**
318
- * Version of the OpenAPI specification
319
- * @see https://github.com/OAI/OpenAPI-Specification/tree/main/versions
320
- */
321
- openapi?: '3.0.0' | '3.0.1' | '3.0.2' | '3.0.2'
322
- info?: InfoObject
323
- servers?: ServerObject[]
324
- paths?: PathsObject<T>
325
- components?: ComponentsObject
326
- security?: SecurityRequirementObject[]
327
- tags?: TagObject[]
328
- externalDocs?: ExternalDocumentationObject
329
- } & T &
330
- AnyOtherAttribute
331
-
332
- export type InfoObject = {
333
- title?: string
334
- description?: string
335
- termsOfService?: string
336
- contact?: ContactObject
337
- license?: LicenseObject
338
- version?: string
339
- }
340
-
341
- export type ContactObject = {
342
- name?: string
343
- url?: string
344
- email?: string
345
- }
346
-
347
- export type LicenseObject = {
348
- name?: string
349
- url?: string
350
- }
351
-
352
- export type ServerObject = {
353
- url?: string
354
- description?: string
355
- variables?: { [variable: string]: ServerVariableObject }
356
- }
357
-
358
- export type ServerVariableObject = {
359
- enum?: string[] | number[]
360
- default?: string | number
361
- description?: string
362
- }
363
-
364
- export type PathsObject<T = {}, P extends {} = {}> = {
365
- [pattern: string]: (PathItemObject<T> & P) | undefined
366
- }
367
-
368
- // All HTTP methods allowed by OpenAPI 3 spec
369
- // See https://swagger.io/specification/#path-item-object
370
- // You can use keys or values from it in TypeScript code like this:
371
- // for (const method of Object.values(OpenAPIV3.HttpMethods)) { … }
372
- export enum HttpMethods {
373
- GET = 'get',
374
- PUT = 'put',
375
- POST = 'post',
376
- DELETE = 'delete',
377
- OPTIONS = 'options',
378
- HEAD = 'head',
379
- PATCH = 'patch',
380
- TRACE = 'trace',
381
- }
382
-
383
- export type PathItemObject<T = {}> = {
384
- $ref?: string
385
- summary?: string
386
- description?: string
387
- servers?: ServerObject[]
388
- parameters?: (ReferenceObject | ParameterObject)[]
389
- } & {
390
- [method in HttpMethods]?: OperationObject<T>
391
- } & T &
392
- AnyOtherAttribute
393
-
394
- export type OperationObject<T = {}> = {
395
- tags?: string[]
396
- summary?: string
397
- description?: string
398
- externalDocs?: ExternalDocumentationObject
399
- operationId?: string
400
- parameters?: (ReferenceObject | ParameterObject)[]
401
- requestBody?: ReferenceObject | RequestBodyObject
402
- responses?: ResponsesObject
403
- callbacks?: { [callback: string]: ReferenceObject | CallbackObject }
404
- deprecated?: boolean
405
- security?: SecurityRequirementObject[]
406
- servers?: ServerObject[]
407
- } & T &
408
- AnyOtherAttribute
409
-
410
- export type ExternalDocumentationObject = {
411
- description?: string
412
- url?: string
413
- }
414
-
415
- export type ParameterObject = {
416
- name?: string
417
- in?: string
418
- } & ParameterBaseObject
419
-
420
- export type HeaderObject = {} & ParameterBaseObject
421
-
422
- export type ParameterBaseObject = {
423
- description?: string
424
- required?: boolean
425
- deprecated?: boolean
426
- allowEmptyValue?: boolean
427
- style?: string
428
- explode?: boolean
429
- allowReserved?: boolean
430
- schema?: ReferenceObject | SchemaObject
431
- example?: any
432
- examples?: { [media: string]: ReferenceObject | ExampleObject }
433
- content?: { [media: string]: MediaTypeObject }
434
- }
435
- export type NonArraySchemaObjectType =
436
- | 'boolean'
437
- | 'object'
438
- | 'number'
439
- | 'string'
440
- | 'integer'
441
- export type ArraySchemaObjectType = 'array'
442
- export type SchemaObject = (ArraySchemaObject | NonArraySchemaObject) &
443
- AnyOtherAttribute
444
-
445
- export type ArraySchemaObject = {
446
- type?: ArraySchemaObjectType
447
- items?: ReferenceObject | SchemaObject
448
- } & BaseSchemaObject
449
-
450
- export type NonArraySchemaObject = {
451
- type?: NonArraySchemaObjectType
452
- } & BaseSchemaObject
453
-
454
- export type BaseSchemaObject = {
455
- // JSON schema allowed properties, adjusted for OpenAPI
456
- title?: string
457
- description?: string
458
- format?: string
459
- default?: any
460
- multipleOf?: number
461
- maximum?: number
462
- exclusiveMaximum?: boolean
463
- minimum?: number
464
- exclusiveMinimum?: boolean
465
- maxLength?: number
466
- minLength?: number
467
- pattern?: string
468
- additionalProperties?: boolean | ReferenceObject | SchemaObject
469
- maxItems?: number
470
- minItems?: number
471
- uniqueItems?: boolean
472
- maxProperties?: number
473
- minProperties?: number
474
- required?: string[]
475
- enum?: any[]
476
- properties?: {
477
- [name: string]: ReferenceObject | SchemaObject
478
- }
479
- allOf?: (ReferenceObject | SchemaObject)[]
480
- oneOf?: (ReferenceObject | SchemaObject)[]
481
- anyOf?: (ReferenceObject | SchemaObject)[]
482
- not?: ReferenceObject | SchemaObject
483
-
484
- // OpenAPI-specific properties
485
- nullable?: boolean
486
- discriminator?: DiscriminatorObject
487
- readOnly?: boolean
488
- writeOnly?: boolean
489
- xml?: XMLObject
490
- externalDocs?: ExternalDocumentationObject
491
- example?: any
492
- deprecated?: boolean
493
- }
494
-
495
- export type DiscriminatorObject = {
496
- propertyName?: string
497
- mapping?: { [value: string]: string }
498
- }
499
-
500
- export type XMLObject = {
501
- name?: string
502
- namespace?: string
503
- prefix?: string
504
- attribute?: boolean
505
- wrapped?: boolean
506
- }
507
-
508
- export type ReferenceObject = {
509
- $ref?: string
510
- } & AnyOtherAttribute
511
-
512
- export type ExampleObject = {
513
- summary?: string
514
- description?: string
515
- value?: any
516
- externalValue?: string
517
- }
518
-
519
- export type MediaTypeObject = {
520
- schema?: ReferenceObject | SchemaObject
521
- example?: any
522
- examples?: { [media: string]: ReferenceObject | ExampleObject }
523
- encoding?: { [media: string]: EncodingObject }
524
- }
525
-
526
- export type EncodingObject = {
527
- contentType?: string
528
- headers?: { [header: string]: ReferenceObject | HeaderObject }
529
- style?: string
530
- explode?: boolean
531
- allowReserved?: boolean
532
- }
533
-
534
- export type RequestBodyObject = {
535
- description?: string
536
- content?: { [media: string]: MediaTypeObject }
537
- required?: boolean
538
- }
539
-
540
- export type ResponsesObject = {
541
- [code: string]: ReferenceObject | ResponseObject
542
- }
543
-
544
- export type ResponseObject = {
545
- description?: string
546
- headers?: { [header: string]: ReferenceObject | HeaderObject }
547
- content?: { [media: string]: MediaTypeObject }
548
- links?: { [link: string]: ReferenceObject | LinkObject }
549
- } & AnyOtherAttribute
550
-
551
- export type LinkObject = {
552
- operationRef?: string
553
- operationId?: string
554
- parameters?: { [parameter: string]: any }
555
- requestBody?: any
556
- description?: string
557
- server?: ServerObject
558
- }
559
-
560
- export type CallbackObject = {
561
- [url: string]: PathItemObject
562
- }
563
-
564
- export type SecurityRequirementObject = {
565
- [name: string]: string[]
566
- }
567
-
568
- export type ComponentsObject = {
569
- schemas?: { [key: string]: ReferenceObject | SchemaObject }
570
- responses?: { [key: string]: ReferenceObject | ResponseObject }
571
- parameters?: { [key: string]: ReferenceObject | ParameterObject }
572
- examples?: { [key: string]: ReferenceObject | ExampleObject }
573
- requestBodies?: { [key: string]: ReferenceObject | RequestBodyObject }
574
- headers?: { [key: string]: ReferenceObject | HeaderObject }
575
- securitySchemes?: { [key: string]: ReferenceObject | SecuritySchemeObject }
576
- links?: { [key: string]: ReferenceObject | LinkObject }
577
- callbacks?: { [key: string]: ReferenceObject | CallbackObject }
578
- }
579
-
580
- export type SecuritySchemeObject =
581
- | HttpSecurityScheme
582
- | ApiKeySecurityScheme
583
- | OAuth2SecurityScheme
584
- | OpenIdSecurityScheme
585
-
586
- export type HttpSecurityScheme = {
587
- type?: 'http'
588
- description?: string
589
- scheme?: string
590
- bearerFormat?: string
591
- }
592
-
593
- export type ApiKeySecurityScheme = {
594
- type?: 'apiKey'
595
- description?: string
596
- name?: string
597
- in?: string
598
- }
599
-
600
- export type OAuth2SecurityScheme = {
601
- type?: 'oauth2'
602
- description?: string
603
- flows?: {
604
- implicit?: {
605
- authorizationUrl?: string
606
- refreshUrl?: string
607
- scopes?: { [scope: string]: string }
608
- }
609
- password?: {
610
- tokenUrl?: string
611
- refreshUrl?: string
612
- scopes?: { [scope: string]: string }
613
- }
614
- clientCredentials?: {
615
- tokenUrl?: string
616
- refreshUrl?: string
617
- scopes?: { [scope: string]: string }
618
- }
619
- authorizationCode?: {
620
- authorizationUrl?: string
621
- tokenUrl?: string
622
- refreshUrl?: string
623
- scopes?: { [scope: string]: string }
624
- }
625
- }
626
- }
627
-
628
- export type OpenIdSecurityScheme = {
629
- type?: 'openIdConnect'
630
- description?: string
631
- openIdConnectUrl?: string
632
- }
633
-
634
- export type TagObject = {
635
- name?: string
636
- description?: string
637
- externalDocs?: ExternalDocumentationObject
638
- } & AnyOtherAttribute
639
- }
640
-
641
- export namespace OpenAPIV2 {
642
- export type Document<T = {}> = {
643
- /**
644
- * Version of the OpenAPI specification
645
- * @see https://github.com/OAI/OpenAPI-Specification/tree/main/versions
646
- */
647
- swagger?: '2.0'
648
- basePath?: string
649
- consumes?: MimeTypes
650
- definitions?: DefinitionsObject
651
- externalDocs?: ExternalDocumentationObject
652
- host?: string
653
- info?: InfoObject
654
- parameters?: ParametersDefinitionsObject
655
- paths?: PathsObject<T>
656
- produces?: MimeTypes
657
- responses?: ResponsesDefinitionsObject
658
- schemes?: string[]
659
- security?: SecurityRequirementObject[]
660
- securityDefinitions?: SecurityDefinitionsObject
661
- tags?: TagObject[]
662
- [key: string]: any
663
- } & T &
664
- AnyOtherAttribute
665
-
666
- export type TagObject = {
667
- name?: string
668
- description?: string
669
- externalDocs?: ExternalDocumentationObject
670
- } & AnyOtherAttribute
671
-
672
- export type SecuritySchemeObjectBase = {
673
- type?: 'basic' | 'apiKey' | 'oauth2'
674
- description?: string
675
- }
676
-
677
- export type SecuritySchemeBasic = {
678
- type?: 'basic'
679
- } & SecuritySchemeObjectBase
680
-
681
- export type SecuritySchemeApiKey = {
682
- type?: 'apiKey'
683
- name?: string
684
- in?: string
685
- } & SecuritySchemeObjectBase
686
-
687
- export type SecuritySchemeOauth2 =
688
- | SecuritySchemeOauth2Implicit
689
- | SecuritySchemeOauth2AccessCode
690
- | SecuritySchemeOauth2Password
691
- | SecuritySchemeOauth2Application
692
-
693
- export type ScopesObject = {
694
- [index: string]: any
695
- }
696
-
697
- export type SecuritySchemeOauth2Base = {
698
- type?: 'oauth2'
699
- flow?: 'implicit' | 'password' | 'application' | 'accessCode'
700
- scopes?: ScopesObject
701
- } & SecuritySchemeObjectBase
702
-
703
- export type SecuritySchemeOauth2Implicit = {
704
- flow?: 'implicit'
705
- authorizationUrl?: string
706
- } & SecuritySchemeOauth2Base
707
-
708
- export type SecuritySchemeOauth2AccessCode = {
709
- flow?: 'accessCode'
710
- authorizationUrl?: string
711
- tokenUrl?: string
712
- } & SecuritySchemeOauth2Base
713
-
714
- export type SecuritySchemeOauth2Password = {
715
- flow?: 'password'
716
- tokenUrl?: string
717
- } & SecuritySchemeOauth2Base
718
-
719
- export type SecuritySchemeOauth2Application = {
720
- flow?: 'application'
721
- tokenUrl?: string
722
- } & SecuritySchemeOauth2Base
723
-
724
- export type SecuritySchemeObject =
725
- | SecuritySchemeBasic
726
- | SecuritySchemeApiKey
727
- | SecuritySchemeOauth2
728
-
729
- export type SecurityDefinitionsObject = {
730
- [index: string]: SecuritySchemeObject
731
- }
732
-
733
- export type SecurityRequirementObject = {
734
- [index: string]: string[]
735
- }
736
-
737
- export type ReferenceObject = {
738
- $ref: string
739
- } & AnyOtherAttribute
740
-
741
- export type Response = ResponseObject | ReferenceObject
742
-
743
- export type ResponsesDefinitionsObject = {
744
- [index: string]: ResponseObject
745
- }
746
-
747
- export type Schema = SchemaObject | ReferenceObject
748
-
749
- export type ResponseObject = {
750
- description?: string
751
- schema?: Schema
752
- headers?: HeadersObject
753
- examples?: ExampleObject
754
- } & AnyOtherAttribute
755
-
756
- export type HeadersObject = {
757
- [index: string]: HeaderObject
758
- }
759
-
760
- export type HeaderObject = {
761
- description?: string
762
- } & ItemsObject
763
-
764
- export type ExampleObject = {
765
- [index: string]: any
766
- }
767
-
768
- export type OperationObject<T = {}> = {
769
- tags?: string[]
770
- summary?: string
771
- description?: string
772
- externalDocs?: ExternalDocumentationObject
773
- operationId?: string
774
- consumes?: MimeTypes
775
- produces?: MimeTypes
776
- parameters?: Parameters
777
- responses: ResponsesObject
778
- schemes?: string[]
779
- deprecated?: boolean
780
- security?: SecurityRequirementObject[]
781
- } & T &
782
- AnyOtherAttribute
783
-
784
- export type ResponsesObject = {
785
- [index: string]: Response | undefined
786
- default?: Response
787
- }
788
-
789
- export type Parameters = (ReferenceObject | Parameter)[]
790
-
791
- export type Parameter = InBodyParameterObject | GeneralParameterObject
792
-
793
- export type InBodyParameterObject = {
794
- schema?: Schema
795
- } & ParameterObject
796
-
797
- export type GeneralParameterObject = {
798
- allowEmptyValue?: boolean
799
- } & ParameterObject &
800
- ItemsObject
801
-
802
- // All HTTP methods allowed by OpenAPI 2 spec
803
- // See https://swagger.io/specification/v2#path-item-object
804
- // You can use keys or values from it in TypeScript code like this:
805
- // for (const method of Object.values(OpenAPIV2.HttpMethods)) { … }
806
- export enum HttpMethods {
807
- GET = 'get',
808
- PUT = 'put',
809
- POST = 'post',
810
- DELETE = 'delete',
811
- OPTIONS = 'options',
812
- HEAD = 'head',
813
- PATCH = 'patch',
814
- }
815
-
816
- export type PathItemObject<T = {}> = {
817
- $ref?: string
818
- parameters?: Parameters
819
- } & {
820
- [method in HttpMethods]?: OperationObject<T>
821
- }
822
-
823
- export type PathsObject<T = {}> = {
824
- [index: string]: PathItemObject<T>
825
- }
826
-
827
- export type ParametersDefinitionsObject = {
828
- [index: string]: ParameterObject
829
- }
830
-
831
- export type ParameterObject = {
832
- name?: string
833
- in?: string
834
- description?: string
835
- required?: boolean
836
- [index: string]: any
837
- }
838
-
839
- export type MimeTypes = string[]
840
-
841
- export type DefinitionsObject = {
842
- [index: string]: SchemaObject
843
- }
844
-
845
- export type SchemaObject = {
846
- [index: string]: any
847
- discriminator?: string
848
- readOnly?: boolean
849
- xml?: XMLObject
850
- externalDocs?: ExternalDocumentationObject
851
- example?: any
852
- default?: any
853
- items?: ItemsObject | ReferenceObject
854
- properties?: {
855
- [name: string]: SchemaObject
856
- }
857
- } & IJsonSchema
858
-
859
- export type ExternalDocumentationObject = {
860
- [index: string]: any
861
- description?: string
862
- url?: string
863
- }
864
-
865
- export type ItemsObject = {
866
- type?: string
867
- format?: string
868
- items?: ItemsObject | ReferenceObject
869
- collectionFormat?: string
870
- default?: any
871
- maximum?: number
872
- exclusiveMaximum?: boolean
873
- minimum?: number
874
- exclusiveMinimum?: boolean
875
- maxLength?: number
876
- minLength?: number
877
- pattern?: string
878
- maxItems?: number
879
- minItems?: number
880
- uniqueItems?: boolean
881
- enum?: any[]
882
- multipleOf?: number
883
- $ref?: string
884
- }
885
-
886
- export type XMLObject = {
887
- [index: string]: any
888
- name?: string
889
- namespace?: string
890
- prefix?: string
891
- attribute?: boolean
892
- wrapped?: boolean
893
- }
894
-
895
- export type InfoObject = {
896
- title?: string
897
- description?: string
898
- termsOfService?: string
899
- contact?: ContactObject
900
- license?: LicenseObject
901
- version?: string
902
- }
903
-
904
- export type ContactObject = {
905
- name?: string
906
- url?: string
907
- email?: string
908
- }
909
-
910
- export type LicenseObject = {
911
- name?: string
912
- url?: string
913
- }
914
- }
915
-
916
- export type IJsonSchema = {
917
- id?: string
918
- $schema?: string
919
- title?: string
920
- description?: string
921
- multipleOf?: number
922
- maximum?: number
923
- exclusiveMaximum?: boolean
924
- minimum?: number
925
- exclusiveMinimum?: boolean
926
- maxLength?: number
927
- minLength?: number
928
- pattern?: string
929
- additionalItems?: boolean | IJsonSchema
930
- items?: IJsonSchema | IJsonSchema[]
931
- maxItems?: number
932
- minItems?: number
933
- uniqueItems?: boolean
934
- maxProperties?: number
935
- minProperties?: number
936
- required?: string[]
937
- additionalProperties?: boolean | IJsonSchema
938
- definitions?: {
939
- [name: string]: IJsonSchema
940
- }
941
- properties?: {
942
- [name: string]: IJsonSchema
943
- }
944
- patternProperties?: {
945
- [name: string]: IJsonSchema
946
- }
947
- dependencies?: {
948
- [name: string]: IJsonSchema | string[]
949
- }
950
- enum?: any[]
951
- type?: string | string[]
952
- allOf?: IJsonSchema[]
953
- anyOf?: IJsonSchema[]
954
- oneOf?: IJsonSchema[]
955
- not?: IJsonSchema
956
- $ref?: string
957
- } & AnyOtherAttribute