oas 31.1.2 → 32.1.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 +5 -0
- package/dist/analyzer/index.cjs +6 -7
- package/dist/analyzer/index.cjs.map +1 -1
- package/dist/analyzer/index.js +5 -6
- package/dist/analyzer/index.js.map +1 -1
- package/dist/{chunk-BRYRBTD7.cjs → chunk-4OCSFLJO.cjs} +537 -385
- package/dist/chunk-4OCSFLJO.cjs.map +1 -0
- package/dist/{chunk-HGVFNEKW.js → chunk-5245ZLBC.js} +476 -324
- package/dist/chunk-5245ZLBC.js.map +1 -0
- package/dist/{chunk-B5WP4BJM.cjs → chunk-7RDMAMMI.cjs} +511 -240
- package/dist/chunk-7RDMAMMI.cjs.map +1 -0
- package/dist/{chunk-LSH3X5NA.js → chunk-DVD6RE2D.js} +85 -48
- package/dist/chunk-DVD6RE2D.js.map +1 -0
- package/dist/{chunk-5EP6HY2E.js → chunk-HYH37HS2.js} +494 -223
- package/dist/chunk-HYH37HS2.js.map +1 -0
- package/dist/{chunk-7MARUOFZ.js → chunk-MNOEMVCF.js} +2 -2
- package/dist/chunk-MNOEMVCF.js.map +1 -0
- package/dist/{chunk-SYZDNSG6.cjs → chunk-WXNEGGLJ.cjs} +104 -67
- package/dist/chunk-WXNEGGLJ.cjs.map +1 -0
- package/dist/chunk-YPR7YTHM.cjs +24 -0
- package/dist/chunk-YPR7YTHM.cjs.map +1 -0
- package/dist/extensions.d.cts +3 -1
- package/dist/extensions.d.ts +3 -1
- package/dist/get-parameters-as-json-schema-BH81ZOnw.d.ts +36 -0
- package/dist/get-parameters-as-json-schema-DM1vWIEM.d.cts +36 -0
- package/dist/index.cjs +5 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +947 -7
- package/dist/index.d.ts +946 -8
- package/dist/index.js +4 -5
- package/dist/operation/index.cjs +4 -5
- package/dist/operation/index.cjs.map +1 -1
- package/dist/operation/index.d.cts +3 -1
- package/dist/operation/index.d.ts +3 -1
- package/dist/operation/index.js +3 -4
- package/dist/reducer/index.cjs +16 -18
- package/dist/reducer/index.cjs.map +1 -1
- package/dist/reducer/index.js +4 -6
- package/dist/reducer/index.js.map +1 -1
- package/dist/types.cjs +2 -2
- package/dist/types.d.cts +9 -1
- package/dist/types.d.ts +9 -1
- package/dist/types.js +1 -1
- package/dist/utils.cjs +4 -4
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +17 -3
- package/dist/utils.d.ts +17 -3
- package/dist/utils.js +5 -5
- package/package.json +3 -6
- package/dist/chunk-5EP6HY2E.js.map +0 -1
- package/dist/chunk-7MARUOFZ.js.map +0 -1
- package/dist/chunk-B5WP4BJM.cjs.map +0 -1
- package/dist/chunk-BRYRBTD7.cjs.map +0 -1
- package/dist/chunk-HGVFNEKW.js.map +0 -1
- package/dist/chunk-LSH3X5NA.js.map +0 -1
- package/dist/chunk-O3GIPZLC.cjs +0 -9
- package/dist/chunk-O3GIPZLC.cjs.map +0 -1
- package/dist/chunk-SYZDNSG6.cjs.map +0 -1
- package/dist/chunk-VA3NKXX7.js +0 -9
- package/dist/chunk-VA3NKXX7.js.map +0 -1
- package/dist/chunk-VQBEI5WI.cjs +0 -24
- package/dist/chunk-VQBEI5WI.cjs.map +0 -1
- package/dist/extensions-9XckV6aO.d.cts +0 -899
- package/dist/extensions-gq53-7Ux.d.ts +0 -899
- package/dist/operation/lib/get-parameters-as-json-schema.cjs +0 -11
- package/dist/operation/lib/get-parameters-as-json-schema.cjs.map +0 -1
- package/dist/operation/lib/get-parameters-as-json-schema.d.cts +0 -4
- package/dist/operation/lib/get-parameters-as-json-schema.d.ts +0 -4
- package/dist/operation/lib/get-parameters-as-json-schema.js +0 -11
- package/dist/operation/lib/get-parameters-as-json-schema.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PathsObject, HttpMethods, OASDocument, User, ServerVariable, ServerVariablesObject, Servers, AuthForHAR, SecuritySchemeObject, DataForHAR, SchemaObject, OAS31Document, OperationObject, SecurityRequirementObject, KeyedSecuritySchemeObject, SecurityType, TagObject, ParameterObject, SchemaWrapper, MediaTypeObject, ResponseObject, PathItemObject } from './types.js';
|
|
2
2
|
import { Match, ParamData } from 'path-to-regexp';
|
|
3
|
-
import {
|
|
3
|
+
import { g as getParametersAsJSONSchemaOptions } from './get-parameters-as-json-schema-BH81ZOnw.js';
|
|
4
4
|
import 'json-schema';
|
|
5
5
|
import 'openapi-types';
|
|
6
6
|
|
|
@@ -19,7 +19,7 @@ type PathMatches = PathMatch[];
|
|
|
19
19
|
|
|
20
20
|
declare class Oas {
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
22
|
+
* The current OpenAPI definition.
|
|
23
23
|
*/
|
|
24
24
|
api: OASDocument;
|
|
25
25
|
/**
|
|
@@ -44,6 +44,13 @@ declare class Oas {
|
|
|
44
44
|
complete: boolean;
|
|
45
45
|
processing: boolean;
|
|
46
46
|
};
|
|
47
|
+
/**
|
|
48
|
+
* Have the component schemas within this API definition been decorated with our
|
|
49
|
+
* `x-readme-ref-name` extension?
|
|
50
|
+
*
|
|
51
|
+
* @see {@link decorateComponentSchemas}
|
|
52
|
+
*/
|
|
53
|
+
protected schemasDecorated: boolean;
|
|
47
54
|
/**
|
|
48
55
|
* @param oas An OpenAPI definition.
|
|
49
56
|
* @param user The information about a user that we should use when pulling auth tokens from
|
|
@@ -194,6 +201,26 @@ declare class Oas {
|
|
|
194
201
|
* @param selectedApp The user app to retrieve an auth key for.
|
|
195
202
|
*/
|
|
196
203
|
getAuth(user: User, selectedApp?: number | string): AuthForHAR;
|
|
204
|
+
/**
|
|
205
|
+
* Determine if a security scheme exists within the API definition.
|
|
206
|
+
*
|
|
207
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.0.md#security-scheme-object}
|
|
208
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#security-scheme-object}
|
|
209
|
+
* @param name The name of the security scheme to check for.
|
|
210
|
+
*/
|
|
211
|
+
hasSecurityScheme(name: string): boolean;
|
|
212
|
+
/**
|
|
213
|
+
* Retrieve a security scheme from the API definition.
|
|
214
|
+
*
|
|
215
|
+
* If the found security scheme is a `$ref` pointer it will be lazily dereferenced; if the scheme
|
|
216
|
+
* cannot be resolved after that process (eg. it's circular or is an invalid `$ref`) then
|
|
217
|
+
* `undefined` will be returned.
|
|
218
|
+
*
|
|
219
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.0.md#security-scheme-object}
|
|
220
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#security-scheme-object}
|
|
221
|
+
* @param name The name of the security scheme to retrieve.
|
|
222
|
+
*/
|
|
223
|
+
getSecurityScheme(name: string): SecuritySchemeObject | undefined;
|
|
197
224
|
/**
|
|
198
225
|
* Returns the `paths` object that exists in this API definition but with every `method` mapped
|
|
199
226
|
* to an instance of the `Operation` class.
|
|
@@ -256,6 +283,26 @@ declare class Oas {
|
|
|
256
283
|
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions}
|
|
257
284
|
*/
|
|
258
285
|
validateExtensions(): void;
|
|
286
|
+
/**
|
|
287
|
+
* Dereference the current API definition so it can be parsed free from the hassle of resolving
|
|
288
|
+
* `$ref` schemas and circular structures.
|
|
289
|
+
*
|
|
290
|
+
*/
|
|
291
|
+
dereference(opts?: {
|
|
292
|
+
/**
|
|
293
|
+
* A callback method can be supplied to be called when dereferencing is complete. Used for
|
|
294
|
+
* debugging that the multi-promise handling within this method works.
|
|
295
|
+
*
|
|
296
|
+
* @private
|
|
297
|
+
*/
|
|
298
|
+
cb?: () => void;
|
|
299
|
+
}): Promise<(typeof this.promises)[] | boolean>;
|
|
300
|
+
/**
|
|
301
|
+
* Determine if the current API definition has been dereferenced or not.
|
|
302
|
+
*
|
|
303
|
+
* @see Oas.dereference
|
|
304
|
+
*/
|
|
305
|
+
isDereferenced(): boolean;
|
|
259
306
|
/**
|
|
260
307
|
* Retrieve any circular `$ref` pointers that maybe present within the API definition.
|
|
261
308
|
*
|
|
@@ -264,8 +311,527 @@ declare class Oas {
|
|
|
264
311
|
* @see Oas.dereference
|
|
265
312
|
*/
|
|
266
313
|
getCircularReferences(): string[];
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
interface MediaTypeExample {
|
|
317
|
+
description?: string;
|
|
318
|
+
summary?: string;
|
|
319
|
+
title?: string;
|
|
320
|
+
value: unknown;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
interface ResponseExample {
|
|
324
|
+
mediaTypes: Record<string, MediaTypeExample[]>;
|
|
325
|
+
onlyHeaders?: boolean;
|
|
326
|
+
status: string;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
interface CallbackExample {
|
|
330
|
+
example: ResponseExample[];
|
|
331
|
+
expression: string;
|
|
332
|
+
identifier: string;
|
|
333
|
+
method: string;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
type ExampleGroups = Record<string, {
|
|
337
|
+
/**
|
|
338
|
+
* Array of custom code samples that contain `correspondingExample` key.
|
|
339
|
+
* Mutually exclusive of `request`. Note that if this object is present,
|
|
340
|
+
* there may or may not be corresponding responses in the `response` object.
|
|
341
|
+
*/
|
|
342
|
+
customCodeSamples?: (NonNullable<Extensions['code-samples']>[number] & {
|
|
343
|
+
/**
|
|
344
|
+
* The index in the originally defined `code-samples` array
|
|
345
|
+
*/
|
|
346
|
+
originalIndex: number;
|
|
347
|
+
})[];
|
|
348
|
+
/**
|
|
349
|
+
* Title of example group. This is derived from the `summary` field of one of
|
|
350
|
+
* the operation's example objects. The precedence is as follows (from highest to lowest):
|
|
351
|
+
* 1. The first custom code sample's `name` field.
|
|
352
|
+
* 2. The first request parameter (e.g., cookie/header/path/query) example object that
|
|
353
|
+
* contains a `summary` field
|
|
354
|
+
* 3. The request body example object's `summary` field
|
|
355
|
+
* 4. The response example object's `summary` field
|
|
356
|
+
*
|
|
357
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#example-object}
|
|
358
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#example-object}
|
|
359
|
+
*/
|
|
360
|
+
name: string;
|
|
361
|
+
/**
|
|
362
|
+
* Object containing the example request data for the current example key.
|
|
363
|
+
* Mutually exclusive of `customCodeSamples`. If `customCodeSamples` is present,
|
|
364
|
+
* any request example definitions are ignored.
|
|
365
|
+
*/
|
|
366
|
+
request?: DataForHAR;
|
|
367
|
+
/**
|
|
368
|
+
* Object containing the example response data for the current example key.
|
|
369
|
+
*/
|
|
370
|
+
response?: {
|
|
371
|
+
/**
|
|
372
|
+
* The content type of the current example
|
|
373
|
+
*
|
|
374
|
+
* @example "application/json"
|
|
375
|
+
* @example "text/plain"
|
|
376
|
+
*/
|
|
377
|
+
mediaType: string;
|
|
378
|
+
/**
|
|
379
|
+
* The entire response example object. The example value itself is contained
|
|
380
|
+
* within `value`.
|
|
381
|
+
*
|
|
382
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#example-object}
|
|
383
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#example-object}
|
|
384
|
+
*/
|
|
385
|
+
mediaTypeExample: MediaTypeExample;
|
|
386
|
+
/**
|
|
387
|
+
* The HTTP status code for the current response example
|
|
388
|
+
*
|
|
389
|
+
* @example "2xx"
|
|
390
|
+
* @example "400"
|
|
391
|
+
*/
|
|
392
|
+
status: string;
|
|
393
|
+
};
|
|
394
|
+
}>;
|
|
395
|
+
|
|
396
|
+
interface RequestBodyExample {
|
|
397
|
+
examples: MediaTypeExample[];
|
|
398
|
+
mediaType: string;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
interface OperationIDGeneratorOptions {
|
|
402
|
+
/**
|
|
403
|
+
* Generate a JS method-friendly operation ID when one isn't present.
|
|
404
|
+
*
|
|
405
|
+
* For backwards compatiblity reasons this option will be indefinitely supported however we
|
|
406
|
+
* recommend using `friendlyCase` instead as it's a heavily improved version of this option.
|
|
407
|
+
*
|
|
408
|
+
* @see {friendlyCase}
|
|
409
|
+
* @deprecated
|
|
410
|
+
*/
|
|
411
|
+
camelCase?: boolean;
|
|
412
|
+
/**
|
|
413
|
+
* Generate a human-friendly, but still camelCase, operation ID when one isn't present. The
|
|
414
|
+
* difference between this and `camelCase` is that this also ensure that consecutive words are
|
|
415
|
+
* not present in the resulting ID. For example, for the endpoint `/candidate/{candidate}` will
|
|
416
|
+
* return `getCandidateCandidate` for `camelCase` however `friendlyCase` will return
|
|
417
|
+
* `getCandidate`.
|
|
418
|
+
*
|
|
419
|
+
* The reason this friendliness is just not a part of the `camelCase` option is because we have
|
|
420
|
+
* a number of consumers of the old operation ID style and making that change there would a
|
|
421
|
+
* breaking change that we don't have any easy way to resolve.
|
|
422
|
+
*/
|
|
423
|
+
friendlyCase?: boolean;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
interface ResponseSchemaObject {
|
|
427
|
+
description?: string;
|
|
428
|
+
label: string;
|
|
429
|
+
schema: SchemaObject;
|
|
430
|
+
type: string[] | string;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
declare class Operation {
|
|
434
|
+
/**
|
|
435
|
+
* The `Oas` instance that this operation belongs to.
|
|
436
|
+
*/
|
|
437
|
+
oas: Oas;
|
|
438
|
+
/**
|
|
439
|
+
* Schema of the operation from the API Definition.
|
|
440
|
+
*/
|
|
441
|
+
schema: OperationObject;
|
|
442
|
+
/**
|
|
443
|
+
* OpenAPI API Definition that this operation originated from.
|
|
444
|
+
*/
|
|
445
|
+
api: OASDocument;
|
|
446
|
+
/**
|
|
447
|
+
* Path that this operation is targeted towards.
|
|
448
|
+
*/
|
|
449
|
+
path: string;
|
|
450
|
+
/**
|
|
451
|
+
* HTTP Method that this operation is targeted towards.
|
|
452
|
+
*/
|
|
453
|
+
method: HttpMethods;
|
|
454
|
+
/**
|
|
455
|
+
* The primary Content Type that this operation accepts.
|
|
456
|
+
*/
|
|
457
|
+
contentType: string | undefined;
|
|
458
|
+
/**
|
|
459
|
+
* An object with groups of all example definitions (body/header/query/path/response/etc.)
|
|
460
|
+
*/
|
|
461
|
+
exampleGroups: ExampleGroups | undefined;
|
|
462
|
+
/**
|
|
463
|
+
* Request body examples for this operation.
|
|
464
|
+
*/
|
|
465
|
+
requestBodyExamples: RequestBodyExample[] | undefined;
|
|
466
|
+
/**
|
|
467
|
+
* Response examples for this operation.
|
|
468
|
+
*/
|
|
469
|
+
responseExamples: ResponseExample[] | undefined;
|
|
470
|
+
/**
|
|
471
|
+
* Callback examples for this operation (if it has callbacks).
|
|
472
|
+
*/
|
|
473
|
+
callbackExamples: CallbackExample[] | undefined;
|
|
474
|
+
/**
|
|
475
|
+
* Flattened out arrays of both request and response headers that are utilized on this operation.
|
|
476
|
+
*/
|
|
477
|
+
headers: {
|
|
478
|
+
request: string[];
|
|
479
|
+
response: string[];
|
|
480
|
+
};
|
|
481
|
+
/**
|
|
482
|
+
* Internal storage array that the library utilizes to keep track of the times the
|
|
483
|
+
* {@see Operation.dereference} has been called so that if you initiate multiple promises they'll
|
|
484
|
+
* all end up returning the same data set once the initial dereference call completed.
|
|
485
|
+
*/
|
|
486
|
+
protected promises: {
|
|
487
|
+
reject: any;
|
|
488
|
+
resolve: any;
|
|
489
|
+
}[];
|
|
490
|
+
/**
|
|
491
|
+
* Internal storage array that the library utilizes to keep track of its `dereferencing` state so
|
|
492
|
+
* it doesn't initiate multiple dereferencing processes.
|
|
493
|
+
*/
|
|
494
|
+
protected dereferencing: {
|
|
495
|
+
circularRefs: string[];
|
|
496
|
+
complete: boolean;
|
|
497
|
+
processing: boolean;
|
|
498
|
+
};
|
|
499
|
+
/**
|
|
500
|
+
* Have the component schemas within this API definition been decorated with our
|
|
501
|
+
* `x-readme-ref-name` extension?
|
|
502
|
+
*
|
|
503
|
+
* @see {@link decorateComponentSchemas}
|
|
504
|
+
*/
|
|
505
|
+
protected schemasDecorated: boolean;
|
|
506
|
+
constructor(oas: Oas, path: string, method: HttpMethods, operation: OperationObject);
|
|
507
|
+
/**
|
|
508
|
+
* Retrieve the `summary` for this operation.
|
|
509
|
+
*
|
|
510
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#user-content-operationsummary}
|
|
511
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#user-content-operation-summary}
|
|
512
|
+
*/
|
|
513
|
+
getSummary(): string | undefined;
|
|
514
|
+
/**
|
|
515
|
+
* Retrieve the `description` for this operation.
|
|
516
|
+
*
|
|
517
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#user-content-operationdescription}
|
|
518
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#user-content-operation-description}
|
|
519
|
+
*/
|
|
520
|
+
getDescription(): string | undefined;
|
|
521
|
+
/**
|
|
522
|
+
* Retrieve the primary content type for this operation. If multiple exist, the first JSON-like
|
|
523
|
+
* type will be returned.
|
|
524
|
+
*
|
|
525
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#user-content-requestbodycontent}
|
|
526
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#user-content-request-body-content}
|
|
527
|
+
*/
|
|
528
|
+
getContentType(): string;
|
|
529
|
+
/**
|
|
530
|
+
* Checks if the current operation has a `x-www-form-urlencoded` content type payload.
|
|
531
|
+
*
|
|
532
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#user-content-requestbodycontent}
|
|
533
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#user-content-request-body-content}
|
|
534
|
+
*/
|
|
535
|
+
isFormUrlEncoded(): boolean;
|
|
536
|
+
/**
|
|
537
|
+
* Checks if the current operation has a mutipart content type payload.
|
|
538
|
+
*
|
|
539
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#user-content-requestbodycontent}
|
|
540
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#user-content-request-body-content}
|
|
541
|
+
*/
|
|
542
|
+
isMultipart(): boolean;
|
|
543
|
+
/**
|
|
544
|
+
* Checks if the current operation has a JSON-like content type payload.
|
|
545
|
+
*
|
|
546
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#user-content-requestbodycontent}
|
|
547
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#user-content-request-body-content}
|
|
548
|
+
*/
|
|
549
|
+
isJson(): boolean;
|
|
550
|
+
/**
|
|
551
|
+
* Checks if the current operation has an XML content type payload.
|
|
552
|
+
*
|
|
553
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#user-content-requestbodycontent}
|
|
554
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#user-content-request-body-content}
|
|
555
|
+
*/
|
|
556
|
+
isXml(): boolean;
|
|
557
|
+
/**
|
|
558
|
+
* Checks if the current operation is a webhook or not.
|
|
559
|
+
*
|
|
560
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#oas-webhooks}
|
|
561
|
+
*/
|
|
562
|
+
isWebhook(): boolean;
|
|
563
|
+
/**
|
|
564
|
+
* Returns an array of all security requirements associated wtih this operation. If none are
|
|
565
|
+
* defined at the operation level, the securities for the entire API definition are returned
|
|
566
|
+
* (with an empty array as a final fallback).
|
|
567
|
+
*
|
|
568
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#security-requirement-object}
|
|
569
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#security-requirement-object}
|
|
570
|
+
*/
|
|
571
|
+
getSecurity(): SecurityRequirementObject[];
|
|
572
|
+
/**
|
|
573
|
+
* Retrieve a collection of grouped security schemes. The inner array determines AND-grouped
|
|
574
|
+
* security schemes, the outer array determines OR-groups.
|
|
575
|
+
*
|
|
576
|
+
* @see {@link https://swagger.io/docs/specification/authentication/#multiple}
|
|
577
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#security-requirement-object}
|
|
578
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#security-requirement-object}
|
|
579
|
+
* @param filterInvalid Optional flag that, when set to `true`, filters out invalid/nonexistent
|
|
580
|
+
* security schemes, rather than returning `false`.
|
|
581
|
+
*/
|
|
582
|
+
getSecurityWithTypes(filterInvalid?: boolean): ((false | {
|
|
583
|
+
security: KeyedSecuritySchemeObject;
|
|
584
|
+
type: SecurityType;
|
|
585
|
+
})[] | false)[];
|
|
586
|
+
/**
|
|
587
|
+
* Retrieve an object where the keys are unique scheme types, and the values are arrays
|
|
588
|
+
* containing each security scheme of that type.
|
|
589
|
+
*
|
|
590
|
+
*/
|
|
591
|
+
prepareSecurity(): Record<SecurityType, KeyedSecuritySchemeObject[]>;
|
|
592
|
+
/**
|
|
593
|
+
* Retrieve all of the headers, request and response, that are associated with this operation.
|
|
594
|
+
*
|
|
595
|
+
*/
|
|
596
|
+
getHeaders(): Operation['headers'];
|
|
597
|
+
/**
|
|
598
|
+
* Determine if this operation has an `operationId` present in its schema. Note that if one is
|
|
599
|
+
* present in the schema but is an empty string then this will return `false`.
|
|
600
|
+
*
|
|
601
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#user-content-operationid}
|
|
602
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#user-content-operation-id}
|
|
603
|
+
*/
|
|
604
|
+
hasOperationId(): boolean;
|
|
605
|
+
/**
|
|
606
|
+
* Determine if an operation has an `operationId` present in its schema. Note that if one is
|
|
607
|
+
* present in the schema but is an empty string then this will return `false`.
|
|
608
|
+
*
|
|
609
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#user-content-operationid}
|
|
610
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#user-content-operation-id}
|
|
611
|
+
*/
|
|
612
|
+
static hasOperationId(schema: OperationObject): boolean;
|
|
267
613
|
/**
|
|
268
|
-
*
|
|
614
|
+
* Get an `operationId` for this operation. If one is not present (it's not required by the spec!)
|
|
615
|
+
* a hash of the path and method will be returned instead.
|
|
616
|
+
*
|
|
617
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#user-content-operationid}
|
|
618
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#user-content-operation-id}
|
|
619
|
+
*/
|
|
620
|
+
getOperationId(opts?: OperationIDGeneratorOptions): string;
|
|
621
|
+
/**
|
|
622
|
+
* Get an `operationId` for an operation. If one is not present (it's not required by the spec!)
|
|
623
|
+
* a hash of the path and method will be returned instead.
|
|
624
|
+
*
|
|
625
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#user-content-operationid}
|
|
626
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#user-content-operation-id}
|
|
627
|
+
*/
|
|
628
|
+
static getOperationId(path: string, method: string, schema: OperationObject, opts?: OperationIDGeneratorOptions): string;
|
|
629
|
+
/**
|
|
630
|
+
* Return an array of all tags, and their metadata, that exist on this operation.
|
|
631
|
+
*
|
|
632
|
+
*/
|
|
633
|
+
getTags(): TagObject[];
|
|
634
|
+
/**
|
|
635
|
+
* Return is the operation is flagged as `deprecated` or not.
|
|
636
|
+
*
|
|
637
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#user-content-operationdeprecated}
|
|
638
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#user-content-operation-deprecated}
|
|
639
|
+
*/
|
|
640
|
+
isDeprecated(): boolean;
|
|
641
|
+
/**
|
|
642
|
+
* Determine if the operation has any (non-request body) parameters.
|
|
643
|
+
*
|
|
644
|
+
*/
|
|
645
|
+
hasParameters(): boolean;
|
|
646
|
+
/**
|
|
647
|
+
* Return the parameters (non-request body) on the operation.
|
|
648
|
+
*
|
|
649
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#user-content-operationparameters}
|
|
650
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#user-content-operation-parameters}
|
|
651
|
+
*/
|
|
652
|
+
getParameters(): ParameterObject[];
|
|
653
|
+
/**
|
|
654
|
+
* Determine if this operation has any required parameters.
|
|
655
|
+
*
|
|
656
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#user-content-operationparameters}
|
|
657
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#user-content-operation-parameters}
|
|
658
|
+
*/
|
|
659
|
+
hasRequiredParameters(): boolean;
|
|
660
|
+
/**
|
|
661
|
+
* Convert the operation into an array of JSON Schema schemas for each available type of
|
|
662
|
+
* parameter available on the operation.
|
|
663
|
+
*
|
|
664
|
+
* Note that this method is not compatible with an operation or OpenAPI definition that has been
|
|
665
|
+
* processed with `.dereference()`. This method can only be called with the _original_ API
|
|
666
|
+
* definition that was used to initialize the `Operation` and `Oas` instance. If a dereferenced
|
|
667
|
+
* schema is present when this is called a `TypeError` will be thrown.
|
|
668
|
+
*
|
|
669
|
+
* @throws {TypeError} If the operation or OpenAPI definition has been run through `.dereference().`
|
|
670
|
+
*
|
|
671
|
+
*/
|
|
672
|
+
getParametersAsJSONSchema(opts?: getParametersAsJSONSchemaOptions): SchemaWrapper[] | null;
|
|
673
|
+
/**
|
|
674
|
+
* Get a single response for this status code, formatted as JSON schema.
|
|
675
|
+
*
|
|
676
|
+
* Note that this method is not compatible with an operation or OpenAPI definition that has been
|
|
677
|
+
* processed with `.dereference()`. This method can only be called with the _original_ API
|
|
678
|
+
* definition that was used to initialize the `Operation` and `Oas` instance. If a dereferenced
|
|
679
|
+
* schema is present when this is called a `TypeError` will be thrown.
|
|
680
|
+
*
|
|
681
|
+
* @param statusCode Status code to pull a JSON Schema response for.
|
|
682
|
+
* @param opts Options for schema generation.
|
|
683
|
+
* @param opts.contentType Optional content-type to use. If specified and the response doesn't have
|
|
684
|
+
* this content-type, the function will return null.
|
|
685
|
+
*/
|
|
686
|
+
getResponseAsJSONSchema(statusCode: number | string, opts?: {
|
|
687
|
+
/**
|
|
688
|
+
* If you wish to include discriminator mapping `$ref` components alongside your
|
|
689
|
+
* `discriminator` in schemas. Defaults to `true`.
|
|
690
|
+
*/
|
|
691
|
+
includeDiscriminatorMappingRefs?: boolean;
|
|
692
|
+
/**
|
|
693
|
+
* Optional content-type to use. If specified and the response doesn't have this content-type,
|
|
694
|
+
* the function will return null.
|
|
695
|
+
*/
|
|
696
|
+
contentType?: string;
|
|
697
|
+
}): ResponseSchemaObject[] | null;
|
|
698
|
+
/**
|
|
699
|
+
* Get an array of all valid response status codes for this operation.
|
|
700
|
+
*
|
|
701
|
+
*/
|
|
702
|
+
getResponseStatusCodes(): string[];
|
|
703
|
+
/**
|
|
704
|
+
* Retrieve an array of all content types that this operation can return.
|
|
705
|
+
*
|
|
706
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#response-object}
|
|
707
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#response-object}
|
|
708
|
+
*/
|
|
709
|
+
getResponseContentTypes(): string[];
|
|
710
|
+
/**
|
|
711
|
+
* Determine if the operation has any request bodies.
|
|
712
|
+
*
|
|
713
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#user-content-operationrequestbody}
|
|
714
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#user-content-operation-request-body}
|
|
715
|
+
*/
|
|
716
|
+
hasRequestBody(): boolean;
|
|
717
|
+
/**
|
|
718
|
+
* Return the current `requestBody` object, dereferencing it in the process if it's a `$ref`
|
|
719
|
+
* pointer.
|
|
720
|
+
*
|
|
721
|
+
*/
|
|
722
|
+
private getResolvedRequestBody;
|
|
723
|
+
/**
|
|
724
|
+
* Retrieve the list of all available media types that the operations request body can accept.
|
|
725
|
+
*
|
|
726
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#media-type-object}
|
|
727
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#media-type-object}
|
|
728
|
+
*/
|
|
729
|
+
getRequestBodyMediaTypes(): string[];
|
|
730
|
+
/**
|
|
731
|
+
* Determine if this operation has a required request body.
|
|
732
|
+
*
|
|
733
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#media-type-object}
|
|
734
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#media-type-object}
|
|
735
|
+
*/
|
|
736
|
+
hasRequiredRequestBody(): boolean;
|
|
737
|
+
/**
|
|
738
|
+
* Retrieve a specific request body content schema off this operation.
|
|
739
|
+
*
|
|
740
|
+
* If no media type is supplied this will return either the first available JSON-like request
|
|
741
|
+
* body, or the first available if there are no JSON-like media types present. When this return
|
|
742
|
+
* comes back it's in the form of an array with the first key being the selected media type,
|
|
743
|
+
* followed by the media type object in question.
|
|
744
|
+
*
|
|
745
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#media-type-object}
|
|
746
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#media-type-object}
|
|
747
|
+
* @param mediaType Specific request body media type to retrieve if present.
|
|
748
|
+
*/
|
|
749
|
+
getRequestBody(mediaType?: string): MediaTypeObject | false | [string, MediaTypeObject, ...string[]];
|
|
750
|
+
/**
|
|
751
|
+
* Retrieve an array of request body examples that this operation has.
|
|
752
|
+
*
|
|
753
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#request-body-examples}
|
|
754
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#request-body-examples}
|
|
755
|
+
*/
|
|
756
|
+
getRequestBodyExamples(): RequestBodyExample[];
|
|
757
|
+
/**
|
|
758
|
+
* Return a specific response out of the operation by a given HTTP status code.
|
|
759
|
+
*
|
|
760
|
+
* @param statusCode Status code to pull a response object for.
|
|
761
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#response-object}
|
|
762
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#response-object}
|
|
763
|
+
*/
|
|
764
|
+
getResponseByStatusCode(statusCode: number | string): ResponseObject | false;
|
|
765
|
+
/**
|
|
766
|
+
* Retrieve an array of response examples that this operation has.
|
|
767
|
+
*
|
|
768
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#response-object-examples}
|
|
769
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#response-object-examples}
|
|
770
|
+
*/
|
|
771
|
+
getResponseExamples(): ResponseExample[];
|
|
772
|
+
/**
|
|
773
|
+
* Determine if the operation has callbacks.
|
|
774
|
+
*
|
|
775
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#callback-object}
|
|
776
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#callback-object}
|
|
777
|
+
*/
|
|
778
|
+
hasCallbacks(): boolean;
|
|
779
|
+
/**
|
|
780
|
+
* Retrieve a specific callback.
|
|
781
|
+
*
|
|
782
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#callback-object}
|
|
783
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#callback-object}
|
|
784
|
+
* @param identifier Callback identifier to look for.
|
|
785
|
+
* @param expression Callback expression to look for.
|
|
786
|
+
* @param method HTTP Method on the callback to look for.
|
|
787
|
+
*/
|
|
788
|
+
getCallback(identifier: string, expression: string, method: HttpMethods): Callback | false;
|
|
789
|
+
/**
|
|
790
|
+
* Retrieve an array of operations created from each callback.
|
|
791
|
+
*
|
|
792
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#callback-object}
|
|
793
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#callback-object}
|
|
794
|
+
*/
|
|
795
|
+
getCallbacks(): Callback[];
|
|
796
|
+
/**
|
|
797
|
+
* Retrieve an array of callback examples that this operation has.
|
|
798
|
+
*
|
|
799
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#callback-object}
|
|
800
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#callback-object}
|
|
801
|
+
*/
|
|
802
|
+
getCallbackExamples(): CallbackExample[];
|
|
803
|
+
/**
|
|
804
|
+
* Determine if a given a custom specification extension exists within the operation.
|
|
805
|
+
*
|
|
806
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#specification-extensions}
|
|
807
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions}
|
|
808
|
+
* @param extension Specification extension to lookup.
|
|
809
|
+
*/
|
|
810
|
+
hasExtension(extension: string): boolean;
|
|
811
|
+
/**
|
|
812
|
+
* Retrieve a custom specification extension off of the operation.
|
|
813
|
+
*
|
|
814
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#specification-extensions}
|
|
815
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions}
|
|
816
|
+
* @param extension Specification extension to lookup.
|
|
817
|
+
*
|
|
818
|
+
* @deprecated Use `oas.getExtension(extension, operation)` instead.
|
|
819
|
+
*/
|
|
820
|
+
getExtension(extension: string | keyof Extensions): any;
|
|
821
|
+
/**
|
|
822
|
+
* Returns an object with groups of all example definitions (body/header/query/path/response/etc.).
|
|
823
|
+
* The examples are grouped by their key when defined via the `examples` map.
|
|
824
|
+
*
|
|
825
|
+
* Any custom code samples defined via the `x-readme.code-samples` extension are returned,
|
|
826
|
+
* regardless of if they have a matching response example.
|
|
827
|
+
*
|
|
828
|
+
* For standard OAS request parameter (e.g., body/header/query/path/etc.) examples,
|
|
829
|
+
* they are only present in the return object if they have a corresponding response example
|
|
830
|
+
* (i.e., a response example with the same key in the `examples` map).
|
|
831
|
+
*/
|
|
832
|
+
getExampleGroups(): ExampleGroups;
|
|
833
|
+
/**
|
|
834
|
+
* Dereference the current operation schema so it can be parsed free of worries of `$ref` schemas
|
|
269
835
|
* and circular structures.
|
|
270
836
|
*
|
|
271
837
|
*/
|
|
@@ -277,11 +843,383 @@ declare class Oas {
|
|
|
277
843
|
* @private
|
|
278
844
|
*/
|
|
279
845
|
cb?: () => void;
|
|
846
|
+
}): Promise<(typeof this.promises)[] | boolean>;
|
|
847
|
+
/**
|
|
848
|
+
* Determine if the current operation schema, or the OpenAPI definition it's part of, has been
|
|
849
|
+
* dereferenced or not with `.dereference()`.
|
|
850
|
+
*
|
|
851
|
+
* @see Operation.dereference
|
|
852
|
+
*/
|
|
853
|
+
isDereferenced(): boolean;
|
|
854
|
+
/**
|
|
855
|
+
* Retrieve any circular `$ref` pointers that maybe present within operation schema.
|
|
856
|
+
*
|
|
857
|
+
* This method requires that you first dereference the definition.
|
|
858
|
+
*
|
|
859
|
+
* @see Operation.dereference
|
|
860
|
+
*/
|
|
861
|
+
getCircularReferences(): string[];
|
|
862
|
+
}
|
|
863
|
+
declare class Callback extends Operation {
|
|
864
|
+
/**
|
|
865
|
+
* The identifier that this callback is set to.
|
|
866
|
+
*/
|
|
867
|
+
identifier: string;
|
|
868
|
+
/**
|
|
869
|
+
* The parent path item object that this Callback exists within.
|
|
870
|
+
*/
|
|
871
|
+
parentSchema: PathItemObject;
|
|
872
|
+
constructor(oas: Oas, path: string, method: HttpMethods, operation: OperationObject, identifier: string, parentPathItem: PathItemObject);
|
|
873
|
+
/**
|
|
874
|
+
* Return the primary identifier for this callback.
|
|
875
|
+
*
|
|
876
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#callback-object}
|
|
877
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#callback-object}
|
|
878
|
+
*/
|
|
879
|
+
getIdentifier(): string;
|
|
880
|
+
/**
|
|
881
|
+
* Retrieve the `summary` for this callback.
|
|
882
|
+
*
|
|
883
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#user-content-operationsummary}
|
|
884
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#user-content-operation-summary}
|
|
885
|
+
*/
|
|
886
|
+
getSummary(): string | undefined;
|
|
887
|
+
/**
|
|
888
|
+
* Retrieve the `description` for this operation.
|
|
889
|
+
*
|
|
890
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#user-content-operationdescription}
|
|
891
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#user-content-operation-description}
|
|
892
|
+
*/
|
|
893
|
+
getDescription(): string | undefined;
|
|
894
|
+
/**
|
|
895
|
+
* Return the parameters (non-request body) on the operation.
|
|
896
|
+
*
|
|
897
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#user-content-operationparameters}
|
|
898
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#user-content-operation-parameters}
|
|
899
|
+
*/
|
|
900
|
+
getParameters(): ParameterObject[];
|
|
901
|
+
}
|
|
902
|
+
declare class Webhook extends Operation {
|
|
903
|
+
/**
|
|
904
|
+
* OpenAPI API Definition that this webhook originated from.
|
|
905
|
+
*/
|
|
906
|
+
api: OAS31Document;
|
|
907
|
+
/**
|
|
908
|
+
* Retrieve the `summary` for this callback.
|
|
909
|
+
*
|
|
910
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#user-content-operationsummary}
|
|
911
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#user-content-operation-summary}
|
|
912
|
+
*/
|
|
913
|
+
getSummary(): string | undefined;
|
|
914
|
+
/**
|
|
915
|
+
* Retrieve the `description` for this operation.
|
|
916
|
+
*
|
|
917
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#user-content-operationdescription}
|
|
918
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#user-content-operation-description}
|
|
919
|
+
*/
|
|
920
|
+
getDescription(): string | undefined;
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
/**
|
|
924
|
+
* Enables custom-written code samples to be set for your operations. Use this if you have specific
|
|
925
|
+
* formatting that may not be followed by the auto-generated code samples. Custom code samples are
|
|
926
|
+
* treated as static content.
|
|
927
|
+
*
|
|
928
|
+
* This extension only be placed at the operation level.
|
|
929
|
+
*
|
|
930
|
+
* @defaultValue []
|
|
931
|
+
* @see {@link https://docs.readme.com/main/docs/openapi-extensions#custom-code-samples}
|
|
932
|
+
* @example
|
|
933
|
+
* {
|
|
934
|
+
* "x-readme": {
|
|
935
|
+
* "code-samples": [
|
|
936
|
+
* {
|
|
937
|
+
* "language": "curl",
|
|
938
|
+
* "code": "curl -X POST https://api.example.com/v2/alert",
|
|
939
|
+
* "name": "Custom cURL snippet",
|
|
940
|
+
* "install": "brew install curl"
|
|
941
|
+
* },
|
|
942
|
+
* {
|
|
943
|
+
* "language": "php",
|
|
944
|
+
* "code": "<?php echo \"This is our custom PHP code snippet.\"; ?>",
|
|
945
|
+
* "name": "Custom PHP snippet"
|
|
946
|
+
* }
|
|
947
|
+
* ]
|
|
948
|
+
* }
|
|
949
|
+
* }
|
|
950
|
+
*/
|
|
951
|
+
declare const CODE_SAMPLES = "code-samples";
|
|
952
|
+
/**
|
|
953
|
+
* Disables the API Explorer's "Try It" button, preventing users from making API requests from
|
|
954
|
+
* within your docs. Users will still be able to fill out any entry fields (path or query
|
|
955
|
+
* parameters, etc.), and code snippets will be auto-generated based on the user's input, however
|
|
956
|
+
* to interact with your API the user will need to copy the code snippet and execute it outside of
|
|
957
|
+
* your docs.
|
|
958
|
+
*
|
|
959
|
+
* This **does not** disable your API Reference documentation.
|
|
960
|
+
*
|
|
961
|
+
* @defaultValue true
|
|
962
|
+
* @see {@link https://docs.readme.com/main/docs/openapi-extensions#disable-the-api-explorer}
|
|
963
|
+
* @example
|
|
964
|
+
* {
|
|
965
|
+
* "x-readme": {
|
|
966
|
+
* "explorer-enabled": true
|
|
967
|
+
* }
|
|
968
|
+
* }
|
|
969
|
+
*/
|
|
970
|
+
declare const EXPLORER_ENABLED = "explorer-enabled";
|
|
971
|
+
/**
|
|
972
|
+
* Adds static headers to add to each request. Use this when there are specific headers unique to
|
|
973
|
+
* your API.
|
|
974
|
+
*
|
|
975
|
+
* @defaultValue []
|
|
976
|
+
* @see {@link https://docs.readme.com/main/docs/openapi-extensions#static-headers}
|
|
977
|
+
* @example
|
|
978
|
+
* {
|
|
979
|
+
* "x-readme": {
|
|
980
|
+
* "headers": [
|
|
981
|
+
* {
|
|
982
|
+
* "key": "X-Static-Header-One",
|
|
983
|
+
* "value": "owlbert"
|
|
984
|
+
* },
|
|
985
|
+
* {
|
|
986
|
+
* "key": "X-Static-Header-Two",
|
|
987
|
+
* "value": "owlivia"
|
|
988
|
+
* }
|
|
989
|
+
* ]
|
|
990
|
+
* }
|
|
991
|
+
* }
|
|
992
|
+
*/
|
|
993
|
+
declare const HEADERS = "headers";
|
|
994
|
+
/**
|
|
995
|
+
* Allows you to mark an API endpoint, or _every_ API endpoint if defined in the root, as being
|
|
996
|
+
* internal and hidden from your public API reference.
|
|
997
|
+
*
|
|
998
|
+
* @defaultValue false
|
|
999
|
+
* @see {@link https://docs.readme.com/main/docs/openapi-extensions#internal}
|
|
1000
|
+
* @example
|
|
1001
|
+
* {
|
|
1002
|
+
* "x-internal": true
|
|
1003
|
+
* }
|
|
1004
|
+
* @example
|
|
1005
|
+
* {
|
|
1006
|
+
* "x-readme": {
|
|
1007
|
+
* "internal": true
|
|
1008
|
+
* }
|
|
1009
|
+
* }
|
|
1010
|
+
*/
|
|
1011
|
+
declare const INTERNAL = "internal";
|
|
1012
|
+
/**
|
|
1013
|
+
* Disables API requests from the API Explorer's "Try It" button from being sent into our [API
|
|
1014
|
+
* Metrics](https://readme.com/metrics) for you and your users. Additionally on any API endpoint
|
|
1015
|
+
* that this is disabled on your users will not see lists or graphs of previous requests they've
|
|
1016
|
+
* made against that API endpoint — either through the API Explorer's interactivity or through one
|
|
1017
|
+
* of our [Metrics SDKs](https://docs.readme.com/main/docs/api-metrics-setup) (if you have those
|
|
1018
|
+
* installed on your API).
|
|
1019
|
+
*
|
|
1020
|
+
* @defaultValue true
|
|
1021
|
+
* @see {@link https://docs.readme.com/main/docs/openapi-extensions#disable-api-metrics}
|
|
1022
|
+
* @example
|
|
1023
|
+
* {
|
|
1024
|
+
* "x-readme": {
|
|
1025
|
+
* "metrics-defaults": false
|
|
1026
|
+
* }
|
|
1027
|
+
* }
|
|
1028
|
+
*/
|
|
1029
|
+
declare const METRICS_ENABLED = "metrics-enabled";
|
|
1030
|
+
/**
|
|
1031
|
+
* Configuration options for OAuth flows in the API Explorer.
|
|
1032
|
+
*
|
|
1033
|
+
* @defaultValue {}
|
|
1034
|
+
* @see {@link https://docs.readme.com/main/docs/openapi-extensions#oauth-configuration-options}
|
|
1035
|
+
* @example
|
|
1036
|
+
* {
|
|
1037
|
+
* "x-readme": {
|
|
1038
|
+
* "oauth-options": {
|
|
1039
|
+
* "scopeSeparator": ",",
|
|
1040
|
+
* "useInsecureClientAuthentication": true,
|
|
1041
|
+
* "usePkce": false
|
|
1042
|
+
* }
|
|
1043
|
+
* }
|
|
1044
|
+
* }
|
|
1045
|
+
*/
|
|
1046
|
+
declare const OAUTH_OPTIONS = "oauth-options";
|
|
1047
|
+
/**
|
|
1048
|
+
* Controls the order of parameters on your API Reference pages.
|
|
1049
|
+
*
|
|
1050
|
+
* Your custom ordering **must** contain all of our available parameter types:
|
|
1051
|
+
*
|
|
1052
|
+
* - `path`: Path parameters
|
|
1053
|
+
* - `query`: Query parameters
|
|
1054
|
+
* - `body`: Non-`application/x-www-form-urlencoded` request body payloads
|
|
1055
|
+
* - `cookie`: Cookie parameters
|
|
1056
|
+
* - `form`: `application/x-www-form-urlencoded` request body payloads
|
|
1057
|
+
* - `header`: Header parameters
|
|
1058
|
+
*
|
|
1059
|
+
* @defaultValue ['path', 'query', 'body', 'cookie', 'form', 'header']
|
|
1060
|
+
* @see {@link https://docs.readme.com/main/docs/openapi-extensions#parameter-ordering}
|
|
1061
|
+
* @example
|
|
1062
|
+
* {
|
|
1063
|
+
* "x-readme": {
|
|
1064
|
+
* "parameter-ordering": ['path', 'query', 'header', 'cookie', 'body', 'form']
|
|
1065
|
+
* }
|
|
1066
|
+
* }
|
|
1067
|
+
*/
|
|
1068
|
+
declare const PARAMETER_ORDERING = "parameter-ordering";
|
|
1069
|
+
/**
|
|
1070
|
+
* Toggles the CORS proxy used when making API requests from within your docs (via the "Try It"
|
|
1071
|
+
* button). If your API is already set up to return CORS headers, you can safely disable this
|
|
1072
|
+
* feature.
|
|
1073
|
+
*
|
|
1074
|
+
* Disabling the CORS proxy will make the request directly from the user's browser and will prevent
|
|
1075
|
+
* [Metrics](https://docs.readme.com/main/docs/getting-started-with-metrics) data from being logged
|
|
1076
|
+
* by us unless [Metrics have already set up on your backend](https://docs.readme.com/main/docs/api-metrics-setup).
|
|
1077
|
+
*
|
|
1078
|
+
* @defaultValue true
|
|
1079
|
+
* @see {@link https://docs.readme.com/main/docs/openapi-extensions#cors-proxy-enabled}
|
|
1080
|
+
* @example
|
|
1081
|
+
* {
|
|
1082
|
+
* "x-readme": {
|
|
1083
|
+
* "proxy-enabled": true
|
|
1084
|
+
* }
|
|
1085
|
+
* }
|
|
1086
|
+
*/
|
|
1087
|
+
declare const PROXY_ENABLED = "proxy-enabled";
|
|
1088
|
+
/**
|
|
1089
|
+
* Toggles what languages are shown by default for code samples in the API Explorer. This only
|
|
1090
|
+
* affects what languages are initially shown to the user; if the user picks another language from
|
|
1091
|
+
* the three-dot menu, that language and the respective auto-generated code snippet will also appear
|
|
1092
|
+
* as an option in the API Explorer.
|
|
1093
|
+
*
|
|
1094
|
+
* @defaultValue ['shell', 'node', 'ruby', 'php', 'python', 'java', 'csharp']
|
|
1095
|
+
* @see {@link https://docs.readme.com/main/docs/openapi-extensions#code-sample-languages}
|
|
1096
|
+
* @example
|
|
1097
|
+
* {
|
|
1098
|
+
* "x-readme": {
|
|
1099
|
+
* "samples-languages": ["shell", "node", "ruby", "javascript", "python"]
|
|
1100
|
+
* }
|
|
1101
|
+
* }
|
|
1102
|
+
*/
|
|
1103
|
+
declare const SAMPLES_LANGUAGES = "samples-languages";
|
|
1104
|
+
/**
|
|
1105
|
+
* Toggles if you will see code snippets for ReadMe's SDK code generator tool `api`.
|
|
1106
|
+
*
|
|
1107
|
+
* @defaultValue true
|
|
1108
|
+
* @see {@link https://api.readme.dev}
|
|
1109
|
+
* @example
|
|
1110
|
+
* {
|
|
1111
|
+
* "x-readme": {
|
|
1112
|
+
* "simple-mode": false
|
|
1113
|
+
* }
|
|
1114
|
+
* }
|
|
1115
|
+
*/
|
|
1116
|
+
declare const SIMPLE_MODE = "simple-mode";
|
|
1117
|
+
/**
|
|
1118
|
+
* If `true`, tags are generated from the file top-down. If `false`, we sort the tags
|
|
1119
|
+
* based off the `tags` array in the OAS file.
|
|
1120
|
+
*
|
|
1121
|
+
* @defaultValue false
|
|
1122
|
+
* @see {@link https://docs.readme.com/main/docs/openapi-extensions#disable-tag-sorting}
|
|
1123
|
+
* @example
|
|
1124
|
+
* {
|
|
1125
|
+
* "x-readme": {
|
|
1126
|
+
* "disable-tag-sorting": true
|
|
1127
|
+
* }
|
|
1128
|
+
* }
|
|
1129
|
+
*/
|
|
1130
|
+
declare const DISABLE_TAG_SORTING = "disable-tag-sorting";
|
|
1131
|
+
interface Extensions {
|
|
1132
|
+
[CODE_SAMPLES]: {
|
|
280
1133
|
/**
|
|
281
|
-
*
|
|
1134
|
+
* Custom code snippet
|
|
1135
|
+
* @example "curl -X POST https://api.example.com/v2/alert"
|
|
282
1136
|
*/
|
|
283
|
-
|
|
284
|
-
|
|
1137
|
+
code: string;
|
|
1138
|
+
/**
|
|
1139
|
+
* Corresponding response example
|
|
1140
|
+
* @see {@link https://docs.readme.com/main/docs/openapi-extensions#corresponding-response-examples}
|
|
1141
|
+
*/
|
|
1142
|
+
correspondingExample?: string;
|
|
1143
|
+
/**
|
|
1144
|
+
* Library installation instructions
|
|
1145
|
+
* @example "brew install httpie"
|
|
1146
|
+
* @example "npm install node-fetch@2 --save"
|
|
1147
|
+
*/
|
|
1148
|
+
install?: string;
|
|
1149
|
+
/**
|
|
1150
|
+
* Language for syntax highlighting
|
|
1151
|
+
* @example shell
|
|
1152
|
+
*/
|
|
1153
|
+
language: string;
|
|
1154
|
+
/**
|
|
1155
|
+
* Optional title for code sample
|
|
1156
|
+
* @example "Custom cURL snippet"
|
|
1157
|
+
*/
|
|
1158
|
+
name?: string;
|
|
1159
|
+
}[] | undefined;
|
|
1160
|
+
[DISABLE_TAG_SORTING]: boolean;
|
|
1161
|
+
[EXPLORER_ENABLED]: boolean;
|
|
1162
|
+
[HEADERS]: Record<string, number | string>[] | undefined;
|
|
1163
|
+
[INTERNAL]: boolean;
|
|
1164
|
+
[METRICS_ENABLED]: boolean;
|
|
1165
|
+
[OAUTH_OPTIONS]: {
|
|
1166
|
+
/**
|
|
1167
|
+
* Scope separator for passing scopes. This value will be URL-encoded.
|
|
1168
|
+
*
|
|
1169
|
+
* @example ","
|
|
1170
|
+
* @example "+"
|
|
1171
|
+
* @default " "
|
|
1172
|
+
* @see {@link https://datatracker.ietf.org/doc/html/rfc6749#section-3.3} Scope separators information from OAuth 2.0 specification
|
|
1173
|
+
*/
|
|
1174
|
+
scopeSeparator?: string;
|
|
1175
|
+
/**
|
|
1176
|
+
* When enabled, the client credentials (i.e., `client_id` and `client_secret`) are sent in the request body (NOT recommended).
|
|
1177
|
+
* When disabled (the default), client credentials are sent using the HTTP Basic Authentication scheme.
|
|
1178
|
+
*
|
|
1179
|
+
* This is applicable for all requests to the token endpoint.
|
|
1180
|
+
*
|
|
1181
|
+
* @see {@link https://datatracker.ietf.org/doc/html/rfc6749#section-2.3.1}
|
|
1182
|
+
* @see {@link https://datatracker.ietf.org/doc/html/rfc6749#section-3.2}
|
|
1183
|
+
*
|
|
1184
|
+
* @example true
|
|
1185
|
+
* @default false
|
|
1186
|
+
*/
|
|
1187
|
+
useInsecureClientAuthentication?: boolean;
|
|
1188
|
+
/**
|
|
1189
|
+
* When enabled, uses PKCE (Proof Key for Code Exchange) for the authorization code flow.
|
|
1190
|
+
* The client secret is replaced with an auto-generated code verifier and code challenge.
|
|
1191
|
+
* When disabled, uses the standard OAuth 2.0 authorization code flow with client credentials.
|
|
1192
|
+
*
|
|
1193
|
+
* @see {@link https://datatracker.ietf.org/doc/html/rfc7636#section-4.1}
|
|
1194
|
+
* @see {@link https://datatracker.ietf.org/doc/html/rfc7636#section-4.2}
|
|
1195
|
+
*
|
|
1196
|
+
* @example true
|
|
1197
|
+
* @default false
|
|
1198
|
+
*/
|
|
1199
|
+
usePkce?: boolean;
|
|
1200
|
+
};
|
|
1201
|
+
[PARAMETER_ORDERING]: ('body' | 'cookie' | 'form' | 'header' | 'path' | 'query')[];
|
|
1202
|
+
[PROXY_ENABLED]: boolean;
|
|
1203
|
+
[SAMPLES_LANGUAGES]: string[];
|
|
1204
|
+
[SIMPLE_MODE]: boolean;
|
|
285
1205
|
}
|
|
1206
|
+
declare const extensionDefaults: Extensions;
|
|
1207
|
+
/**
|
|
1208
|
+
* Determing if an OpenAPI definition has an extension set in its root schema.
|
|
1209
|
+
*
|
|
1210
|
+
*/
|
|
1211
|
+
declare function hasRootExtension(extension: string | keyof Extensions, api: OASDocument): boolean;
|
|
1212
|
+
/**
|
|
1213
|
+
* Retrieve a custom specification extension off of the API definition.
|
|
1214
|
+
*
|
|
1215
|
+
*/
|
|
1216
|
+
declare function getExtension(extension: string | keyof Extensions, api: OASDocument, operation?: Operation): any;
|
|
1217
|
+
/**
|
|
1218
|
+
* Validate that the data for an instanceof our `PARAMETER_ORDERING` extension is properly
|
|
1219
|
+
* configured.
|
|
1220
|
+
*
|
|
1221
|
+
* @private
|
|
1222
|
+
*/
|
|
1223
|
+
declare function validateParameterOrdering(ordering: (typeof extensionDefaults)[typeof PARAMETER_ORDERING] | undefined, extension: string): void;
|
|
286
1224
|
|
|
287
|
-
export { Oas as default };
|
|
1225
|
+
export { Callback as C, DISABLE_TAG_SORTING as D, EXPLORER_ENABLED as E, HEADERS as H, INTERNAL as I, METRICS_ENABLED as M, Operation as O, PARAMETER_ORDERING as P, SAMPLES_LANGUAGES as S, Webhook as W, CODE_SAMPLES as a, type Extensions as b, OAUTH_OPTIONS as c, PROXY_ENABLED as d, Oas as default, SIMPLE_MODE as e, extensionDefaults as f, getExtension as g, hasRootExtension as h, validateParameterOrdering as v };
|