@api-client/core 0.19.18 → 0.19.20
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.
- package/build/src/authorization/Utils.js +3 -3
- package/build/src/authorization/Utils.js.map +1 -1
- package/build/src/browser.d.ts +1 -1
- package/build/src/browser.d.ts.map +1 -1
- package/build/src/browser.js.map +1 -1
- package/build/src/index.d.ts +1 -1
- package/build/src/index.d.ts.map +1 -1
- package/build/src/index.js.map +1 -1
- package/build/src/mocking/lib/Organization.d.ts +5 -1
- package/build/src/mocking/lib/Organization.d.ts.map +1 -1
- package/build/src/mocking/lib/Organization.js +17 -0
- package/build/src/mocking/lib/Organization.js.map +1 -1
- package/build/src/modeling/ApiModel.d.ts +16 -5
- package/build/src/modeling/ApiModel.d.ts.map +1 -1
- package/build/src/modeling/ApiModel.js +17 -2
- package/build/src/modeling/ApiModel.js.map +1 -1
- package/build/src/modeling/ApiValidation.d.ts.map +1 -1
- package/build/src/modeling/ApiValidation.js +2 -1
- package/build/src/modeling/ApiValidation.js.map +1 -1
- package/build/src/modeling/DomainProperty.d.ts +12 -0
- package/build/src/modeling/DomainProperty.d.ts.map +1 -1
- package/build/src/modeling/DomainProperty.js +23 -28
- package/build/src/modeling/DomainProperty.js.map +1 -1
- package/build/src/modeling/DomainSerialization.js +1 -1
- package/build/src/modeling/DomainSerialization.js.map +1 -1
- package/build/src/modeling/ExposedEntity.d.ts +15 -1
- package/build/src/modeling/ExposedEntity.d.ts.map +1 -1
- package/build/src/modeling/ExposedEntity.js +42 -4
- package/build/src/modeling/ExposedEntity.js.map +1 -1
- package/build/src/modeling/actions/Action.d.ts.map +1 -1
- package/build/src/modeling/actions/Action.js +1 -0
- package/build/src/modeling/actions/Action.js.map +1 -1
- package/build/src/modeling/actions/ListAction.d.ts +3 -17
- package/build/src/modeling/actions/ListAction.d.ts.map +1 -1
- package/build/src/modeling/actions/ListAction.js +18 -38
- package/build/src/modeling/actions/ListAction.js.map +1 -1
- package/build/src/modeling/actions/SearchAction.d.ts +4 -4
- package/build/src/modeling/actions/SearchAction.d.ts.map +1 -1
- package/build/src/modeling/actions/SearchAction.js +16 -13
- package/build/src/modeling/actions/SearchAction.js.map +1 -1
- package/build/src/modeling/generators/oas_312/OasGenerator.d.ts +32 -0
- package/build/src/modeling/generators/oas_312/OasGenerator.d.ts.map +1 -0
- package/build/src/modeling/generators/oas_312/OasGenerator.js +1452 -0
- package/build/src/modeling/generators/oas_312/OasGenerator.js.map +1 -0
- package/build/src/modeling/generators/oas_312/OasSchemaGenerator.d.ts +27 -0
- package/build/src/modeling/generators/oas_312/OasSchemaGenerator.d.ts.map +1 -0
- package/build/src/modeling/generators/oas_312/OasSchemaGenerator.js +295 -0
- package/build/src/modeling/generators/oas_312/OasSchemaGenerator.js.map +1 -0
- package/build/src/modeling/generators/oas_312/types.d.ts +1010 -0
- package/build/src/modeling/generators/oas_312/types.d.ts.map +1 -0
- package/build/src/modeling/generators/oas_312/types.js +2 -0
- package/build/src/modeling/generators/oas_312/types.js.map +1 -0
- package/build/src/modeling/generators/oas_320/OasGenerator.d.ts +16 -0
- package/build/src/modeling/generators/oas_320/OasGenerator.d.ts.map +1 -0
- package/build/src/modeling/generators/oas_320/OasGenerator.js +306 -0
- package/build/src/modeling/generators/oas_320/OasGenerator.js.map +1 -0
- package/build/src/modeling/generators/oas_320/OasSchemaGenerator.d.ts +25 -0
- package/build/src/modeling/generators/oas_320/OasSchemaGenerator.d.ts.map +1 -0
- package/build/src/modeling/generators/oas_320/OasSchemaGenerator.js +237 -0
- package/build/src/modeling/generators/oas_320/OasSchemaGenerator.js.map +1 -0
- package/build/src/modeling/generators/oas_320/types.d.ts +1219 -0
- package/build/src/modeling/generators/oas_320/types.d.ts.map +1 -0
- package/build/src/modeling/generators/oas_320/types.js +2 -0
- package/build/src/modeling/generators/oas_320/types.js.map +1 -0
- package/build/src/modeling/types.d.ts +50 -13
- package/build/src/modeling/types.d.ts.map +1 -1
- package/build/src/modeling/types.js.map +1 -1
- package/build/src/modeling/validation/api_model_rules.d.ts +1 -0
- package/build/src/modeling/validation/api_model_rules.d.ts.map +1 -1
- package/build/src/modeling/validation/api_model_rules.js +105 -29
- package/build/src/modeling/validation/api_model_rules.js.map +1 -1
- package/build/src/models/ProjectRequest.d.ts.map +1 -1
- package/build/src/models/ProjectRequest.js +0 -4
- package/build/src/models/ProjectRequest.js.map +1 -1
- package/build/src/models/store/Organization.d.ts +13 -0
- package/build/src/models/store/Organization.d.ts.map +1 -1
- package/build/src/models/store/Organization.js.map +1 -1
- package/build/src/models/transformers/ArcDexieTransformer.d.ts.map +1 -1
- package/build/src/models/transformers/ArcDexieTransformer.js +0 -4
- package/build/src/models/transformers/ArcDexieTransformer.js.map +1 -1
- package/build/src/models/transformers/ImportUtils.js +1 -1
- package/build/src/models/transformers/ImportUtils.js.map +1 -1
- package/build/src/models/transformers/PostmanBackupTransformer.d.ts.map +1 -1
- package/build/src/models/transformers/PostmanBackupTransformer.js +0 -4
- package/build/src/models/transformers/PostmanBackupTransformer.js.map +1 -1
- package/build/src/runtime/constants.d.ts +7 -0
- package/build/src/runtime/constants.d.ts.map +1 -0
- package/build/src/runtime/constants.js +8 -0
- package/build/src/runtime/constants.js.map +1 -0
- package/build/src/runtime/http-engine/ntlm/Des.d.ts.map +1 -1
- package/build/src/runtime/http-engine/ntlm/Des.js +1 -0
- package/build/src/runtime/http-engine/ntlm/Des.js.map +1 -1
- package/build/src/runtime/variables/EvalFunctions.d.ts.map +1 -1
- package/build/src/runtime/variables/EvalFunctions.js +0 -1
- package/build/src/runtime/variables/EvalFunctions.js.map +1 -1
- package/build/src/sdk/OrganizationsSdk.d.ts +17 -1
- package/build/src/sdk/OrganizationsSdk.d.ts.map +1 -1
- package/build/src/sdk/OrganizationsSdk.js +76 -0
- package/build/src/sdk/OrganizationsSdk.js.map +1 -1
- package/build/src/sdk/RouteBuilder.d.ts +2 -0
- package/build/src/sdk/RouteBuilder.d.ts.map +1 -1
- package/build/src/sdk/RouteBuilder.js +6 -0
- package/build/src/sdk/RouteBuilder.js.map +1 -1
- package/build/src/sdk/SdkMock.d.ts +12 -0
- package/build/src/sdk/SdkMock.d.ts.map +1 -1
- package/build/src/sdk/SdkMock.js +32 -0
- package/build/src/sdk/SdkMock.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/eslint.config.js +6 -0
- package/package.json +3 -1
- package/src/authorization/Utils.ts +3 -3
- package/src/mocking/lib/Organization.ts +22 -1
- package/src/modeling/ApiModel.ts +23 -8
- package/src/modeling/ApiValidation.ts +2 -0
- package/src/modeling/DomainProperty.ts +22 -18
- package/src/modeling/DomainSerialization.ts +1 -1
- package/src/modeling/ExposedEntity.ts +44 -4
- package/src/modeling/actions/Action.ts +1 -0
- package/src/modeling/actions/ListAction.ts +12 -30
- package/src/modeling/actions/SearchAction.ts +11 -8
- package/src/modeling/generators/oas_312/OasGenerator.ts +1685 -0
- package/src/modeling/generators/oas_312/OasSchemaGenerator.ts +322 -0
- package/src/modeling/generators/oas_312/types.ts +1052 -0
- package/src/modeling/generators/oas_320/OasGenerator.ts +359 -0
- package/src/modeling/generators/oas_320/OasSchemaGenerator.ts +255 -0
- package/src/modeling/generators/oas_320/types.ts +1259 -0
- package/src/modeling/types.ts +55 -22
- package/src/modeling/validation/api_model_rules.ts +103 -32
- package/src/models/ProjectRequest.ts +0 -4
- package/src/models/store/Organization.ts +14 -0
- package/src/models/transformers/ArcDexieTransformer.ts +0 -4
- package/src/models/transformers/ImportUtils.ts +1 -1
- package/src/models/transformers/PostmanBackupTransformer.ts +0 -5
- package/src/runtime/constants.ts +9 -0
- package/src/runtime/http-engine/ntlm/Des.ts +1 -0
- package/src/runtime/variables/EvalFunctions.ts +0 -1
- package/src/sdk/OrganizationsSdk.ts +81 -1
- package/src/sdk/RouteBuilder.ts +8 -0
- package/src/sdk/SdkMock.ts +50 -0
- package/tests/test-utils.ts +6 -2
- package/tests/unit/decorators/observed.spec.ts +8 -24
- package/tests/unit/decorators/observed_recursive.spec.ts +0 -1
- package/tests/unit/events/EventsTestHelpers.ts +0 -1
- package/tests/unit/events/events_polyfills.ts +0 -1
- package/tests/unit/legacy-transformers/DataTestHelper.ts +0 -2
- package/tests/unit/legacy-transformers/LegacyExportProcessor.spec.ts +0 -1
- package/tests/unit/modeling/actions/ListAction.spec.ts +9 -69
- package/tests/unit/modeling/actions/SearchAction.spec.ts +9 -35
- package/tests/unit/modeling/api_model.spec.ts +28 -0
- package/tests/unit/modeling/definitions/sku.spec.ts +0 -2
- package/tests/unit/modeling/domain_property.spec.ts +20 -1
- package/tests/unit/modeling/exposed_entity.spec.ts +71 -0
- package/tests/unit/modeling/generators/OasGenerator.spec.ts +302 -0
- package/tests/unit/modeling/validation/api_model_rules.spec.ts +113 -15
|
@@ -0,0 +1,1052 @@
|
|
|
1
|
+
import { type JSONSchema } from 'json-schema-typed/draft-2020-12'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This is the root object of the [OpenAPI Description](#openapi-description).
|
|
5
|
+
*/
|
|
6
|
+
export interface OpenApi312 {
|
|
7
|
+
/**
|
|
8
|
+
* This string MUST be the [version number](#versions) of the OpenAPI Specification that the OpenAPI
|
|
9
|
+
* Document uses. The `openapi` field SHOULD be used by tooling to interpret the OpenAPI Document. This is _not_
|
|
10
|
+
* related to the [`info.version`](#info-version) string, which is the version of the OpenAPI Document.
|
|
11
|
+
*/
|
|
12
|
+
openapi: '3.1.0' //'3.1.2'
|
|
13
|
+
/**
|
|
14
|
+
* Provides metadata about the API. The metadata MAY be used by tooling as required.
|
|
15
|
+
*/
|
|
16
|
+
info: InfoObject
|
|
17
|
+
/**
|
|
18
|
+
* The default value for the `$schema` keyword within [Schema Objects](#schema-object) contained within this OAS
|
|
19
|
+
* document. This MUST be in the form of a URI.
|
|
20
|
+
*/
|
|
21
|
+
jsonSchemaDialect?: string
|
|
22
|
+
/**
|
|
23
|
+
* An array of Server Objects, which provide connectivity information to a target server. If the `servers` field is
|
|
24
|
+
* not provided, or is an empty array, the default value would be a [Server Object](#server-object) with a
|
|
25
|
+
* [url](#server-url) value of `/`.
|
|
26
|
+
*/
|
|
27
|
+
servers?: ServerObject[]
|
|
28
|
+
/**
|
|
29
|
+
* The available paths and operations for the API.
|
|
30
|
+
*/
|
|
31
|
+
paths?: PathsObject
|
|
32
|
+
/**
|
|
33
|
+
* The incoming webhooks that MAY be received as part of this API and that the API consumer MAY choose to implement.
|
|
34
|
+
* Closely related to the `callbacks` feature, this section describes requests initiated other than by an API call,
|
|
35
|
+
* for example by an out of band registration. The key name is a unique string to refer to each webhook, while the
|
|
36
|
+
* (optionally referenced) Path Item Object describes a request that may be initiated by the API provider and the
|
|
37
|
+
* expected responses. An [example](https://learn.openapis.org/examples/v3.1/webhook-example.html) is available.
|
|
38
|
+
*/
|
|
39
|
+
webhooks?: Record<string, PathItemObject>
|
|
40
|
+
/**
|
|
41
|
+
* An element to hold various Objects for the OpenAPI Description.
|
|
42
|
+
*/
|
|
43
|
+
components?: ComponentsObject
|
|
44
|
+
/**
|
|
45
|
+
* A declaration of which security mechanisms can be used across the API. The list of values includes alternative
|
|
46
|
+
* Security Requirement Objects that can be used. Only one of the Security Requirement Objects need to be satisfied to
|
|
47
|
+
* authorize a request. Individual operations can override this definition. The list can be incomplete, up to being
|
|
48
|
+
* empty or absent. To make security explicitly optional, an empty security requirement (`{}`) can be included in the
|
|
49
|
+
* array.
|
|
50
|
+
*/
|
|
51
|
+
security?: SecurityRequirementObject[]
|
|
52
|
+
/**
|
|
53
|
+
* A list of tags used by the OpenAPI Description with additional metadata. The order of the tags can be used to
|
|
54
|
+
* reflect on their order by the parsing tools. Not all tags that are used by the [Operation
|
|
55
|
+
* Object](#operation-object) must be declared. The tags that are not declared MAY be organized randomly or based on
|
|
56
|
+
* the tools' logic. Each tag name in the list MUST be unique.
|
|
57
|
+
*/
|
|
58
|
+
tags?: TagObject[]
|
|
59
|
+
/**
|
|
60
|
+
* Additional external documentation.
|
|
61
|
+
*/
|
|
62
|
+
externalDocs?: ExternalDocumentationObject
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* The object provides metadata about the API. The metadata MAY be used by the clients if needed, and MAY be presented
|
|
67
|
+
* in editing or documentation generation tools for convenience.
|
|
68
|
+
*/
|
|
69
|
+
export interface InfoObject {
|
|
70
|
+
/**
|
|
71
|
+
* The title of the API.
|
|
72
|
+
*/
|
|
73
|
+
title: string
|
|
74
|
+
/**
|
|
75
|
+
* A short summary of the API.
|
|
76
|
+
*/
|
|
77
|
+
summary?: string
|
|
78
|
+
/**
|
|
79
|
+
* A description of the API. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text
|
|
80
|
+
* representation.
|
|
81
|
+
*/
|
|
82
|
+
description?: string
|
|
83
|
+
/**
|
|
84
|
+
* A URI for the Terms of Service for the API. This MUST be in the form of a URI.
|
|
85
|
+
*/
|
|
86
|
+
termsOfService?: string
|
|
87
|
+
/**
|
|
88
|
+
* The contact information for the exposed API.
|
|
89
|
+
*/
|
|
90
|
+
contact?: ContactObject
|
|
91
|
+
/**
|
|
92
|
+
* The license information for the exposed API.
|
|
93
|
+
*/
|
|
94
|
+
license?: LicenseObject
|
|
95
|
+
/**
|
|
96
|
+
* The version of the OpenAPI Document (which is distinct from the [OpenAPI Specification
|
|
97
|
+
* version](#oas-version) or the version of the API being described or the version of the OpenAPI Description).
|
|
98
|
+
*/
|
|
99
|
+
version: string
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Contact information for the exposed API.
|
|
104
|
+
*/
|
|
105
|
+
export interface ContactObject {
|
|
106
|
+
/**
|
|
107
|
+
* The identifying name of the contact person/organization.
|
|
108
|
+
*/
|
|
109
|
+
name?: string
|
|
110
|
+
/**
|
|
111
|
+
* The URI for the contact information. This MUST be in the form of a URI.
|
|
112
|
+
*/
|
|
113
|
+
url?: string
|
|
114
|
+
/**
|
|
115
|
+
* The email address of the contact person/organization. This MUST be in the form of an email address.
|
|
116
|
+
*/
|
|
117
|
+
email?: string
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* License information for the exposed API.
|
|
122
|
+
*/
|
|
123
|
+
export interface LicenseObject {
|
|
124
|
+
/**
|
|
125
|
+
* The license name used for the API.
|
|
126
|
+
*/
|
|
127
|
+
name: string
|
|
128
|
+
/**
|
|
129
|
+
* An [SPDX](https://spdx.org/licenses/) license expression for the API. The `identifier` field is mutually exclusive
|
|
130
|
+
* of the `url` field.
|
|
131
|
+
*/
|
|
132
|
+
identifier?: string
|
|
133
|
+
/**
|
|
134
|
+
* A URI for the license used for the API. This MUST be in the form of a URI. The `url` field is mutually exclusive of
|
|
135
|
+
* the `identifier` field.
|
|
136
|
+
*/
|
|
137
|
+
url?: string
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* An object representing a Server.
|
|
142
|
+
*/
|
|
143
|
+
export interface ServerObject {
|
|
144
|
+
/**
|
|
145
|
+
* A URL to the target host. This URL supports Server Variables and MAY be relative, to indicate that
|
|
146
|
+
* the host location is relative to the location where the document containing the Server Object is being served.
|
|
147
|
+
* Query and fragment MUST NOT be part of this URL. Variable substitutions will be made when a variable is named in
|
|
148
|
+
* `{`braces`}`.
|
|
149
|
+
*/
|
|
150
|
+
url: string
|
|
151
|
+
/**
|
|
152
|
+
* An optional string describing the host designated by the URL. [CommonMark syntax](https://spec.commonmark.org/) MAY
|
|
153
|
+
* be used for rich text representation.
|
|
154
|
+
*/
|
|
155
|
+
description?: string
|
|
156
|
+
/**
|
|
157
|
+
* A map between a variable name and its value. The value is used for substitution in the server's URL template.
|
|
158
|
+
*/
|
|
159
|
+
variables?: Record<string, ServerVariableObject>
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* An object representing a Server Variable for server URL template substitution.
|
|
164
|
+
*/
|
|
165
|
+
export interface ServerVariableObject {
|
|
166
|
+
/**
|
|
167
|
+
* An enumeration of string values to be used if the substitution options are from a limited set. The array MUST NOT
|
|
168
|
+
* be empty.
|
|
169
|
+
*/
|
|
170
|
+
enum?: string[]
|
|
171
|
+
/**
|
|
172
|
+
* The default value to use for substitution, which SHALL be sent if an alternate value is _not_
|
|
173
|
+
* supplied. If the [`enum`](#server-variable-enum) is defined, the value MUST exist in the enum's values. Note that
|
|
174
|
+
* this behavior is different from the [Schema Object](#schema-object)'s `default` keyword, which documents the
|
|
175
|
+
* receiver's behavior rather than inserting the value into the data.
|
|
176
|
+
*/
|
|
177
|
+
default: string
|
|
178
|
+
/**
|
|
179
|
+
* An optional description for the server variable. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for
|
|
180
|
+
* rich text representation.
|
|
181
|
+
*/
|
|
182
|
+
description?: string
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Holds a set of reusable objects for different aspects of the OAS. All objects defined within the Components Object
|
|
187
|
+
* will have no effect on the API unless they are explicitly referenced from outside the Components Object.
|
|
188
|
+
*/
|
|
189
|
+
export interface ComponentsObject {
|
|
190
|
+
/**
|
|
191
|
+
* An object to hold reusable [Schema Objects](#schema-object).
|
|
192
|
+
*/
|
|
193
|
+
schemas?: Record<string, SchemaObject>
|
|
194
|
+
/**
|
|
195
|
+
* [Reference Object](#reference-object)]
|
|
196
|
+
*/
|
|
197
|
+
responses?: Record<string, ResponseObject>
|
|
198
|
+
/**
|
|
199
|
+
* [Reference Object](#reference-object)]
|
|
200
|
+
*/
|
|
201
|
+
parameters?: Record<string, ParameterObject>
|
|
202
|
+
/**
|
|
203
|
+
* [Reference Object](#reference-object)]
|
|
204
|
+
*/
|
|
205
|
+
examples?: Record<string, ExampleObject>
|
|
206
|
+
/**
|
|
207
|
+
* [Reference Object](#reference-object)]
|
|
208
|
+
*/
|
|
209
|
+
requestBodies?: Record<string, RequestBodyObject>
|
|
210
|
+
/**
|
|
211
|
+
* [Reference Object](#reference-object)]
|
|
212
|
+
*/
|
|
213
|
+
headers?: Record<string, HeaderObject>
|
|
214
|
+
/**
|
|
215
|
+
* [Reference Object](#reference-object)]
|
|
216
|
+
*/
|
|
217
|
+
securitySchemes?: Record<string, SecuritySchemeObject>
|
|
218
|
+
/**
|
|
219
|
+
* [Reference Object](#reference-object)]
|
|
220
|
+
*/
|
|
221
|
+
links?: Record<string, LinkObject>
|
|
222
|
+
/**
|
|
223
|
+
* [Reference Object](#reference-object)]
|
|
224
|
+
*/
|
|
225
|
+
callbacks?: Record<string, CallbackObject>
|
|
226
|
+
/**
|
|
227
|
+
* An object to hold reusable [Path Item Objects](#path-item-object).
|
|
228
|
+
*/
|
|
229
|
+
pathItems?: Record<string, PathItemObject>
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Holds the relative paths to the individual endpoints and their operations. The path is appended to the URL from the
|
|
234
|
+
* [Server Object](#server-object) in order to construct the full URL. The Paths Object MAY be empty, due to [Access
|
|
235
|
+
* Control List (ACL) constraints](#security-filtering).
|
|
236
|
+
*/
|
|
237
|
+
export type PathsObject = Record<string, PathItemObject>
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Describes the operations available on a single path. A Path Item MAY be empty, due to [ACL
|
|
241
|
+
* constraints](#security-filtering). The path itself is still exposed to the documentation viewer but they will not
|
|
242
|
+
* know which operations and parameters are available.
|
|
243
|
+
*/
|
|
244
|
+
export interface PathItemObject {
|
|
245
|
+
/**
|
|
246
|
+
* Allows for a referenced definition of this path item. The value MUST be in the form of a URI, and the referenced
|
|
247
|
+
* structure MUST be in the form of a [Path Item Object](#path-item-object). In case a Path Item Object field appears
|
|
248
|
+
* both in the defined object and the referenced object, the behavior is undefined. See the rules for resolving
|
|
249
|
+
* [Relative References](#relative-references-in-api-description-uris). _**Note:** The behavior of `$ref` with
|
|
250
|
+
* adjacent properties is likely to change in future versions of this specification to bring it into closer alignment
|
|
251
|
+
* with the behavior of the [Reference Object](#reference-object)._
|
|
252
|
+
*/
|
|
253
|
+
$ref?: string
|
|
254
|
+
/**
|
|
255
|
+
* An optional string summary, intended to apply to all operations in this path.
|
|
256
|
+
*/
|
|
257
|
+
summary?: string
|
|
258
|
+
/**
|
|
259
|
+
* An optional string description, intended to apply to all operations in this path. [CommonMark
|
|
260
|
+
* syntax](https://spec.commonmark.org/) MAY be used for rich text representation.
|
|
261
|
+
*/
|
|
262
|
+
description?: string
|
|
263
|
+
/**
|
|
264
|
+
* A definition of a GET operation on this path.
|
|
265
|
+
*/
|
|
266
|
+
get?: OperationObject
|
|
267
|
+
/**
|
|
268
|
+
* A definition of a PUT operation on this path.
|
|
269
|
+
*/
|
|
270
|
+
put?: OperationObject
|
|
271
|
+
/**
|
|
272
|
+
* A definition of a POST operation on this path.
|
|
273
|
+
*/
|
|
274
|
+
post?: OperationObject
|
|
275
|
+
/**
|
|
276
|
+
* A definition of a DELETE operation on this path.
|
|
277
|
+
*/
|
|
278
|
+
delete?: OperationObject
|
|
279
|
+
/**
|
|
280
|
+
* A definition of a OPTIONS operation on this path.
|
|
281
|
+
*/
|
|
282
|
+
options?: OperationObject
|
|
283
|
+
/**
|
|
284
|
+
* A definition of a HEAD operation on this path.
|
|
285
|
+
*/
|
|
286
|
+
head?: OperationObject
|
|
287
|
+
/**
|
|
288
|
+
* A definition of a PATCH operation on this path.
|
|
289
|
+
*/
|
|
290
|
+
patch?: OperationObject
|
|
291
|
+
/**
|
|
292
|
+
* A definition of a TRACE operation on this path.
|
|
293
|
+
*/
|
|
294
|
+
trace?: OperationObject
|
|
295
|
+
/**
|
|
296
|
+
* An alternative `servers` array to service all operations in this path. If a `servers` array is specified at the
|
|
297
|
+
* [OpenAPI Object](#oas-servers) level, it will be overridden by this value.
|
|
298
|
+
*/
|
|
299
|
+
servers?: ServerObject[]
|
|
300
|
+
/**
|
|
301
|
+
* [Reference Object](#reference-object)]
|
|
302
|
+
*/
|
|
303
|
+
parameters?: (ParameterObject | ReferenceObject)[]
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* Describes a single API operation on a path.
|
|
308
|
+
*/
|
|
309
|
+
export interface OperationObject {
|
|
310
|
+
/**
|
|
311
|
+
* A list of tags for API documentation control. Tags can be used for logical grouping of operations by resources or
|
|
312
|
+
* any other qualifier.
|
|
313
|
+
*/
|
|
314
|
+
tags?: string[]
|
|
315
|
+
/**
|
|
316
|
+
* A short summary of what the operation does.
|
|
317
|
+
*/
|
|
318
|
+
summary?: string
|
|
319
|
+
/**
|
|
320
|
+
* A verbose explanation of the operation behavior. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for
|
|
321
|
+
* rich text representation.
|
|
322
|
+
*/
|
|
323
|
+
description?: string
|
|
324
|
+
/**
|
|
325
|
+
* Additional external documentation for this operation.
|
|
326
|
+
*/
|
|
327
|
+
externalDocs?: ExternalDocumentationObject
|
|
328
|
+
/**
|
|
329
|
+
* Unique string used to identify the operation. The id MUST be unique among all operations described in the API. The
|
|
330
|
+
* operationId value is **case-sensitive**. Tools and libraries MAY use the operationId to uniquely identify an
|
|
331
|
+
* operation, therefore, it is RECOMMENDED to follow common programming naming conventions.
|
|
332
|
+
*/
|
|
333
|
+
operationId?: string
|
|
334
|
+
/**
|
|
335
|
+
* [Reference Object](#reference-object)]
|
|
336
|
+
*/
|
|
337
|
+
parameters?: (ParameterObject | ReferenceObject)[]
|
|
338
|
+
/**
|
|
339
|
+
* [Reference Object](#reference-object)
|
|
340
|
+
*/
|
|
341
|
+
requestBody?: RequestBodyObject | ReferenceObject
|
|
342
|
+
/**
|
|
343
|
+
* The list of possible responses as they are returned from executing this operation.
|
|
344
|
+
*/
|
|
345
|
+
responses?: ResponsesObject
|
|
346
|
+
/**
|
|
347
|
+
* A map of possible out-of band callbacks related to the parent operation.
|
|
348
|
+
* The key is a unique identifier for the Callback Object.
|
|
349
|
+
* Each value in the map is a Callback Object that describes a request
|
|
350
|
+
* that may be initiated by the API provider and the expected responses.
|
|
351
|
+
*/
|
|
352
|
+
callbacks?: Record<string, CallbackObject>
|
|
353
|
+
/**
|
|
354
|
+
* Declares this operation to be deprecated. Consumers SHOULD refrain from usage of the declared operation. Default
|
|
355
|
+
* value is `false`.
|
|
356
|
+
*/
|
|
357
|
+
deprecated?: boolean
|
|
358
|
+
/**
|
|
359
|
+
* A declaration of which security mechanisms can be used for this operation. The list of values includes alternative
|
|
360
|
+
* Security Requirement Objects that can be used. Only one of the Security Requirement Objects need to be satisfied to
|
|
361
|
+
* authorize a request. To make security optional, an empty security requirement (`{}`) can be included in the array.
|
|
362
|
+
* This definition overrides any declared top-level [`security`](#oas-security). To remove a top-level security
|
|
363
|
+
* declaration, an empty array can be used.
|
|
364
|
+
*/
|
|
365
|
+
security?: SecurityRequirementObject[]
|
|
366
|
+
/**
|
|
367
|
+
* An alternative `servers` array to service this operation. If a `servers` array is specified at the [Path Item
|
|
368
|
+
* Object](#path-item-servers) or [OpenAPI Object](#oas-servers) level, it will be overridden by this value.
|
|
369
|
+
*/
|
|
370
|
+
servers?: ServerObject[]
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* Allows referencing an external resource for extended documentation.
|
|
375
|
+
*/
|
|
376
|
+
export interface ExternalDocumentationObject {
|
|
377
|
+
/**
|
|
378
|
+
* A description of the target documentation. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich
|
|
379
|
+
* text representation.
|
|
380
|
+
*/
|
|
381
|
+
description?: string
|
|
382
|
+
/**
|
|
383
|
+
* The URI for the target documentation. This MUST be in the form of a URI.
|
|
384
|
+
*/
|
|
385
|
+
url: string
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* Describes a single operation parameter. A unique parameter is defined by a combination of a [name](#parameter-name)
|
|
390
|
+
* and [location](#parameter-in). See [Appendix E](#appendix-e-percent-encoding-and-form-media-types) for a detailed
|
|
391
|
+
* examination of percent-encoding concerns, including interactions with the `application/x-www-form-urlencoded` query
|
|
392
|
+
* string format.
|
|
393
|
+
*/
|
|
394
|
+
export interface ParameterObject {
|
|
395
|
+
/**
|
|
396
|
+
* The name of the parameter. Parameter names are _case sensitive_. If [`in`](#parameter-in) is
|
|
397
|
+
* `"path"`, the `name` field MUST correspond to a template expression occurring within the [path](#paths-path) field
|
|
398
|
+
* in the [Paths Object](#paths-object). See [Path Templating](#path-templating) for further information.If
|
|
399
|
+
* [`in`](#parameter-in) is `"header"` and the `name` field is `"Accept"`, `"Content-Type"` or `"Authorization"`, the
|
|
400
|
+
* parameter definition SHALL be ignored.For all other cases, the `name` corresponds to the parameter name used by the
|
|
401
|
+
* [`in`](#parameter-in) field.
|
|
402
|
+
*/
|
|
403
|
+
name: string
|
|
404
|
+
/**
|
|
405
|
+
* The location of the parameter.
|
|
406
|
+
*/
|
|
407
|
+
in: 'query' | 'header' | 'path' | 'cookie'
|
|
408
|
+
/**
|
|
409
|
+
* A brief description of the parameter. This could contain examples of use. [CommonMark
|
|
410
|
+
* syntax](https://spec.commonmark.org/) MAY be used for rich text representation.
|
|
411
|
+
*/
|
|
412
|
+
description?: string
|
|
413
|
+
/**
|
|
414
|
+
* Determines whether this parameter is mandatory. If the [parameter location](#parameter-in) is `"path"`, this field
|
|
415
|
+
* is **REQUIRED** and its value MUST be `true`. Otherwise, the field MAY be included and its default value is
|
|
416
|
+
* `false`.
|
|
417
|
+
*/
|
|
418
|
+
required: boolean
|
|
419
|
+
/**
|
|
420
|
+
* Specifies that a parameter is deprecated and SHOULD be transitioned out of usage. Default value is `false`.
|
|
421
|
+
*/
|
|
422
|
+
deprecated?: boolean
|
|
423
|
+
/**
|
|
424
|
+
* If `true`, clients MAY pass a zero-length string value in place of parameters that would otherwise be omitted
|
|
425
|
+
* entirely, which the server SHOULD interpret as the parameter being unused. Default value is `false`. If
|
|
426
|
+
* [`style`](#parameter-style) is used, and if [behavior is _n/a_ (cannot be serialized)](#style-examples), the value
|
|
427
|
+
* of `allowEmptyValue` SHALL be ignored. Interactions between this field and the parameter's [Schema
|
|
428
|
+
* Object](#schema-object) are implementation-defined. This field is valid only for `query` parameters. Use of this
|
|
429
|
+
* field is NOT RECOMMENDED, and it is likely to be removed in a later revision.
|
|
430
|
+
*/
|
|
431
|
+
allowEmptyValue?: boolean
|
|
432
|
+
/**
|
|
433
|
+
* Describes how the parameter value will be serialized depending on the type of the parameter value. Default values
|
|
434
|
+
* (based on value of `in`): for `"query"` - `"form"`; for `"path"` - `"simple"`; for `"header"` - `"simple"`; for
|
|
435
|
+
* `"cookie"` - `"form"`.
|
|
436
|
+
*/
|
|
437
|
+
style?: string
|
|
438
|
+
/**
|
|
439
|
+
* When this is true, parameter values of type `array` or `object` generate separate parameters for each value of the
|
|
440
|
+
* array or key-value pair of the map. For other types of parameters this field has no effect. When
|
|
441
|
+
* [`style`](#parameter-style) is `"form"`, the default value is `true`. For all other styles, the default value is
|
|
442
|
+
* `false`. Note that despite `false` being the default for `deepObject`, the combination of `false` with `deepObject`
|
|
443
|
+
* is undefined.
|
|
444
|
+
*/
|
|
445
|
+
explode?: boolean
|
|
446
|
+
/**
|
|
447
|
+
* When this is true, parameter values are serialized using reserved expansion, as defined by
|
|
448
|
+
* [RFC6570](https://datatracker.ietf.org/doc/html/rfc6570#section-3.2.3), which allows [RFC3986's reserved character
|
|
449
|
+
* set](https://datatracker.ietf.org/doc/html/rfc3986#section-2.2), as well as percent-encoded triples, to pass
|
|
450
|
+
* through unchanged, while still percent-encoding all other disallowed characters (including `%` outside of
|
|
451
|
+
* percent-encoded triples). Applications are still responsible for percent-encoding reserved characters that are [not
|
|
452
|
+
* allowed in the query string](https://datatracker.ietf.org/doc/html/rfc3986#section-3.4) (`[`, `]`, `#`), or have a
|
|
453
|
+
* special meaning in `application/x-www-form-urlencoded` (`-`, `&`, `+`); see [URL
|
|
454
|
+
* Percent-Encoding](#url-percent-encoding) for details. This field only applies to parameters with an `in` value of
|
|
455
|
+
* `query`. The default value is `false`.
|
|
456
|
+
*/
|
|
457
|
+
allowReserved?: boolean
|
|
458
|
+
/**
|
|
459
|
+
* The schema defining the type used for the parameter.
|
|
460
|
+
*/
|
|
461
|
+
schema?: SchemaObject
|
|
462
|
+
/**
|
|
463
|
+
* Example of the parameter's potential value; see [Working With Examples](#working-with-examples).
|
|
464
|
+
*/
|
|
465
|
+
example?: unknown
|
|
466
|
+
/**
|
|
467
|
+
* [Reference Object](#reference-object)]
|
|
468
|
+
*/
|
|
469
|
+
examples?: Record<string, ExampleObject>
|
|
470
|
+
/**
|
|
471
|
+
* A map containing the representations for the parameter. The key is the media type and the value describes it. The
|
|
472
|
+
* map MUST only contain one entry.
|
|
473
|
+
*/
|
|
474
|
+
content?: Record<string, MediaTypeObject>
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* Describes a single request body.
|
|
479
|
+
*/
|
|
480
|
+
export interface RequestBodyObject {
|
|
481
|
+
/**
|
|
482
|
+
* A brief description of the request body. This could contain examples of use. [CommonMark
|
|
483
|
+
* syntax](https://spec.commonmark.org/) MAY be used for rich text representation.
|
|
484
|
+
*/
|
|
485
|
+
description?: string
|
|
486
|
+
/**
|
|
487
|
+
* The content of the request body. The key is a media type or [media type
|
|
488
|
+
* range](https://tools.ietf.org/html/rfc7231#appendix-D) and the value describes it. The map SHOULD have at least one
|
|
489
|
+
* entry; if it does not, the behavior is implementation-defined. For requests that match multiple keys, only the most
|
|
490
|
+
* specific key is applicable. e.g. `"text/plain"` overrides `"text/*"`
|
|
491
|
+
*/
|
|
492
|
+
content: Record<string, MediaTypeObject>
|
|
493
|
+
/**
|
|
494
|
+
* Determines if the request body is required in the request. Defaults to `false`.
|
|
495
|
+
*/
|
|
496
|
+
required?: boolean
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
/**
|
|
500
|
+
* Each Media Type Object provides schema and examples for the media type identified by its key. When `example` or
|
|
501
|
+
* `examples` are provided, the example SHOULD match the specified schema and be in the correct format as specified by
|
|
502
|
+
* the media type and its encoding. The `example` and `examples` fields are mutually exclusive, and if either is present
|
|
503
|
+
* it SHALL _override_ any `example` in the schema. See [Working With Examples](#working-with-examples) for further
|
|
504
|
+
* guidance regarding the different ways of specifying examples, including non-JSON/YAML values.
|
|
505
|
+
*/
|
|
506
|
+
export interface MediaTypeObject {
|
|
507
|
+
/**
|
|
508
|
+
* The schema defining the content of the request, response, parameter, or header.
|
|
509
|
+
*/
|
|
510
|
+
schema?: SchemaObject
|
|
511
|
+
/**
|
|
512
|
+
* Example of the media type; see [Working With Examples](#working-with-examples).
|
|
513
|
+
*/
|
|
514
|
+
example?: unknown
|
|
515
|
+
/**
|
|
516
|
+
* [Reference Object](#reference-object)]
|
|
517
|
+
*/
|
|
518
|
+
examples?: Record<string, ExampleObject>
|
|
519
|
+
/**
|
|
520
|
+
* A map between a property name and its encoding information. The key, being the property name, MUST exist in the
|
|
521
|
+
* schema as a property. The `encoding` field SHALL only apply to [Request Body Objects](#request-body-object), and
|
|
522
|
+
* only when the media type is `multipart` or `application/x-www-form-urlencoded`. If no Encoding Object is provided
|
|
523
|
+
* for a property, the behavior is determined by the default values documented for the Encoding Object.
|
|
524
|
+
*/
|
|
525
|
+
encoding?: Record<string, EncodingObject>
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
/**
|
|
529
|
+
* A single encoding definition applied to a single schema property. See [Appendix B](#appendix-b-data-type-conversion)
|
|
530
|
+
* for a discussion of converting values of various types to string representations. Properties are correlated with
|
|
531
|
+
* `multipart` parts using the [`name` parameter](https://www.rfc-editor.org/rfc/rfc7578#section-4.2) of
|
|
532
|
+
* `Content-Disposition: form-data`, and with `application/x-www-form-urlencoded` using the query string parameter
|
|
533
|
+
* names. In both cases, their order is implementation-defined. See [Appendix
|
|
534
|
+
* E](#appendix-e-percent-encoding-and-form-media-types) for a detailed examination of percent-encoding concerns for
|
|
535
|
+
* form media types.
|
|
536
|
+
*/
|
|
537
|
+
export interface EncodingObject {
|
|
538
|
+
/**
|
|
539
|
+
* The `Content-Type` for encoding a specific property. The value is a comma-separated list, each element of which is
|
|
540
|
+
* either a specific media type (e.g. `image/png`) or a wildcard media type (e.g. `image/*`). Default value depends on
|
|
541
|
+
* the property type as shown in the table below.
|
|
542
|
+
*/
|
|
543
|
+
contentType?: string
|
|
544
|
+
/**
|
|
545
|
+
* [Reference Object](#reference-object)]
|
|
546
|
+
*/
|
|
547
|
+
headers?: Record<string, HeaderObject>
|
|
548
|
+
/**
|
|
549
|
+
* Describes how a specific property value will be serialized depending on its type. See [Parameter
|
|
550
|
+
* Object](#parameter-object) for details on the [`style`](#parameter-style) field. The behavior follows the same
|
|
551
|
+
* values as `query` parameters, including the default value of `"form"` which applies only when `contentType` is
|
|
552
|
+
* _not_ being used due to one or both of `explode` or `allowReserved` being explicitly specified. Note that the
|
|
553
|
+
* initial `?` used in query strings is not used in `application/x-www-form-urlencoded` message bodies, and MUST be
|
|
554
|
+
* removed (if using an RFC6570 implementation) or simply not added (if constructing the string manually). This field
|
|
555
|
+
* SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded` or
|
|
556
|
+
* `multipart/form-data`. If a value is explicitly defined, then the value of [`contentType`](#encoding-content-type)
|
|
557
|
+
* (implicit or explicit) SHALL be ignored.
|
|
558
|
+
*/
|
|
559
|
+
style?: string
|
|
560
|
+
/**
|
|
561
|
+
* When this is true, property values of type `array` or `object` generate separate parameters for each value of the
|
|
562
|
+
* array, or key-value-pair of the map. For other types of properties this field has no effect. When
|
|
563
|
+
* [`style`](#encoding-style) is `"form"`, the default value is `true`. For all other styles, the default value is
|
|
564
|
+
* `false`. Note that despite `false` being the default for `deepObject`, the combination of `false` with `deepObject`
|
|
565
|
+
* is undefined. This field SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded`
|
|
566
|
+
* or `multipart/form-data`. If a value is explicitly defined, then the value of
|
|
567
|
+
* [`contentType`](#encoding-content-type) (implicit or explicit) SHALL be ignored.
|
|
568
|
+
*/
|
|
569
|
+
explode?: boolean
|
|
570
|
+
/**
|
|
571
|
+
* When this is true, parameter values are serialized using reserved expansion, as defined by
|
|
572
|
+
* [RFC6570](https://datatracker.ietf.org/doc/html/rfc6570#section-3.2.3), which allows [RFC3986's reserved character
|
|
573
|
+
* set](https://datatracker.ietf.org/doc/html/rfc3986#section-2.2), as well as percent-encoded triples, to pass
|
|
574
|
+
* through unchanged, while still percent-encoding all other disallowed characters (including `%` outside of
|
|
575
|
+
* percent-encoded triples). Applications are still responsible for percent-encoding reserved characters that are [not
|
|
576
|
+
* allowed in the query string](https://datatracker.ietf.org/doc/html/rfc3986#section-3.4) (`[`, `]`, `#`), or have a
|
|
577
|
+
* special meaning in `application/x-www-form-urlencoded` (`-`, `&`, `+`); see [URL
|
|
578
|
+
* Percent-Encoding](#url-percent-encoding) for details. The default value is `false`. This field SHALL be ignored if
|
|
579
|
+
* the request body media type is not `application/x-www-form-urlencoded` or `multipart/form-data`. If a value is
|
|
580
|
+
* explicitly defined, then the value of [`contentType`](#encoding-content-type) (implicit or explicit) SHALL be
|
|
581
|
+
* ignored.
|
|
582
|
+
*/
|
|
583
|
+
allowReserved?: boolean
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
/**
|
|
587
|
+
* A container for the expected responses of an operation. The container maps a HTTP response code to the expected
|
|
588
|
+
* response. The documentation is not necessarily expected to cover all possible HTTP response codes because they may
|
|
589
|
+
* not be known in advance. However, documentation is expected to cover a successful operation response and any known
|
|
590
|
+
* errors. The `default` MAY be used as a default Response Object for all HTTP codes that are not covered individually
|
|
591
|
+
* by the Responses Object. The Responses Object MUST contain at least one response code, and if only one response code
|
|
592
|
+
* is provided it SHOULD be the response for a successful operation call.
|
|
593
|
+
*/
|
|
594
|
+
export interface ResponsesObject {
|
|
595
|
+
/**
|
|
596
|
+
* [Reference Object](#reference-object)
|
|
597
|
+
*/
|
|
598
|
+
default?: ResponseObject | ReferenceObject
|
|
599
|
+
/**
|
|
600
|
+
* Pattern: [HTTP Status Code](#http-status-codes) [Reference Object](#reference-object)
|
|
601
|
+
*/
|
|
602
|
+
[pattern: string]: ResponseObject | ReferenceObject | undefined
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
/**
|
|
606
|
+
* Describes a single response from an API operation, including design-time, static `links` to operations based on the
|
|
607
|
+
* response.
|
|
608
|
+
*/
|
|
609
|
+
export interface ResponseObject {
|
|
610
|
+
/**
|
|
611
|
+
* A description of the response. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich
|
|
612
|
+
* text representation.
|
|
613
|
+
*/
|
|
614
|
+
description: string
|
|
615
|
+
/**
|
|
616
|
+
* [Reference Object](#reference-object)]
|
|
617
|
+
*/
|
|
618
|
+
headers?: Record<string, HeaderObject>
|
|
619
|
+
/**
|
|
620
|
+
* A map containing descriptions of potential response payloads. The key is a media type or [media type
|
|
621
|
+
* range](https://tools.ietf.org/html/rfc7231#appendix-D) and the value describes it. For responses that match
|
|
622
|
+
* multiple keys, only the most specific key is applicable. e.g. `"text/plain"` overrides `"text/*"`
|
|
623
|
+
*/
|
|
624
|
+
content?: Record<string, MediaTypeObject>
|
|
625
|
+
/**
|
|
626
|
+
* [Reference Object](#reference-object)]
|
|
627
|
+
*/
|
|
628
|
+
links?: Record<string, LinkObject>
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
/**
|
|
632
|
+
* A map of possible out-of band callbacks related to the parent operation. Each value in the map is a [Path Item
|
|
633
|
+
* Object](#path-item-object) that describes a set of requests that may be initiated by the API provider and the
|
|
634
|
+
* expected responses. The key value used to identify the Path Item Object is an expression, evaluated at runtime, that
|
|
635
|
+
* identifies a URL to use for the callback operation. To describe incoming requests from the API provider independent
|
|
636
|
+
* from another API call, use the [`webhooks`](#oas-webhooks) field.
|
|
637
|
+
*/
|
|
638
|
+
export type CallbackObject = Record<string, PathItemObject>
|
|
639
|
+
|
|
640
|
+
/**
|
|
641
|
+
* An object grouping an internal or external example value with basic `summary` and `description` metadata. This object
|
|
642
|
+
* is typically used in fields named `examples` (plural), and is a [referenceable](#reference-object) alternative to
|
|
643
|
+
* older `example` (singular) fields that do not support referencing or metadata. Examples allow demonstration of the
|
|
644
|
+
* usage of properties, parameters and objects within OpenAPI.
|
|
645
|
+
*/
|
|
646
|
+
export interface ExampleObject {
|
|
647
|
+
/**
|
|
648
|
+
* Short description for the example.
|
|
649
|
+
*/
|
|
650
|
+
summary?: string
|
|
651
|
+
/**
|
|
652
|
+
* Long description for the example. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text
|
|
653
|
+
* representation.
|
|
654
|
+
*/
|
|
655
|
+
description?: string
|
|
656
|
+
/**
|
|
657
|
+
* Embedded literal example. The `value` field and `externalValue` field are mutually exclusive. To represent examples
|
|
658
|
+
* of media types that cannot naturally represented in JSON or YAML, use a string value to contain the example,
|
|
659
|
+
* escaping where necessary.
|
|
660
|
+
*/
|
|
661
|
+
value?: unknown
|
|
662
|
+
/**
|
|
663
|
+
* A URI that identifies the literal example. This provides the capability to reference examples that cannot easily be
|
|
664
|
+
* included in JSON or YAML documents. The `value` field and `externalValue` field are mutually exclusive. See the
|
|
665
|
+
* rules for resolving [Relative References](#relative-references-in-api-description-uris).
|
|
666
|
+
*/
|
|
667
|
+
externalValue?: string
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
/**
|
|
671
|
+
* The Link Object represents a possible design-time link for a response. The presence of a link does not guarantee the
|
|
672
|
+
* caller's ability to successfully invoke it, rather it provides a known relationship and traversal mechanism between
|
|
673
|
+
* responses and other operations. Unlike _dynamic_ links (i.e. links provided **in** the response payload), the OAS
|
|
674
|
+
* linking mechanism does not require link information in the runtime response. For computing links and providing
|
|
675
|
+
* instructions to execute them, a [runtime expression](#runtime-expressions) is used for accessing values in an
|
|
676
|
+
* operation and using them as parameters while invoking the linked operation.
|
|
677
|
+
*/
|
|
678
|
+
export interface LinkObject {
|
|
679
|
+
/**
|
|
680
|
+
* A URI reference to an OAS operation. This field is mutually exclusive of the `operationId` field, and MUST point to
|
|
681
|
+
* an [Operation Object](#operation-object). Relative `operationRef` values MAY be used to locate an existing
|
|
682
|
+
* [Operation Object](#operation-object) in the OpenAPI Description.
|
|
683
|
+
*/
|
|
684
|
+
operationRef?: string
|
|
685
|
+
/**
|
|
686
|
+
* The name of an _existing_, resolvable OAS operation, as defined with a unique `operationId`. This field is mutually
|
|
687
|
+
* exclusive of the `operationRef` field.
|
|
688
|
+
*/
|
|
689
|
+
operationId?: string
|
|
690
|
+
/**
|
|
691
|
+
* [{expression}](#runtime-expressions)]
|
|
692
|
+
*/
|
|
693
|
+
parameters?: Record<string, unknown>
|
|
694
|
+
/**
|
|
695
|
+
* [{expression}](#runtime-expressions)
|
|
696
|
+
*/
|
|
697
|
+
requestBody?: unknown
|
|
698
|
+
/**
|
|
699
|
+
* A description of the link. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text
|
|
700
|
+
* representation.
|
|
701
|
+
*/
|
|
702
|
+
description?: string
|
|
703
|
+
/**
|
|
704
|
+
* A server object to be used by the target operation.
|
|
705
|
+
*/
|
|
706
|
+
server?: ServerObject
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
/**
|
|
710
|
+
* Describes a single header for [HTTP responses](#response-headers) and for [individual parts in `multipart`
|
|
711
|
+
* representations](#encoding-headers); see the relevant [Response Object](#response-object) and [Encoding
|
|
712
|
+
* Object](#encoding-object) documentation for restrictions on which headers can be described. The Header Object follows
|
|
713
|
+
* the structure of the [Parameter Object](#parameter-object), including determining its serialization strategy based on
|
|
714
|
+
* whether `schema` or `content` is present, with the following changes:
|
|
715
|
+
*
|
|
716
|
+
* 1. `name` MUST NOT be specified, it is given in the corresponding `headers` map.
|
|
717
|
+
* 2. `in` MUST NOT be specified, it is implicitly in `header`.
|
|
718
|
+
* 3. All traits that are affected by the location MUST be applicable to a location of `header` (for example,
|
|
719
|
+
* [`style`](#parameter-style)). This means that `allowEmptyValue` and `allowReserved` MUST NOT be used, and `style`,
|
|
720
|
+
* if used, MUST be limited to `"simple"`.
|
|
721
|
+
* 4. `name` MUST NOT be specified, it is given in the corresponding `headers` map.
|
|
722
|
+
* 5. `in` MUST NOT be specified, it is implicitly in `header`.
|
|
723
|
+
* 6. All traits that are affected by the location MUST be applicable to a location of `header` (for example,
|
|
724
|
+
* [`style`](#parameter-style)). This means that `allowEmptyValue` and `allowReserved` MUST NOT be used, and `style`,
|
|
725
|
+
* if used, MUST be limited to `"simple"`.
|
|
726
|
+
*/
|
|
727
|
+
export interface HeaderObject {
|
|
728
|
+
/**
|
|
729
|
+
* A brief description of the header. This could contain examples of use. [CommonMark
|
|
730
|
+
* syntax](https://spec.commonmark.org/) MAY be used for rich text representation.
|
|
731
|
+
*/
|
|
732
|
+
description?: string
|
|
733
|
+
/**
|
|
734
|
+
* Determines whether this header is mandatory. The default value is `false`.
|
|
735
|
+
*/
|
|
736
|
+
required?: boolean
|
|
737
|
+
/**
|
|
738
|
+
* Specifies that the header is deprecated and SHOULD be transitioned out of usage. Default value is `false`.
|
|
739
|
+
*/
|
|
740
|
+
deprecated?: boolean
|
|
741
|
+
/**
|
|
742
|
+
* Describes how the header value will be serialized. The default (and only legal value for headers) is `"simple"`.
|
|
743
|
+
*/
|
|
744
|
+
style?: 'simple'
|
|
745
|
+
/**
|
|
746
|
+
* When this is true, header values of type `array` or `object` generate a single header whose value is a
|
|
747
|
+
* comma-separated list of the array items or key-value pairs of the map, see [Style Examples](#style-examples). For
|
|
748
|
+
* other data types this field has no effect. The default value is `false`.
|
|
749
|
+
*/
|
|
750
|
+
explode?: boolean
|
|
751
|
+
/**
|
|
752
|
+
* The schema defining the type used for the header.
|
|
753
|
+
*/
|
|
754
|
+
schema?: SchemaObject
|
|
755
|
+
/**
|
|
756
|
+
* Example of the header's potential value; see [Working With Examples](#working-with-examples).
|
|
757
|
+
*/
|
|
758
|
+
example?: unknown
|
|
759
|
+
/**
|
|
760
|
+
* [Reference Object](#reference-object)]
|
|
761
|
+
*/
|
|
762
|
+
examples?: Record<string, ExampleObject>
|
|
763
|
+
/**
|
|
764
|
+
* A map containing the representations for the header. The key is the media type and the value describes it. The map
|
|
765
|
+
* MUST only contain one entry.
|
|
766
|
+
*/
|
|
767
|
+
content?: Record<string, MediaTypeObject>
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
/**
|
|
771
|
+
* Adds metadata to a single tag that is used by the [Operation Object](#operation-object). It is not mandatory to have
|
|
772
|
+
* a Tag Object per tag defined in the Operation Object instances.
|
|
773
|
+
*/
|
|
774
|
+
export interface TagObject {
|
|
775
|
+
/**
|
|
776
|
+
* The name of the tag.
|
|
777
|
+
*/
|
|
778
|
+
name: string
|
|
779
|
+
/**
|
|
780
|
+
* A description for the tag. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text
|
|
781
|
+
* representation.
|
|
782
|
+
*/
|
|
783
|
+
description?: string
|
|
784
|
+
/**
|
|
785
|
+
* Additional external documentation for this tag.
|
|
786
|
+
*/
|
|
787
|
+
externalDocs?: ExternalDocumentationObject
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
/**
|
|
791
|
+
* A simple object to allow referencing other components in the OpenAPI Description, internally and externally. The
|
|
792
|
+
* `$ref` string value contains a URI [RFC3986](https://tools.ietf.org/html/rfc3986), which identifies the value being
|
|
793
|
+
* referenced. See the rules for resolving [Relative References](#relative-references-in-api-description-uris).
|
|
794
|
+
*/
|
|
795
|
+
export interface ReferenceObject {
|
|
796
|
+
/**
|
|
797
|
+
* The reference identifier. This MUST be in the form of a URI.
|
|
798
|
+
*/
|
|
799
|
+
$ref: string
|
|
800
|
+
/**
|
|
801
|
+
* A short summary which by default SHOULD override that of the referenced component. If the referenced object-type
|
|
802
|
+
* does not allow a `summary` field, then this field has no effect.
|
|
803
|
+
*/
|
|
804
|
+
summary?: string
|
|
805
|
+
/**
|
|
806
|
+
* A description which by default SHOULD override that of the referenced component. [CommonMark
|
|
807
|
+
* syntax](https://spec.commonmark.org/) MAY be used for rich text representation. If the referenced object-type does
|
|
808
|
+
* not allow a `description` field, then this field has no effect.
|
|
809
|
+
*/
|
|
810
|
+
description?: string
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
/**
|
|
814
|
+
* The Schema Object allows the definition of input and output data types. These types can be objects, but also
|
|
815
|
+
* primitives and arrays. This object is a superset of the [JSON Schema Specification Draft
|
|
816
|
+
* 2020-12](https://tools.ietf.org/html/draft-bhutton-json-schema-00). The empty schema (which allows any instance to
|
|
817
|
+
* validate) MAY be represented by the boolean value `true` and a schema which allows no instance to validate MAY be
|
|
818
|
+
* represented by the boolean value `false`. For more information about the keywords, see [JSON Schema
|
|
819
|
+
* Core](https://tools.ietf.org/html/draft-bhutton-json-schema-00) and [JSON Schema
|
|
820
|
+
* Validation](https://tools.ietf.org/html/draft-bhutton-json-schema-validation-00). Unless stated otherwise, the
|
|
821
|
+
* keyword definitions follow those of JSON Schema and do not add any additional semantics; this includes keywords such
|
|
822
|
+
* as `$schema`, `$id`, `$ref`, and `$dynamicRef` being URIs rather than URLs. Where JSON Schema indicates that behavior
|
|
823
|
+
* is defined by the application (e.g. for annotations), OAS also defers the definition of semantics to the application
|
|
824
|
+
* consuming the OpenAPI document.
|
|
825
|
+
*/
|
|
826
|
+
export type SchemaObject = JSONSchema & {
|
|
827
|
+
/**
|
|
828
|
+
* Adds support for polymorphism. The discriminator is used to determine which of a set of schemas a payload is
|
|
829
|
+
* expected to satisfy. See [Composition and Inheritance](#composition-and-inheritance-polymorphism) for more
|
|
830
|
+
* details.
|
|
831
|
+
*/
|
|
832
|
+
discriminator?: DiscriminatorObject
|
|
833
|
+
/**
|
|
834
|
+
* This MAY be used only on property schemas. It has no effect on root schemas. Adds additional metadata to describe
|
|
835
|
+
* the XML representation of this property.
|
|
836
|
+
*/
|
|
837
|
+
xml?: XMLObject
|
|
838
|
+
/**
|
|
839
|
+
* Additional external documentation for this schema.
|
|
840
|
+
*/
|
|
841
|
+
externalDocs?: ExternalDocumentationObject
|
|
842
|
+
/**
|
|
843
|
+
* A free-form field to include an example of an instance for this schema. To represent examples that cannot be
|
|
844
|
+
* naturally represented in JSON or YAML, a string value can be used to contain the example with escaping where
|
|
845
|
+
* necessary. **Deprecated:** The `example` field has been deprecated in favor of the JSON Schema `examples` keyword.
|
|
846
|
+
* Use of `example` is discouraged, and later versions of this specification may remove it.
|
|
847
|
+
*/
|
|
848
|
+
example?: unknown
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
/**
|
|
852
|
+
* When request bodies or response payloads may be one of a number of different schemas, a Discriminator Object gives a
|
|
853
|
+
* hint about the expected schema of the document. This hint can be used to aid in serialization, deserialization, and
|
|
854
|
+
* validation. The Discriminator Object does this by implicitly or explicitly associating the possible values of a named
|
|
855
|
+
* property with alternative schemas. Note that `discriminator` MUST NOT change the validation outcome of the schema.
|
|
856
|
+
*/
|
|
857
|
+
export interface DiscriminatorObject {
|
|
858
|
+
/**
|
|
859
|
+
* The name of the property in the payload that will hold the discriminating value. This property SHOULD
|
|
860
|
+
* be required in the payload schema, as the behavior when the property is absent is undefined.
|
|
861
|
+
*/
|
|
862
|
+
propertyName: string
|
|
863
|
+
/**
|
|
864
|
+
* An object to hold mappings between payload values and schema names or URI references.
|
|
865
|
+
*/
|
|
866
|
+
mapping?: Record<string, string>
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
/**
|
|
870
|
+
* A metadata object that allows for more fine-tuned XML model definitions. When using arrays, XML element names are
|
|
871
|
+
* _not_ inferred (for singular/plural forms) and the `name` field SHOULD be used to add that information. See examples
|
|
872
|
+
* for expected behavior.
|
|
873
|
+
*/
|
|
874
|
+
export interface XMLObject {
|
|
875
|
+
/**
|
|
876
|
+
* Replaces the inferred name of the element/attribute used for the described schema property. For the root schema
|
|
877
|
+
* object of a [schema component](#components-schemas), the inferred name is the name of the component; for other
|
|
878
|
+
* schemas the name is inferred from the parent property name. When defined within `items`, it will affect the name of
|
|
879
|
+
* the individual XML elements within the list. When defined alongside `type` being `"array"` (outside the `items`),
|
|
880
|
+
* it will affect the wrapping element if and only if `wrapped` is `true`. If `wrapped` is `false`, it will be
|
|
881
|
+
* ignored.
|
|
882
|
+
*/
|
|
883
|
+
name?: string
|
|
884
|
+
/**
|
|
885
|
+
* The URI of the namespace definition. Value MUST be in the form of a non-relative URI.
|
|
886
|
+
*/
|
|
887
|
+
namespace?: string
|
|
888
|
+
/**
|
|
889
|
+
* The prefix to be used for the [name](#xml-name).
|
|
890
|
+
*/
|
|
891
|
+
prefix?: string
|
|
892
|
+
/**
|
|
893
|
+
* Declares whether the property definition translates to an attribute instead of an element. Default value is
|
|
894
|
+
* `false`.
|
|
895
|
+
*/
|
|
896
|
+
attribute?: boolean
|
|
897
|
+
/**
|
|
898
|
+
* MAY be used only for an array definition. Signifies whether the array is wrapped (for example, `) or unwrapped (`).
|
|
899
|
+
* Default value is `false`. The definition takes effect only when defined alongside `type` being `"array"` (outside
|
|
900
|
+
* the `items`).
|
|
901
|
+
*/
|
|
902
|
+
wrapped?: boolean
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
/**
|
|
906
|
+
* Defines a security scheme that can be used by the operations. Supported schemes are HTTP authentication, an API key
|
|
907
|
+
* (either as a header, a cookie parameter or as a query parameter), mutual TLS (use of a client certificate), OAuth2's
|
|
908
|
+
* common flows (implicit, password, client credentials and authorization code) as defined in
|
|
909
|
+
* [RFC6749](https://tools.ietf.org/html/rfc6749), and [[OpenID-Connect-Core]]. Please note that as of 2020, the
|
|
910
|
+
* implicit flow is about to be deprecated by [OAuth 2.0 Security Best Current
|
|
911
|
+
* Practice](https://tools.ietf.org/html/draft-ietf-oauth-security-topics). Recommended for most use cases is
|
|
912
|
+
* Authorization Code Grant flow with PKCE.
|
|
913
|
+
*/
|
|
914
|
+
|
|
915
|
+
/**
|
|
916
|
+
* Allows configuration of the supported OAuth Flows.
|
|
917
|
+
*/
|
|
918
|
+
export interface OAuthFlowsObject {
|
|
919
|
+
/**
|
|
920
|
+
* Configuration for the OAuth Implicit flow
|
|
921
|
+
*/
|
|
922
|
+
implicit?: ImplicitOAuthFlowObject
|
|
923
|
+
/**
|
|
924
|
+
* Configuration for the OAuth Resource Owner Password flow
|
|
925
|
+
*/
|
|
926
|
+
password?: PasswordOAuthFlowObject
|
|
927
|
+
/**
|
|
928
|
+
* Configuration for the OAuth Client Credentials flow. Previously called `application` in OpenAPI 2.0.
|
|
929
|
+
*/
|
|
930
|
+
clientCredentials?: ClientCredentialsOAuthFlowObject
|
|
931
|
+
/**
|
|
932
|
+
* Configuration for the OAuth Authorization Code flow. Previously called `accessCode` in OpenAPI 2.0.
|
|
933
|
+
*/
|
|
934
|
+
authorizationCode?: AuthorizationCodeOAuthFlowObject
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
/**
|
|
938
|
+
* Configuration details for a supported OAuth Flow
|
|
939
|
+
*/
|
|
940
|
+
export interface OAuthFlowObject {
|
|
941
|
+
/**
|
|
942
|
+
* The authorization URL to be used for this flow. This MUST be in the form of a URL. The OAuth2 standard requires the
|
|
943
|
+
* use of TLS. Applies To:
|
|
944
|
+
*
|
|
945
|
+
* - Implicit
|
|
946
|
+
* - AuthorizationCode
|
|
947
|
+
*/
|
|
948
|
+
authorizationUrl?: string
|
|
949
|
+
/**
|
|
950
|
+
* The device authorization URL to be used for this flow. This MUST be in the form of a URL. The OAuth2 standard
|
|
951
|
+
* requires the use of TLS. Applies To:
|
|
952
|
+
*
|
|
953
|
+
* - Password
|
|
954
|
+
* - ClientCredentials
|
|
955
|
+
* - AuthorizationCode
|
|
956
|
+
*/
|
|
957
|
+
tokenUrl?: string
|
|
958
|
+
/**
|
|
959
|
+
* The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL. The OAuth2 standard requires
|
|
960
|
+
* the use of TLS.
|
|
961
|
+
*/
|
|
962
|
+
refreshUrl?: string
|
|
963
|
+
/**
|
|
964
|
+
* The available scopes for the OAuth2 security scheme. A map between the scope name and a short description for it.
|
|
965
|
+
* The map MAY be empty.
|
|
966
|
+
*/
|
|
967
|
+
scopes: Record<string, string>
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
export interface ImplicitOAuthFlowObject extends OAuthFlowObject {
|
|
971
|
+
authorizationUrl: string
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
export interface AuthorizationCodeOAuthFlowObject extends OAuthFlowObject {
|
|
975
|
+
authorizationUrl: string
|
|
976
|
+
tokenUrl: string
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
export interface PasswordOAuthFlowObject extends OAuthFlowObject {
|
|
980
|
+
tokenUrl: string
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
export interface ClientCredentialsOAuthFlowObject extends OAuthFlowObject {
|
|
984
|
+
tokenUrl: string
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
/**
|
|
988
|
+
* Lists the required security schemes to execute this operation. The name used for each property MUST correspond to a
|
|
989
|
+
* security scheme declared in the [Security Schemes](#components-security-schemes) under the [Components
|
|
990
|
+
* Object](#components-object). A Security Requirement Object MAY refer to multiple security schemes in which case all
|
|
991
|
+
* schemes MUST be satisfied for a request to be authorized. This enables support for scenarios where multiple query
|
|
992
|
+
* parameters or HTTP headers are required to convey security information. When the `security` field is defined on the
|
|
993
|
+
* [OpenAPI Object](#openapi-object) or [Operation Object](#operation-object) and contains multiple Security Requirement
|
|
994
|
+
* Objects, only one of the entries in the list needs to be satisfied to authorize the request. This enables support for
|
|
995
|
+
* scenarios where the API allows multiple, independent security schemes. An empty Security Requirement Object (`{}`)
|
|
996
|
+
* indicates anonymous access is supported.
|
|
997
|
+
*/
|
|
998
|
+
export type SecurityRequirementObject = Record<string, string[]>
|
|
999
|
+
|
|
1000
|
+
export type SecuritySchemeObject =
|
|
1001
|
+
| HttpSecurityScheme
|
|
1002
|
+
| ApiKeySecurityScheme
|
|
1003
|
+
| OAuth2SecurityScheme
|
|
1004
|
+
| OpenIdSecurityScheme
|
|
1005
|
+
|
|
1006
|
+
interface SecuritySchemeBase {
|
|
1007
|
+
description?: string
|
|
1008
|
+
deprecated?: boolean
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
export interface HttpSecurityScheme extends SecuritySchemeBase {
|
|
1012
|
+
type: 'http'
|
|
1013
|
+
/**
|
|
1014
|
+
* The name of the HTTP Authentication scheme to be used in the Authorization header as defined in [RFC9110] Section
|
|
1015
|
+
* 16.4.1. The values used SHOULD be registered in the IANA Authentication Scheme registry. The value is
|
|
1016
|
+
* case-insensitive, as defined in [RFC9110] Section 11.1.
|
|
1017
|
+
*/
|
|
1018
|
+
scheme: 'Basic' | 'Bearer' | string
|
|
1019
|
+
/**
|
|
1020
|
+
* A hint to the client to identify how the bearer token is formatted. Bearer tokens are usually generated by an
|
|
1021
|
+
* authorization server, so this information is primarily for documentation purposes.
|
|
1022
|
+
*/
|
|
1023
|
+
bearerFormat?: string
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
export interface ApiKeySecurityScheme extends SecuritySchemeBase {
|
|
1027
|
+
type: 'apiKey'
|
|
1028
|
+
/**
|
|
1029
|
+
* The name of the header, query or cookie parameter to be used.
|
|
1030
|
+
*/
|
|
1031
|
+
name: string
|
|
1032
|
+
/**
|
|
1033
|
+
* The location of the API key.
|
|
1034
|
+
*/
|
|
1035
|
+
in: 'query' | 'header' | 'cookie'
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
export interface OAuth2SecurityScheme extends SecuritySchemeBase {
|
|
1039
|
+
type: 'oauth2'
|
|
1040
|
+
/**
|
|
1041
|
+
* An object containing configuration information for the flow types supported.
|
|
1042
|
+
*/
|
|
1043
|
+
flows: OAuthFlowsObject
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
export interface OpenIdSecurityScheme extends SecuritySchemeBase {
|
|
1047
|
+
type: 'openIdConnect'
|
|
1048
|
+
/**
|
|
1049
|
+
* OpenID Connect Discovery URL as defined by [OpenID-Connect-Discovery-1.0].
|
|
1050
|
+
*/
|
|
1051
|
+
openIdConnectUrl: string
|
|
1052
|
+
}
|