Skip to content

Commit f4aee94

Browse files
committed
Move all definitions to single file
1 parent 74c817d commit f4aee94

32 files changed

+307
-412
lines changed

src/3.1.0.d.ts

Lines changed: 307 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,307 @@
1-
export * from './3.1.0';
1+
import { JsonSchema } from '@fosfad/json-schema-typescript-definitions/2020-12';
2+
3+
export interface Callback {
4+
[expression: string]: PathItem | Reference;
5+
}
6+
7+
export interface Components {
8+
callbacks?: { [key: string]: Callback | Reference };
9+
examples?: { [key: string]: Example | Reference };
10+
headers?: { [key: string]: Header | Reference };
11+
links?: { [key: string]: Link | Reference };
12+
parameters?: { [key: string]: Parameter | Reference };
13+
pathItems?: { [key: string]: PathItem | Reference };
14+
requestBodies?: { [key: string]: RequestBody | Reference };
15+
responses?: { [key: string]: Response | Reference };
16+
schemas?: { [key: string]: Schema };
17+
securitySchemes?: { [key: string]: SecurityScheme | Reference };
18+
}
19+
20+
export interface Contact {
21+
email?: string;
22+
name?: string;
23+
url?: string;
24+
}
25+
26+
export interface Discriminator {
27+
mapping?: { [discriminatorValue: string]: string };
28+
propertyName: string;
29+
}
30+
31+
export interface Encoding {
32+
allowReserved?: boolean;
33+
contentType?: string;
34+
explode?: boolean;
35+
headers?: { [headerName: string]: Header | Reference };
36+
style?: string;
37+
}
38+
39+
export interface Example {
40+
description?: string;
41+
externalValue?: string;
42+
summary?: string;
43+
value?: any;
44+
}
45+
46+
export interface ExternalDocumentation {
47+
description?: string;
48+
url: string;
49+
}
50+
51+
export type Header = Omit<HeaderParameter, 'in' | 'name'>;
52+
53+
export interface Info {
54+
contact?: Contact;
55+
description?: string;
56+
license?: License;
57+
summary?: string;
58+
termsOfService?: string;
59+
title: string;
60+
version: string;
61+
}
62+
63+
export interface License {
64+
identifier?: string;
65+
name: string;
66+
url?: string;
67+
}
68+
69+
export interface Link {
70+
description?: string;
71+
operationId?: string;
72+
operationRef?: string;
73+
parameters?: { [name: string]: string | any };
74+
requestBody?: string | any;
75+
server?: Server;
76+
}
77+
78+
export interface MediaType {
79+
encoding?: { [propertyName: string]: Encoding };
80+
example?: any;
81+
examples?: { [key: string]: Example | Reference };
82+
schema?: Schema;
83+
}
84+
85+
interface CommonOAuthFlow {
86+
refreshUrl?: string;
87+
scopes: { [scopeName: string]: string };
88+
}
89+
90+
export interface AuthorizationCodeOAuthFlow extends CommonOAuthFlow {
91+
authorizationUrl: string;
92+
tokenUrl: string;
93+
}
94+
95+
export interface ClientCredentialsOAuthFlow extends CommonOAuthFlow {
96+
tokenUrl: string;
97+
}
98+
99+
export interface ImplicitOAuthFlow extends CommonOAuthFlow {
100+
authorizationUrl: string;
101+
}
102+
103+
export interface ResourceOwnerPasswordOAuthFlow extends CommonOAuthFlow {
104+
tokenUrl: string;
105+
}
106+
107+
export interface OAuthFlows {
108+
authorizationCode?: AuthorizationCodeOAuthFlow;
109+
clientCredentials?: ClientCredentialsOAuthFlow;
110+
implicit?: ImplicitOAuthFlow;
111+
password?: ResourceOwnerPasswordOAuthFlow;
112+
}
113+
114+
export const openapiVersion = '3.1.0';
115+
116+
export interface OpenAPI {
117+
components?: Components;
118+
externalDocs?: ExternalDocumentation;
119+
info: Info;
120+
jsonSchemaDialect?: string;
121+
openapi: typeof openapiVersion;
122+
paths: Paths;
123+
security?: SecurityRequirement[];
124+
servers?: Server[];
125+
tags?: Tag[];
126+
webhooks?: { [webhookName: string]: PathItem | Reference };
127+
}
128+
129+
export interface Operation {
130+
callbacks?: { [callbackIdentifier: string]: Callback | Reference };
131+
deprecated?: boolean;
132+
description?: string;
133+
externalDocs?: ExternalDocumentation;
134+
operationId?: string;
135+
parameters?: Array<Parameter | Reference>;
136+
requestBody?: RequestBody | Reference;
137+
responses?: Responses;
138+
security?: Array<SecurityRequirement>;
139+
servers?: Array<Server>;
140+
summary?: string;
141+
tags?: Array<string>;
142+
}
143+
144+
interface CommonParameter {
145+
content?: { [mediaType: string]: MediaType };
146+
deprecated?: boolean;
147+
description?: string;
148+
example?: any;
149+
examples?: { [key: string]: Example | Reference };
150+
explode?: boolean;
151+
name: string;
152+
required?: boolean;
153+
schema?: Schema;
154+
style?: string;
155+
}
156+
157+
export interface QueryParameter extends CommonParameter {
158+
allowEmptyValue?: boolean;
159+
allowReserved?: boolean;
160+
in: 'query';
161+
}
162+
163+
export interface HeaderParameter extends CommonParameter {
164+
in: 'header';
165+
}
166+
167+
export interface PathParameter extends CommonParameter {
168+
in: 'path';
169+
required: true;
170+
}
171+
172+
export interface CookieParameter extends CommonParameter {
173+
in: 'cookie';
174+
}
175+
176+
export type Parameter = QueryParameter | HeaderParameter | PathParameter | CookieParameter;
177+
178+
export interface PathItem {
179+
$ref?: string;
180+
delete?: Operation;
181+
description?: string;
182+
get?: Operation;
183+
head?: Operation;
184+
options?: Operation;
185+
parameters?: Array<Parameter | Reference>;
186+
patch?: Operation;
187+
post?: Operation;
188+
put?: Operation;
189+
servers?: Server[];
190+
summary?: string;
191+
trace?: Operation;
192+
}
193+
194+
export interface Paths {
195+
[path: string]: PathItem;
196+
}
197+
198+
export interface Reference {
199+
$ref: string;
200+
description?: string;
201+
summary?: string;
202+
}
203+
204+
export interface RequestBody {
205+
content: { [mediaType: string]: MediaType };
206+
description?: string;
207+
required?: boolean;
208+
}
209+
210+
export interface Response {
211+
content?: { [mediaType: string]: MediaType };
212+
description: string;
213+
headers?: {
214+
[headerName: string]: Header | Reference;
215+
};
216+
links?: { [linkName: string]: Link | Reference };
217+
}
218+
219+
export interface Responses {
220+
[httpStatusCode: string]: Response | Reference;
221+
}
222+
223+
export type Schema = JsonSchema & {
224+
$defs?: { [key: string]: Schema };
225+
additionalProperties?: Schema;
226+
allOf?: Array<Schema>;
227+
anyOf?: Array<Schema>;
228+
contains?: Schema;
229+
dependentSchemas?: { [key: string]: Schema };
230+
discriminator?: Discriminator;
231+
else?: Schema;
232+
externalDocs?: ExternalDocumentation;
233+
if?: Schema;
234+
items?: Schema;
235+
not?: Schema;
236+
oneOf?: Array<Schema>;
237+
patternProperties?: { [propertyNameRegex: string]: Schema };
238+
prefixItems?: Array<Schema>;
239+
properties?: { [propertyName: string]: Schema };
240+
propertyNames?: Schema;
241+
then?: Schema;
242+
unevaluatedItems?: Schema;
243+
unevaluatedProperties?: Schema;
244+
xml?: XML;
245+
};
246+
247+
export interface SecurityRequirement {
248+
[name: string]: string[];
249+
}
250+
251+
interface CommonSecurityScheme {
252+
description?: string;
253+
}
254+
255+
export interface ApiKeySecurityScheme extends CommonSecurityScheme {
256+
in: 'query' | 'header' | 'cookie';
257+
name: string;
258+
type: 'apiKey';
259+
}
260+
261+
export interface HttpSecurityScheme extends CommonSecurityScheme {
262+
bearerFormat?: string;
263+
scheme: string;
264+
type: 'http';
265+
}
266+
267+
export interface OAuth2SecurityScheme extends CommonSecurityScheme {
268+
flows: OAuthFlows;
269+
type: 'oauth2';
270+
}
271+
272+
export interface OpenIdConnectSecurityScheme extends CommonSecurityScheme {
273+
openIdConnectUrl: string;
274+
type: 'openIdConnect';
275+
}
276+
277+
export type SecurityScheme =
278+
| ApiKeySecurityScheme
279+
| HttpSecurityScheme
280+
| OAuth2SecurityScheme
281+
| OpenIdConnectSecurityScheme;
282+
283+
export interface Server {
284+
description?: string;
285+
url: string;
286+
variables?: { [variableName: string]: ServerVariable };
287+
}
288+
289+
export interface ServerVariable {
290+
default: string;
291+
description?: string;
292+
enum?: string[];
293+
}
294+
295+
export interface Tag {
296+
description?: string;
297+
externalDocs?: ExternalDocumentation;
298+
name: string;
299+
}
300+
301+
export interface XML {
302+
attribute?: boolean;
303+
name?: string;
304+
namespace?: string;
305+
prefix?: string;
306+
wrapped?: boolean;
307+
}

src/3.1.0/callback.d.ts

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/3.1.0/components.d.ts

Lines changed: 0 additions & 24 deletions
This file was deleted.

src/3.1.0/contact.d.ts

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/3.1.0/discriminator.d.ts

Lines changed: 0 additions & 4 deletions
This file was deleted.

src/3.1.0/encoding.d.ts

Lines changed: 0 additions & 10 deletions
This file was deleted.

src/3.1.0/example.d.ts

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/3.1.0/externalDocumentation.d.ts

Lines changed: 0 additions & 4 deletions
This file was deleted.

src/3.1.0/header.d.ts

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)