@@ -18,14 +18,8 @@ export namespace OpenAPI {
18
18
// any other attribute
19
19
[ key : string ] : any
20
20
} = { } ,
21
- > = (
22
- | OpenAPIV2 . Document < T >
23
- | OpenAPIV3 . Document < T >
24
- | OpenAPIV3_1 . Document < T >
25
- ) & {
26
- // any other attribute
27
- [ key : string ] : any
28
- }
21
+ > = OpenAPIV2 . Document < T > | OpenAPIV3 . Document < T > | OpenAPIV3_1 . Document < T >
22
+
29
23
export type Operation < T extends { } = { } > =
30
24
| OpenAPIV2 . OperationObject < T >
31
25
| OpenAPIV3 . OperationObject < T >
@@ -62,6 +56,11 @@ export namespace OpenAPIV3_1 {
62
56
export type Document < T extends { } = { } > = Modify <
63
57
Omit < OpenAPIV3 . Document < T > , 'paths' | 'components' > ,
64
58
{
59
+ /**
60
+ * Version of the OpenAPI specification
61
+ * @see https://github.com/OAI/OpenAPI-Specification/tree/main/versions
62
+ */
63
+ openapi : '3.1.0'
65
64
info ?: InfoObject
66
65
jsonSchemaDialect ?: string
67
66
servers ?: ServerObject [ ]
@@ -284,7 +283,12 @@ export namespace OpenAPIV3_1 {
284
283
285
284
export namespace OpenAPIV3 {
286
285
export interface Document < T extends { } = { } > {
287
- openapi ?: string
286
+ [ propName : string ] : any
287
+ /**
288
+ * Version of the OpenAPI specification
289
+ * @see https://github.com/OAI/OpenAPI-Specification/tree/main/versions
290
+ */
291
+ openapi ?: '3.0.0' | '3.0.1' | '3.0.2' | '3.0.2'
288
292
info ?: InfoObject
289
293
servers ?: ServerObject [ ]
290
294
paths ?: PathsObject < T >
@@ -606,6 +610,9 @@ export namespace OpenAPIV3 {
606
610
607
611
export namespace OpenAPIV2 {
608
612
export interface Document < T extends { } = { } > {
613
+ [ propName : string ] : any
614
+ /** To make it easier to use openapi as a type guard */
615
+ openapi : undefined
609
616
basePath ?: string
610
617
consumes ?: MimeTypes
611
618
definitions ?: DefinitionsObject
@@ -619,7 +626,11 @@ export namespace OpenAPIV2 {
619
626
schemes ?: string [ ]
620
627
security ?: SecurityRequirementObject [ ]
621
628
securityDefinitions ?: SecurityDefinitionsObject
622
- swagger ?: string
629
+ /**
630
+ * Version of the OpenAPI specification
631
+ * @see https://github.com/OAI/OpenAPI-Specification/tree/main/versions
632
+ */
633
+ swagger ?: '2.0'
623
634
tags ?: TagObject [ ]
624
635
}
625
636
0 commit comments