oas 24.5.3 → 24.7.0
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/README.md +59 -58
- package/dist/analyzer/index.cjs +5 -5
- package/dist/analyzer/index.js +4 -4
- package/dist/{chunk-A3OZNHPE.cjs → chunk-3CBAAWG2.cjs} +44 -41
- package/dist/chunk-3CBAAWG2.cjs.map +1 -0
- package/dist/{chunk-WCDZQK62.cjs → chunk-6QHUSSDH.cjs} +1 -1
- package/dist/chunk-6QHUSSDH.cjs.map +1 -0
- package/dist/{chunk-FPDZNUSO.js → chunk-7KGYHFQ2.js} +9 -6
- package/dist/chunk-7KGYHFQ2.js.map +1 -0
- package/dist/{chunk-WN67YB26.js → chunk-BALOBQT5.js} +2 -2
- package/dist/{chunk-7QI6SQMI.js → chunk-D6YGEKAS.js} +32 -3
- package/dist/chunk-D6YGEKAS.js.map +1 -0
- package/dist/{chunk-VJPJCQC3.cjs → chunk-OCUXVRES.cjs} +11 -11
- package/dist/{chunk-PGOMVKMR.cjs → chunk-TKJRRBN7.cjs} +35 -6
- package/dist/chunk-TKJRRBN7.cjs.map +1 -0
- package/dist/{chunk-MHJ3WXXI.js → chunk-XPA5KLS5.js} +1 -1
- package/dist/chunk-XPA5KLS5.js.map +1 -0
- package/dist/{extensions--QIs0QPB.d.ts → extensions-CxJyLZaY.d.ts} +11 -3
- package/dist/{extensions-BLw7Bdmp.d.cts → extensions-qzNCq0DK.d.cts} +11 -3
- package/dist/extensions.d.cts +1 -1
- package/dist/extensions.d.ts +1 -1
- package/dist/index.cjs +5 -5
- package/dist/index.d.cts +14 -1
- package/dist/index.d.ts +14 -1
- package/dist/index.js +4 -4
- package/dist/operation/index.cjs +4 -4
- package/dist/operation/index.d.cts +1 -1
- package/dist/operation/index.d.ts +1 -1
- package/dist/operation/index.js +3 -3
- package/dist/operation/lib/get-parameters-as-json-schema.cjs +3 -3
- package/dist/operation/lib/get-parameters-as-json-schema.d.cts +1 -1
- package/dist/operation/lib/get-parameters-as-json-schema.d.ts +1 -1
- package/dist/operation/lib/get-parameters-as-json-schema.js +2 -2
- package/dist/reducer/index.cjs.map +1 -1
- package/dist/reducer/index.d.cts +3 -3
- package/dist/reducer/index.d.ts +3 -3
- package/dist/reducer/index.js.map +1 -1
- package/dist/types.cjs +2 -2
- package/dist/types.d.cts +13 -1
- package/dist/types.d.ts +13 -1
- package/dist/types.js +1 -1
- package/dist/utils.cjs +3 -3
- package/dist/utils.d.cts +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +2 -2
- package/package.json +2 -2
- package/dist/chunk-7QI6SQMI.js.map +0 -1
- package/dist/chunk-A3OZNHPE.cjs.map +0 -1
- package/dist/chunk-FPDZNUSO.js.map +0 -1
- package/dist/chunk-MHJ3WXXI.js.map +0 -1
- package/dist/chunk-PGOMVKMR.cjs.map +0 -1
- package/dist/chunk-WCDZQK62.cjs.map +0 -1
- /package/dist/{chunk-WN67YB26.js.map → chunk-BALOBQT5.js.map} +0 -0
- /package/dist/{chunk-VJPJCQC3.cjs.map → chunk-OCUXVRES.cjs.map} +0 -0
package/README.md
CHANGED
|
@@ -76,13 +76,13 @@ Because this library has full TypeScript types and docblocks this README is not
|
|
|
76
76
|
<!-- prettier-ignore-start -->
|
|
77
77
|
| Method | Description |
|
|
78
78
|
| :--- | :--- |
|
|
79
|
-
|
|
|
80
|
-
|
|
|
81
|
-
|
|
|
82
|
-
|
|
|
83
|
-
|
|
|
84
|
-
|
|
|
85
|
-
|
|
|
79
|
+
| `.dereference()` | Dereference the current OpenAPI definition. Note that this will ignore circular references. |
|
|
80
|
+
| `.getCircularReferences()` | Retrieve an array of any circular `$ref` pointer that may exist wthin the OpenAPI definition. Note that this requires `.dereference()` to be called first. |
|
|
81
|
+
| `.getDefinition()` | Retrieve the OpenAPI definition that was fed into the `Oas` constructor. |
|
|
82
|
+
| `.getTags()` | Retrieve an array of all tags that exist within the API definition and are set on operations. |
|
|
83
|
+
| `.getPaths()` | Retrieve every operation that exists within the API definition. This returns an array of instances of the `Operation` class. |
|
|
84
|
+
| `.getVersion()` | Retrieve the OpenAPI version that this API definition is targeted for. |
|
|
85
|
+
| `.getWebhooks()` | Retrieve every webhook operation that exists within the API definition. This returns an array of instances of the `Webhook` class. |
|
|
86
86
|
| `#init()` | An alternative for `new Oas()` that you can use if the typing on the `Oas` constructor gives you trouble. Typing OpenAPI definitions is hard! |
|
|
87
87
|
<!-- prettier-ignore-end -->
|
|
88
88
|
|
|
@@ -91,10 +91,11 @@ Because this library has full TypeScript types and docblocks this README is not
|
|
|
91
91
|
<!-- prettier-ignore-start -->
|
|
92
92
|
| Method | Description |
|
|
93
93
|
| :--- | :--- |
|
|
94
|
-
|
|
|
95
|
-
|
|
|
96
|
-
|
|
|
97
|
-
|
|
|
94
|
+
| `.findOperation()` | Discover an operation with the current OpenAPI definition that matches a given URL and HTTP method. |
|
|
95
|
+
| `.findOperationWithoutMethod()` | Like `.findOperation()` but without supplying an HTTP method. |
|
|
96
|
+
| `.getOperation()` | Same as `.findOperation()` but this returns an instance of the `Operation` class. |
|
|
97
|
+
| `.getOperationById()` | Retrieve an operation in an OpenAPI definition by an `operationId`. |
|
|
98
|
+
| `.operation()` | Retrieve an instance of the `Operation` or `Webhook` classes for a given path and HTTP method. |
|
|
98
99
|
<!-- prettier-ignore-end -->
|
|
99
100
|
|
|
100
101
|
#### Servers
|
|
@@ -102,12 +103,12 @@ Because this library has full TypeScript types and docblocks this README is not
|
|
|
102
103
|
<!-- prettier-ignore-start -->
|
|
103
104
|
| Method | Description |
|
|
104
105
|
| :--- | :--- |
|
|
105
|
-
|
|
|
106
|
-
|
|
|
107
|
-
|
|
|
108
|
-
|
|
|
109
|
-
|
|
|
110
|
-
|
|
|
106
|
+
| `.defaultVariables()` | Retrieve the default server variables for a specific server URL, while also potentially factoring in user data. You can specify user variable data to the `Oas` constructor. Check out [Using Variables in Documentation](https://docs.readme.com/docs/user-data-options#using-variables-in-documentation) for some background on how we use this. |
|
|
107
|
+
| `.replaceUrl()` | Replace a given templated server URL with supplied server variable data. |
|
|
108
|
+
| `.splitUrl()` | Chunk out a specific server URL into its individual parts. |
|
|
109
|
+
| `.splitVariables` | Chunk out a given URL and if it matches a server URL in the OpenAPI file, extract the matched server variables that are present in the URL. |
|
|
110
|
+
| `.url()` | Retrieve a fully composed server URL. You can optionally select which of the defined server URLs to use as well as specify server variable information. |
|
|
111
|
+
| `.variables()` | Retrieve all server variables that a specific server URL in the definition has. |
|
|
111
112
|
<!-- prettier-ignore-end -->
|
|
112
113
|
|
|
113
114
|
#### Specification Extensions
|
|
@@ -118,10 +119,10 @@ Because this library has full TypeScript types and docblocks this README is not
|
|
|
118
119
|
<!-- prettier-ignore-start -->
|
|
119
120
|
| Method | Description |
|
|
120
121
|
| :--- | :--- |
|
|
121
|
-
|
|
|
122
|
-
|
|
|
123
|
-
|
|
|
124
|
-
|
|
|
122
|
+
| `.getExtension()` | Retrieve a given [specification extension](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specificationExtensions) if it exists at the root of the API definition. |
|
|
123
|
+
| `.hasExtension()` | Determine if a given [specification extension](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specificationExtensions) exists on the root of the API definition. |
|
|
124
|
+
| `.validateExtension()` | Determine if a given [ReadMe custom OpenAPI extension](https://docs.readme.com/docs/openapi-extensions) is valid or not. |
|
|
125
|
+
| `.validateExtensions()` | Validate all of our [ReadMe custom OpenAPI extension](https://docs.readme.com/docs/openapi-extensions), throwing exceptions when necessary. |
|
|
125
126
|
<!-- prettier-ignore-end -->
|
|
126
127
|
|
|
127
128
|
Information about ReadMe's supported OpenAPI extensions at https://docs.readme.com/docs/openapi-extensions.
|
|
@@ -131,14 +132,14 @@ Information about ReadMe's supported OpenAPI extensions at https://docs.readme.c
|
|
|
131
132
|
<!-- prettier-ignore-start -->
|
|
132
133
|
| Method | Description |
|
|
133
134
|
| :--- | :--- |
|
|
134
|
-
|
|
|
135
|
+
| `.getAuth()` | Retrieve the appropriate API keys for the current OpenAPI definition from an object of user data. Check out [Using Variables in Documentation](https://docs.readme.com/docs/user-data-options#using-variables-in-documentation) for some background on how we use this. |
|
|
135
136
|
<!-- prettier-ignore-end -->
|
|
136
137
|
|
|
137
138
|
---
|
|
138
139
|
|
|
139
140
|
### Operations
|
|
140
141
|
|
|
141
|
-
For your convenience, the entrypoint into the `Operation` class should generally always be through
|
|
142
|
+
For your convenience, the entrypoint into the `Operation` class should generally always be through `.operation()`. For example:
|
|
142
143
|
|
|
143
144
|
```js
|
|
144
145
|
import Oas from 'oas';
|
|
@@ -153,19 +154,19 @@ const operation = petstore.operation('/pet', 'post');
|
|
|
153
154
|
<!-- prettier-ignore-start -->
|
|
154
155
|
| Method | Description |
|
|
155
156
|
| :--- | :--- |
|
|
156
|
-
|
|
|
157
|
-
|
|
|
158
|
-
|
|
|
159
|
-
|
|
|
160
|
-
|
|
|
161
|
-
|
|
|
162
|
-
|
|
|
163
|
-
|
|
|
164
|
-
|
|
|
165
|
-
|
|
|
166
|
-
|
|
|
167
|
-
|
|
|
168
|
-
|
|
|
157
|
+
| `.getContentType()` | Retrieve the primary request body content type. If multiple are present, prefer whichever is JSON-compliant. |
|
|
158
|
+
| `.getDescription()` | Retrieve the `description` that's set on this operation. This supports common descriptions that may be set at the [path item level](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#pathItemObject). |
|
|
159
|
+
| `.getOperationId()` | Retrieve the `operationId` that's present on the operation, and if one is not present one will be created based off the method + path and returned instead. |
|
|
160
|
+
| `.hasOperationId()` | Determine if the operation has an `operationId` present. |
|
|
161
|
+
| `.isDeprecated()` | Determine if this operation is marked as deprecated. |
|
|
162
|
+
| `.isFormUrlEncoded()` | Determine if this operation requires its payload to be delivered as `application/x-www-form-urlencoded`. |
|
|
163
|
+
| `.isJson()` | Determine if this operation requires its payload to be delivered as JSON. |
|
|
164
|
+
| `.isMultipart()` | Determine if this operation requires its data to be sent as a multipart payload. |
|
|
165
|
+
| `.isXml()` | Determine if this operation requires its data to be sent as XML. |
|
|
166
|
+
| `.getExampleGroups()` | Returns an object with groups of all example definitions (body/header/query/path/response/etc.). The examples are grouped by their key when defined via the `examples` map. |
|
|
167
|
+
| `.getHeaders()` | Retrieve all headers that can either be sent for or returned from this operation. This includes header-based authentication schemes, common header parameters, and request body and response content types. |
|
|
168
|
+
| `.getSummary()` | Retrieve the `summary` that's set on this operation. This supports common summaries that may be set at the [path item level](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#pathItemObject). |
|
|
169
|
+
| `.getTags()` | Retrieve all tags, and [their metadata](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#tagObject), that exist on this operation. |
|
|
169
170
|
<!-- prettier-ignore-end -->
|
|
170
171
|
|
|
171
172
|
#### Callbacks
|
|
@@ -173,10 +174,10 @@ const operation = petstore.operation('/pet', 'post');
|
|
|
173
174
|
<!-- prettier-ignore-start -->
|
|
174
175
|
| Method | Description |
|
|
175
176
|
| :--- | :--- |
|
|
176
|
-
|
|
|
177
|
-
|
|
|
178
|
-
|
|
|
179
|
-
|
|
|
177
|
+
| `.getCallback()` | Retrieve a specific callback on this operation. This will return an instance of the `Callback` class. |
|
|
178
|
+
| `.getCallbackExamples()` | Retrieve an array of all calback examples that this operation has defined. |
|
|
179
|
+
| `.getCallbacks()` | Retrieve all callbacks that this operation has. Similar to `.getPaths()` returning an array of `Operation` instances this will return an array of `Callback` instances. |
|
|
180
|
+
| `.hasCallbacks()` | Determine if this operation has any callbacks defined. |
|
|
180
181
|
<!-- prettier-ignore-end -->
|
|
181
182
|
|
|
182
183
|
#### Parameters
|
|
@@ -187,10 +188,10 @@ const operation = petstore.operation('/pet', 'post');
|
|
|
187
188
|
<!-- prettier-ignore-start -->
|
|
188
189
|
| Method | Description |
|
|
189
190
|
| :--- | :--- |
|
|
190
|
-
|
|
|
191
|
-
|
|
|
192
|
-
|
|
|
193
|
-
|
|
|
191
|
+
| `.getParameters()` | Retrieve all parameters that may be used with on this operation. |
|
|
192
|
+
| `.getParametersAsJSONSchema()` | Retrieve and convert the operations parameters into an array of JSON Schema schemas for each available type of parameter available on the operation: `path`, `query`, `body`, `cookie`, `formData`, and `header`. |
|
|
193
|
+
| `.hasParameters()` | Determine if the operation has any parameters to send. |
|
|
194
|
+
| `.hasRequiredParameters()` | Determine if any of the parameters on this operation are required. |
|
|
194
195
|
<!-- prettier-ignore-end -->
|
|
195
196
|
|
|
196
197
|
#### Request Body
|
|
@@ -198,10 +199,10 @@ const operation = petstore.operation('/pet', 'post');
|
|
|
198
199
|
<!-- prettier-ignore-start -->
|
|
199
200
|
| Method | Description |
|
|
200
201
|
| :--- | :--- |
|
|
201
|
-
|
|
|
202
|
-
|
|
|
203
|
-
|
|
|
204
|
-
|
|
|
202
|
+
| `.getRequestBody()` | Retrieve the raw request body object for a given content type. If none is specified it will return either the first that's JSON-like, or the first defined. |
|
|
203
|
+
| `.getRequestBodyExamples()` | Retrieve an array of all request body examples that this operation has defined. |
|
|
204
|
+
| `.getRequestBodyMediaTypes()` | Retrieve a list of all the media/content types that the operation can accept a request body payload for. |
|
|
205
|
+
| `.hasRequestBody()` | Determine if this operation has a request body defined. |
|
|
205
206
|
<!-- prettier-ignore-end -->
|
|
206
207
|
|
|
207
208
|
#### Responses
|
|
@@ -209,11 +210,11 @@ const operation = petstore.operation('/pet', 'post');
|
|
|
209
210
|
<!-- prettier-ignore-start -->
|
|
210
211
|
| Method | Description |
|
|
211
212
|
| :--- | :--- |
|
|
212
|
-
|
|
|
213
|
-
|
|
|
214
|
-
|
|
|
215
|
-
|
|
|
216
|
-
|
|
|
213
|
+
| `.getResponseAsJSONSchema()` | Retrive and convert a response on this operation into JSON Schema. |
|
|
214
|
+
| `.getResponseByStatusCode()` | Retrieve the raw response object for a given status code. |
|
|
215
|
+
| `.getResponseExamples()` | Retrieve an array of all response examples that this operation has defined. |
|
|
216
|
+
| `.getResponseStatusCodes()` | Retrieve all status codes that this operation may respond with. |
|
|
217
|
+
| `.hasRequiredRequestBody()` | Determine if this operation has a required request body. |
|
|
217
218
|
<!-- prettier-ignore-end -->
|
|
218
219
|
|
|
219
220
|
#### Security
|
|
@@ -221,9 +222,9 @@ const operation = petstore.operation('/pet', 'post');
|
|
|
221
222
|
<!-- prettier-ignore-start -->
|
|
222
223
|
| Method | Description |
|
|
223
224
|
| :--- | :--- |
|
|
224
|
-
|
|
|
225
|
-
|
|
|
226
|
-
|
|
|
225
|
+
| `.getSecurity()` | Return all security requirements that are applicable for either this operation, or if the operation has none specific to it, then for the entire API. |
|
|
226
|
+
| `.getSecurityWithTypes()` | Return a collection of all security schemes applicable to this operation (using `.getSecurity()`), grouped by how the security should be handled (either AND or OR auth requirements). |
|
|
227
|
+
| `.prepareSecurity` | Return an object of every security scheme that _can_ be used on this operation, indexed by the type of security scheme it is (eg. `Basic`, `OAuth2`, `APIKey`, etc.). |
|
|
227
228
|
<!-- prettier-ignore-end -->
|
|
228
229
|
|
|
229
230
|
#### Specification Extensions
|
|
@@ -231,7 +232,7 @@ const operation = petstore.operation('/pet', 'post');
|
|
|
231
232
|
<!-- prettier-ignore-start -->
|
|
232
233
|
| Method | Description |
|
|
233
234
|
| :--- | :--- |
|
|
234
|
-
|
|
|
235
|
+
| `.hasExtension()` | Determine if a given [specification extension](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specificationExtensions) exists on this operation. |
|
|
235
236
|
<!-- prettier-ignore-end -->
|
|
236
237
|
|
|
237
238
|
Information about ReadMe's supported OpenAPI extensions at https://docs.readme.com/docs/openapi-extensions.
|
|
@@ -245,7 +246,7 @@ The `Callback` class inherits `Operation` so every API available on instances of
|
|
|
245
246
|
<!-- prettier-ignore-start -->
|
|
246
247
|
| Method | Description |
|
|
247
248
|
| :--- | :--- |
|
|
248
|
-
|
|
|
249
|
+
| `.getIdentifier()` | Retrieve the primary identifier of this callback. |
|
|
249
250
|
<!-- prettier-ignore-end -->
|
|
250
251
|
|
|
251
252
|
### Webhooks
|
package/dist/analyzer/index.cjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
3
|
+
var _chunkTKJRRBN7cjs = require('../chunk-TKJRRBN7.cjs');
|
|
4
|
+
require('../chunk-3CBAAWG2.cjs');
|
|
5
5
|
require('../chunk-VIIXOUMH.cjs');
|
|
6
|
-
require('../chunk-
|
|
6
|
+
require('../chunk-OCUXVRES.cjs');
|
|
7
7
|
require('../chunk-XWUEF5DO.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
var _chunkW6GBV2JTcjs = require('../chunk-W6GBV2JT.cjs');
|
|
12
|
-
require('../chunk-
|
|
12
|
+
require('../chunk-6QHUSSDH.cjs');
|
|
13
13
|
|
|
14
14
|
// src/analyzer/queries/openapi.ts
|
|
15
15
|
function additionalProperties(definition) {
|
|
@@ -19,7 +19,7 @@ function callbacks(definition) {
|
|
|
19
19
|
return _chunkW6GBV2JTcjs.query.call(void 0, ["$.components.callbacks", "$.paths..callbacks"], definition).map((res) => _chunkW6GBV2JTcjs.refizePointer.call(void 0, res.pointer));
|
|
20
20
|
}
|
|
21
21
|
async function circularRefs(definition) {
|
|
22
|
-
const oas = new (0,
|
|
22
|
+
const oas = new (0, _chunkTKJRRBN7cjs.Oas)(JSON.parse(JSON.stringify(definition)));
|
|
23
23
|
await oas.dereference();
|
|
24
24
|
const results = oas.getCircularReferences();
|
|
25
25
|
results.sort();
|
package/dist/analyzer/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Oas
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-D6YGEKAS.js";
|
|
4
|
+
import "../chunk-7KGYHFQ2.js";
|
|
5
5
|
import "../chunk-SITXIAYE.js";
|
|
6
|
-
import "../chunk-
|
|
6
|
+
import "../chunk-BALOBQT5.js";
|
|
7
7
|
import "../chunk-JCLIAFTG.js";
|
|
8
8
|
import {
|
|
9
9
|
query,
|
|
10
10
|
refizePointer
|
|
11
11
|
} from "../chunk-CKC36IL7.js";
|
|
12
|
-
import "../chunk-
|
|
12
|
+
import "../chunk-XPA5KLS5.js";
|
|
13
13
|
|
|
14
14
|
// src/analyzer/queries/openapi.ts
|
|
15
15
|
function additionalProperties(definition) {
|
|
@@ -10,13 +10,13 @@ var _chunkVIIXOUMHcjs = require('./chunk-VIIXOUMH.cjs');
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _chunkOCUXVREScjs = require('./chunk-OCUXVRES.cjs');
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
var _chunkXWUEF5DOcjs = require('./chunk-XWUEF5DO.cjs');
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
var
|
|
19
|
+
var _chunk6QHUSSDHcjs = require('./chunk-6QHUSSDH.cjs');
|
|
20
20
|
|
|
21
21
|
// src/operation/lib/dedupe-common-parameters.ts
|
|
22
22
|
function dedupeCommonParameters(parameters, commonParameters) {
|
|
@@ -24,7 +24,7 @@ function dedupeCommonParameters(parameters, commonParameters) {
|
|
|
24
24
|
return !parameters.find((param2) => {
|
|
25
25
|
if (param.name && param2.name) {
|
|
26
26
|
return param.name === param2.name && param.in === param2.in;
|
|
27
|
-
} else if (
|
|
27
|
+
} else if (_chunk6QHUSSDHcjs.isRef.call(void 0, param) && _chunk6QHUSSDHcjs.isRef.call(void 0, param2)) {
|
|
28
28
|
return param.$ref === param2.$ref;
|
|
29
29
|
}
|
|
30
30
|
return false;
|
|
@@ -48,7 +48,7 @@ function usesPolymorphism(schema) {
|
|
|
48
48
|
return false;
|
|
49
49
|
}
|
|
50
50
|
function objectify(thing) {
|
|
51
|
-
if (!
|
|
51
|
+
if (!_chunkOCUXVREScjs.isObject.call(void 0, thing)) {
|
|
52
52
|
return {};
|
|
53
53
|
}
|
|
54
54
|
return thing;
|
|
@@ -256,7 +256,7 @@ function getMediaTypeExamples(mediaType, mediaTypeObject, opts = {}) {
|
|
|
256
256
|
}
|
|
257
257
|
}
|
|
258
258
|
if (mediaTypeObject.schema) {
|
|
259
|
-
if (!
|
|
259
|
+
if (!_chunkOCUXVREScjs.matches_mimetype_default.xml(mediaType)) {
|
|
260
260
|
return [
|
|
261
261
|
{
|
|
262
262
|
value: samples_default(JSON.parse(JSON.stringify(mediaTypeObject.schema)), opts)
|
|
@@ -272,7 +272,7 @@ function getResponseExamples(operation) {
|
|
|
272
272
|
return Object.keys(operation.responses || {}).map((status) => {
|
|
273
273
|
const response = operation.responses[status];
|
|
274
274
|
let onlyHeaders = false;
|
|
275
|
-
if (
|
|
275
|
+
if (_chunk6QHUSSDHcjs.isRef.call(void 0, response)) {
|
|
276
276
|
return false;
|
|
277
277
|
}
|
|
278
278
|
const mediaTypes = {};
|
|
@@ -447,7 +447,7 @@ function getRequestBodyExamples(operation) {
|
|
|
447
447
|
}
|
|
448
448
|
|
|
449
449
|
// src/operation/lib/get-response-as-json-schema.ts
|
|
450
|
-
var isJSON =
|
|
450
|
+
var isJSON = _chunkOCUXVREScjs.matches_mimetype_default.json;
|
|
451
451
|
function buildHeadersSchema(response, opts) {
|
|
452
452
|
const headers = response.headers;
|
|
453
453
|
const headersSchema = {
|
|
@@ -457,7 +457,7 @@ function buildHeadersSchema(response, opts) {
|
|
|
457
457
|
Object.keys(headers).forEach((key) => {
|
|
458
458
|
if (headers[key] && headers[key].schema) {
|
|
459
459
|
const header = headers[key];
|
|
460
|
-
headersSchema.properties[key] =
|
|
460
|
+
headersSchema.properties[key] = _chunkOCUXVREScjs.toJSONSchema.call(void 0, header.schema, {
|
|
461
461
|
addEnumsToDescriptions: true,
|
|
462
462
|
transformer: opts.transformer
|
|
463
463
|
});
|
|
@@ -501,7 +501,7 @@ function getResponseAsJSONSchema(operation, api, statusCode, opts) {
|
|
|
501
501
|
}
|
|
502
502
|
for (let i = 0; i < contentTypes.length; i++) {
|
|
503
503
|
if (isJSON(contentTypes[i])) {
|
|
504
|
-
return
|
|
504
|
+
return _chunkOCUXVREScjs.toJSONSchema.call(void 0, _chunkOCUXVREScjs.cloneObject.call(void 0, content[contentTypes[i]].schema), {
|
|
505
505
|
addEnumsToDescriptions: true,
|
|
506
506
|
refLogger,
|
|
507
507
|
transformer: opts.transformer
|
|
@@ -509,7 +509,7 @@ function getResponseAsJSONSchema(operation, api, statusCode, opts) {
|
|
|
509
509
|
}
|
|
510
510
|
}
|
|
511
511
|
const contentType = contentTypes.shift();
|
|
512
|
-
return
|
|
512
|
+
return _chunkOCUXVREScjs.toJSONSchema.call(void 0, _chunkOCUXVREScjs.cloneObject.call(void 0, content[contentType].schema), {
|
|
513
513
|
addEnumsToDescriptions: true,
|
|
514
514
|
refLogger,
|
|
515
515
|
transformer: opts.transformer
|
|
@@ -517,15 +517,15 @@ function getResponseAsJSONSchema(operation, api, statusCode, opts) {
|
|
|
517
517
|
}
|
|
518
518
|
const foundSchema = getPreferredSchema(response.content);
|
|
519
519
|
if (foundSchema) {
|
|
520
|
-
const schema =
|
|
520
|
+
const schema = _chunkOCUXVREScjs.cloneObject.call(void 0, foundSchema);
|
|
521
521
|
const schemaWrapper = {
|
|
522
522
|
// If there's no `type` then the root schema is a circular `$ref` that we likely won't be
|
|
523
523
|
// able to render so instead of generating a JSON Schema with an `undefined` type we should
|
|
524
524
|
// default to `string` so there's at least *something* the end-user can interact with.
|
|
525
525
|
type: foundSchema.type || "string",
|
|
526
|
-
schema:
|
|
526
|
+
schema: _chunkOCUXVREScjs.isPrimitive.call(void 0, schema) ? schema : {
|
|
527
527
|
...schema,
|
|
528
|
-
$schema:
|
|
528
|
+
$schema: _chunkOCUXVREScjs.getSchemaVersionString.call(void 0, schema, api)
|
|
529
529
|
},
|
|
530
530
|
label: "Response body"
|
|
531
531
|
};
|
|
@@ -592,23 +592,23 @@ var Operation = class {
|
|
|
592
592
|
this.contentType = types[0];
|
|
593
593
|
}
|
|
594
594
|
types.forEach((t) => {
|
|
595
|
-
if (
|
|
595
|
+
if (_chunkOCUXVREScjs.matches_mimetype_default.json(t)) {
|
|
596
596
|
this.contentType = t;
|
|
597
597
|
}
|
|
598
598
|
});
|
|
599
599
|
return this.contentType;
|
|
600
600
|
}
|
|
601
601
|
isFormUrlEncoded() {
|
|
602
|
-
return
|
|
602
|
+
return _chunkOCUXVREScjs.matches_mimetype_default.formUrlEncoded(this.getContentType());
|
|
603
603
|
}
|
|
604
604
|
isMultipart() {
|
|
605
|
-
return
|
|
605
|
+
return _chunkOCUXVREScjs.matches_mimetype_default.multipart(this.getContentType());
|
|
606
606
|
}
|
|
607
607
|
isJson() {
|
|
608
|
-
return
|
|
608
|
+
return _chunkOCUXVREScjs.matches_mimetype_default.json(this.getContentType());
|
|
609
609
|
}
|
|
610
610
|
isXml() {
|
|
611
|
-
return
|
|
611
|
+
return _chunkOCUXVREScjs.matches_mimetype_default.xml(this.getContentType());
|
|
612
612
|
}
|
|
613
613
|
/**
|
|
614
614
|
* Returns an array of all security requirements associated wtih this operation. If none are
|
|
@@ -676,7 +676,8 @@ var Operation = class {
|
|
|
676
676
|
type,
|
|
677
677
|
security: {
|
|
678
678
|
...security,
|
|
679
|
-
_key: key
|
|
679
|
+
_key: key,
|
|
680
|
+
_requirements: requirement[key]
|
|
680
681
|
}
|
|
681
682
|
};
|
|
682
683
|
});
|
|
@@ -701,8 +702,10 @@ var Operation = class {
|
|
|
701
702
|
return;
|
|
702
703
|
if (!prev[security.type])
|
|
703
704
|
prev[security.type] = [];
|
|
704
|
-
const exists = prev[security.type].
|
|
705
|
-
if (exists
|
|
705
|
+
const exists = prev[security.type].some((sec) => sec._key === security.security._key);
|
|
706
|
+
if (!exists) {
|
|
707
|
+
if (_optionalChain([security, 'access', _31 => _31.security, 'optionalAccess', _32 => _32._requirements]))
|
|
708
|
+
delete security.security._requirements;
|
|
706
709
|
prev[security.type].push(security.security);
|
|
707
710
|
}
|
|
708
711
|
});
|
|
@@ -778,7 +781,7 @@ var Operation = class {
|
|
|
778
781
|
*/
|
|
779
782
|
getOperationId(opts = {}) {
|
|
780
783
|
function sanitize(id) {
|
|
781
|
-
return id.replace(_optionalChain([opts, 'optionalAccess',
|
|
784
|
+
return id.replace(_optionalChain([opts, 'optionalAccess', _33 => _33.camelCase]) || _optionalChain([opts, 'optionalAccess', _34 => _34.friendlyCase]) ? /[^a-zA-Z0-9_]/g : /[^a-zA-Z0-9]/g, "-").replace(/--+/g, "-").replace(/^-|-$/g, "");
|
|
782
785
|
}
|
|
783
786
|
let operationId;
|
|
784
787
|
if (this.hasOperationId()) {
|
|
@@ -787,8 +790,8 @@ var Operation = class {
|
|
|
787
790
|
operationId = sanitize(this.path).toLowerCase();
|
|
788
791
|
}
|
|
789
792
|
const method = this.method.toLowerCase();
|
|
790
|
-
if (_optionalChain([opts, 'optionalAccess',
|
|
791
|
-
if (_optionalChain([opts, 'optionalAccess',
|
|
793
|
+
if (_optionalChain([opts, 'optionalAccess', _35 => _35.camelCase]) || _optionalChain([opts, 'optionalAccess', _36 => _36.friendlyCase])) {
|
|
794
|
+
if (_optionalChain([opts, 'optionalAccess', _37 => _37.friendlyCase])) {
|
|
792
795
|
operationId = operationId.replaceAll("_", " ");
|
|
793
796
|
if (!this.hasOperationId()) {
|
|
794
797
|
operationId = operationId.replace(/[^a-zA-Z0-9_]+(.)/g, (_, chr) => ` ${chr}`).split(" ").filter((word, i, arr) => word !== arr[i - 1]).join(" ");
|
|
@@ -861,8 +864,8 @@ var Operation = class {
|
|
|
861
864
|
*
|
|
862
865
|
*/
|
|
863
866
|
getParameters() {
|
|
864
|
-
let parameters = _optionalChain([this, 'access',
|
|
865
|
-
const commonParams = _optionalChain([this, 'access',
|
|
867
|
+
let parameters = _optionalChain([this, 'access', _38 => _38.schema, 'optionalAccess', _39 => _39.parameters]) || [];
|
|
868
|
+
const commonParams = _optionalChain([this, 'access', _40 => _40.api, 'optionalAccess', _41 => _41.paths, 'optionalAccess', _42 => _42[this.path], 'optionalAccess', _43 => _43.parameters]) || [];
|
|
866
869
|
if (commonParams.length) {
|
|
867
870
|
parameters = parameters.concat(dedupeCommonParameters(parameters, commonParams) || []);
|
|
868
871
|
}
|
|
@@ -881,7 +884,7 @@ var Operation = class {
|
|
|
881
884
|
*
|
|
882
885
|
*/
|
|
883
886
|
getParametersAsJSONSchema(opts = {}) {
|
|
884
|
-
return
|
|
887
|
+
return _chunkOCUXVREScjs.getParametersAsJSONSchema.call(void 0, this, this.api, {
|
|
885
888
|
includeDiscriminatorMappingRefs: true,
|
|
886
889
|
transformer: (s) => s,
|
|
887
890
|
...opts
|
|
@@ -924,7 +927,7 @@ var Operation = class {
|
|
|
924
927
|
return [];
|
|
925
928
|
}
|
|
926
929
|
const requestBody = this.schema.requestBody;
|
|
927
|
-
if (
|
|
930
|
+
if (_chunk6QHUSSDHcjs.isRef.call(void 0, requestBody)) {
|
|
928
931
|
return [];
|
|
929
932
|
}
|
|
930
933
|
return Object.keys(requestBody.content);
|
|
@@ -938,7 +941,7 @@ var Operation = class {
|
|
|
938
941
|
return false;
|
|
939
942
|
}
|
|
940
943
|
const requestBody = this.schema.requestBody;
|
|
941
|
-
if (
|
|
944
|
+
if (_chunk6QHUSSDHcjs.isRef.call(void 0, requestBody)) {
|
|
942
945
|
return false;
|
|
943
946
|
}
|
|
944
947
|
if (requestBody.required) {
|
|
@@ -963,7 +966,7 @@ var Operation = class {
|
|
|
963
966
|
return false;
|
|
964
967
|
}
|
|
965
968
|
const requestBody = this.schema.requestBody;
|
|
966
|
-
if (
|
|
969
|
+
if (_chunk6QHUSSDHcjs.isRef.call(void 0, requestBody)) {
|
|
967
970
|
return false;
|
|
968
971
|
}
|
|
969
972
|
if (mediaType) {
|
|
@@ -975,7 +978,7 @@ var Operation = class {
|
|
|
975
978
|
let availableMediaType;
|
|
976
979
|
const mediaTypes = this.getRequestBodyMediaTypes();
|
|
977
980
|
mediaTypes.forEach((mt) => {
|
|
978
|
-
if (!availableMediaType &&
|
|
981
|
+
if (!availableMediaType && _chunkOCUXVREScjs.matches_mimetype_default.json(mt)) {
|
|
979
982
|
availableMediaType = mt;
|
|
980
983
|
}
|
|
981
984
|
});
|
|
@@ -1019,7 +1022,7 @@ var Operation = class {
|
|
|
1019
1022
|
return false;
|
|
1020
1023
|
}
|
|
1021
1024
|
const response = this.schema.responses[statusCode];
|
|
1022
|
-
if (
|
|
1025
|
+
if (_chunk6QHUSSDHcjs.isRef.call(void 0, response)) {
|
|
1023
1026
|
return false;
|
|
1024
1027
|
}
|
|
1025
1028
|
return response;
|
|
@@ -1070,9 +1073,9 @@ var Operation = class {
|
|
|
1070
1073
|
Object.keys(this.schema.callbacks).forEach((callback) => {
|
|
1071
1074
|
Object.keys(this.schema.callbacks[callback]).forEach((expression) => {
|
|
1072
1075
|
const cb = this.schema.callbacks[callback];
|
|
1073
|
-
if (!
|
|
1076
|
+
if (!_chunk6QHUSSDHcjs.isRef.call(void 0, cb)) {
|
|
1074
1077
|
const exp = cb[expression];
|
|
1075
|
-
if (!
|
|
1078
|
+
if (!_chunk6QHUSSDHcjs.isRef.call(void 0, exp)) {
|
|
1076
1079
|
Object.keys(exp).forEach((method) => {
|
|
1077
1080
|
if (!_chunkVIIXOUMHcjs.supportedMethods.has(method))
|
|
1078
1081
|
return;
|
|
@@ -1115,7 +1118,7 @@ var Operation = class {
|
|
|
1115
1118
|
* @deprecated Use `oas.getExtension(extension, operation)` instead.
|
|
1116
1119
|
*/
|
|
1117
1120
|
getExtension(extension) {
|
|
1118
|
-
return _optionalChain([this, 'access',
|
|
1121
|
+
return _optionalChain([this, 'access', _44 => _44.schema, 'optionalAccess', _45 => _45[extension]]);
|
|
1119
1122
|
}
|
|
1120
1123
|
/**
|
|
1121
1124
|
* Returns an object with groups of all example definitions (body/header/query/path/response/etc.).
|
|
@@ -1152,7 +1155,7 @@ var Callback = class extends Operation {
|
|
|
1152
1155
|
return this.identifier;
|
|
1153
1156
|
}
|
|
1154
1157
|
getSummary() {
|
|
1155
|
-
if (_optionalChain([this, 'access',
|
|
1158
|
+
if (_optionalChain([this, 'access', _46 => _46.schema, 'optionalAccess', _47 => _47.summary]) && typeof this.schema.summary === "string") {
|
|
1156
1159
|
return this.schema.summary;
|
|
1157
1160
|
} else if (this.parentSchema.summary && typeof this.parentSchema.summary === "string") {
|
|
1158
1161
|
return this.parentSchema.summary;
|
|
@@ -1160,7 +1163,7 @@ var Callback = class extends Operation {
|
|
|
1160
1163
|
return void 0;
|
|
1161
1164
|
}
|
|
1162
1165
|
getDescription() {
|
|
1163
|
-
if (_optionalChain([this, 'access',
|
|
1166
|
+
if (_optionalChain([this, 'access', _48 => _48.schema, 'optionalAccess', _49 => _49.description]) && typeof this.schema.description === "string") {
|
|
1164
1167
|
return this.schema.description;
|
|
1165
1168
|
} else if (this.parentSchema.description && typeof this.parentSchema.description === "string") {
|
|
1166
1169
|
return this.parentSchema.description;
|
|
@@ -1168,7 +1171,7 @@ var Callback = class extends Operation {
|
|
|
1168
1171
|
return void 0;
|
|
1169
1172
|
}
|
|
1170
1173
|
getParameters() {
|
|
1171
|
-
let parameters = _optionalChain([this, 'access',
|
|
1174
|
+
let parameters = _optionalChain([this, 'access', _50 => _50.schema, 'optionalAccess', _51 => _51.parameters]) || [];
|
|
1172
1175
|
const commonParams = this.parentSchema.parameters || [];
|
|
1173
1176
|
if (commonParams.length) {
|
|
1174
1177
|
parameters = parameters.concat(dedupeCommonParameters(parameters, commonParams) || []);
|
|
@@ -1178,7 +1181,7 @@ var Callback = class extends Operation {
|
|
|
1178
1181
|
};
|
|
1179
1182
|
var Webhook = class extends Operation {
|
|
1180
1183
|
getSummary() {
|
|
1181
|
-
if (_optionalChain([this, 'access',
|
|
1184
|
+
if (_optionalChain([this, 'access', _52 => _52.schema, 'optionalAccess', _53 => _53.summary]) && typeof this.schema.summary === "string") {
|
|
1182
1185
|
return this.schema.summary;
|
|
1183
1186
|
} else if (this.api.webhooks[this.path].summary && typeof this.api.webhooks[this.path].summary === "string") {
|
|
1184
1187
|
return this.api.webhooks[this.path].summary;
|
|
@@ -1186,7 +1189,7 @@ var Webhook = class extends Operation {
|
|
|
1186
1189
|
return void 0;
|
|
1187
1190
|
}
|
|
1188
1191
|
getDescription() {
|
|
1189
|
-
if (_optionalChain([this, 'access',
|
|
1192
|
+
if (_optionalChain([this, 'access', _54 => _54.schema, 'optionalAccess', _55 => _55.description]) && typeof this.schema.description === "string") {
|
|
1190
1193
|
return this.schema.description;
|
|
1191
1194
|
} else if (this.api.webhooks[this.path].description && typeof this.api.webhooks[this.path].description === "string") {
|
|
1192
1195
|
return this.api.webhooks[this.path].description;
|
|
@@ -1212,4 +1215,4 @@ exports.Operation = Operation; exports.Callback = Callback; exports.Webhook = We
|
|
|
1212
1215
|
* @license Apache-2.0
|
|
1213
1216
|
* @see {@link https://github.com/swagger-api/swagger-ui/blob/master/src/core/plugins/samples/fn.js}
|
|
1214
1217
|
*/
|
|
1215
|
-
//# sourceMappingURL=chunk-
|
|
1218
|
+
//# sourceMappingURL=chunk-3CBAAWG2.cjs.map
|