UNPKG

8.85 kBTypeScriptView Raw
1import { JsonSchemaDraft07 } from './jsonSchemaDraft07';
2export declare namespace OpenApisV3 {
3 interface SchemaJson {
4 openapi: string;
5 info: SchemaJson.Definitions.Info;
6 servers?: SchemaJson.Definitions.Server[];
7 paths: SchemaJson.Definitions.Paths;
8 components?: SchemaJson.Definitions.Components;
9 security?: SchemaJson.Definitions.SecurityRequirement[];
10 tags?: SchemaJson.Definitions.Tag[];
11 externalDocs?: SchemaJson.Definitions.ExternalDocs;
12 }
13 namespace SchemaJson {
14 namespace Definitions {
15 type Any = Record<string, any>;
16 type AnyOrExpression = Any | Expression;
17 type AnysOrExpressions = Record<string, AnyOrExpression>;
18 interface Callback {
19 }
20 type CallbackOrReference = Callback | Reference;
21 type CallbacksOrReferences = Record<string, CallbackOrReference>;
22 interface Components {
23 schemas?: SchemasOrReferences;
24 responses?: ResponsesOrReferences;
25 parameters?: ParametersOrReferences;
26 examples?: ExamplesOrReferences;
27 requestBodies?: RequestBodiesOrReferences;
28 headers?: HeadersOrReferences;
29 securitySchemes?: SecuritySchemesOrReferences;
30 links?: LinksOrReferences;
31 callbacks?: CallbacksOrReferences;
32 }
33 interface Contact {
34 name?: string;
35 url?: string;
36 email?: string;
37 }
38 type DefaultType = null | any[] | number | boolean | string;
39 interface Discriminator {
40 propertyName: string;
41 mapping?: Strings;
42 }
43 interface Encoding {
44 contentType?: string;
45 headers?: HeadersOrReferences;
46 style?: string;
47 explode?: boolean;
48 allowReserved?: boolean;
49 }
50 type Encodings = Record<string, Encoding>;
51 interface Example {
52 summary?: string;
53 description?: string;
54 value?: Any;
55 externalValue?: string;
56 }
57 type ExampleOrReference = Example | Reference;
58 type ExamplesOrReferences = Record<string, ExampleOrReference>;
59 type Expression = Record<string, any>;
60 interface ExternalDocs {
61 description?: string;
62 url: string;
63 }
64 interface Header {
65 description?: string;
66 required?: boolean;
67 deprecated?: boolean;
68 allowEmptyValue?: boolean;
69 style?: string;
70 explode?: boolean;
71 allowReserved?: boolean;
72 schema?: SchemaOrReference;
73 example?: Any;
74 examples?: ExamplesOrReferences;
75 content?: MediaTypes;
76 }
77 type HeaderOrReference = Header | Reference;
78 type HeadersOrReferences = Record<string, HeaderOrReference>;
79 interface Info {
80 title: string;
81 description?: string;
82 termsOfService?: string;
83 contact?: Contact;
84 license?: License;
85 version: string;
86 }
87 interface License {
88 name: string;
89 url?: string;
90 }
91 interface Link {
92 operationRef?: string;
93 operationId?: string;
94 parameters?: AnysOrExpressions;
95 requestBody?: AnyOrExpression;
96 description?: string;
97 server?: Server;
98 }
99 type LinkOrReference = Link | Reference;
100 type LinksOrReferences = Record<string, LinkOrReference>;
101 interface MediaType {
102 schema?: SchemaOrReference;
103 example?: Any;
104 examples?: ExamplesOrReferences;
105 encoding?: Encodings;
106 }
107 type MediaTypes = Record<string, MediaType>;
108 interface OauthFlow {
109 authorizationUrl?: string;
110 tokenUrl?: string;
111 refreshUrl?: string;
112 scopes?: Strings;
113 }
114 interface OauthFlows {
115 implicit?: OauthFlow;
116 password?: OauthFlow;
117 clientCredentials?: OauthFlow;
118 authorizationCode?: OauthFlow;
119 }
120 interface Operation {
121 tags?: string[];
122 summary?: string;
123 description?: string;
124 externalDocs?: ExternalDocs;
125 operationId?: string;
126 parameters?: ParameterOrReference[];
127 requestBody?: RequestBodyOrReference;
128 responses: ResponsesOrReferences;
129 callbacks?: CallbacksOrReferences;
130 deprecated?: boolean;
131 security?: SecurityRequirement[];
132 servers?: Server[];
133 }
134 interface Parameter {
135 name: string;
136 in: string;
137 description?: string;
138 required?: boolean;
139 deprecated?: boolean;
140 allowEmptyValue?: boolean;
141 style?: string;
142 explode?: boolean;
143 allowReserved?: boolean;
144 schema?: SchemaOrReference;
145 example?: Any;
146 examples?: ExamplesOrReferences;
147 content?: MediaTypes;
148 }
149 type ParameterOrReference = Parameter | Reference;
150 type ParametersOrReferences = Record<string, ParameterOrReference>;
151 interface PathItem {
152 $ref?: string;
153 summary?: string;
154 description?: string;
155 get?: Operation;
156 put?: Operation;
157 post?: Operation;
158 delete?: Operation;
159 options?: Operation;
160 head?: Operation;
161 patch?: Operation;
162 trace?: Operation;
163 servers?: Server[];
164 parameters?: ParameterOrReference[];
165 }
166 type PathItemOrReference = PathItem | Reference;
167 type Paths = Record<string, PathItemOrReference>;
168 interface Reference {
169 $ref: string;
170 }
171 type RequestBodiesOrReferences = Record<string, RequestBodyOrReference>;
172 interface RequestBody {
173 description?: string;
174 content: MediaTypes;
175 required?: boolean;
176 }
177 type RequestBodyOrReference = RequestBody | Reference;
178 interface Response {
179 description: string;
180 headers?: HeadersOrReferences;
181 content?: MediaTypes;
182 links?: LinksOrReferences;
183 }
184 type ResponseOrReference = Response | Reference;
185 type ResponsesOrReferences = Record<string, ResponseOrReference>;
186 type SchemaOrReference = JsonSchemaDraft07.SchemaObject | Reference;
187 type SchemasOrReferences = Record<string, SchemaOrReference>;
188 interface SecurityRequirement {
189 }
190 interface SecurityScheme {
191 type: string;
192 description?: string;
193 name?: string;
194 in?: string;
195 scheme?: string;
196 bearerFormat?: string;
197 flows?: OauthFlows;
198 openIdConnectUrl?: string;
199 }
200 type SecuritySchemeOrReference = SecurityScheme | Reference;
201 type SecuritySchemesOrReferences = Record<string, SecuritySchemeOrReference>;
202 interface Server {
203 url: string;
204 description?: string;
205 variables?: ServerVariables;
206 }
207 interface ServerVariable {
208 enum?: string[];
209 default: string;
210 description?: string;
211 }
212 type ServerVariables = Record<string, ServerVariable>;
213 type SpecificationExtension = null | number | boolean | string | any[];
214 type Strings = Record<string, string>;
215 interface Tag {
216 name: string;
217 description?: string;
218 externalDocs?: ExternalDocs;
219 }
220 interface Xml {
221 name?: string;
222 namespace?: string;
223 prefix?: string;
224 attribute?: boolean;
225 wrapped?: boolean;
226 }
227 }
228 }
229}