oas 24.6.0 → 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.
Files changed (47) hide show
  1. package/dist/analyzer/index.cjs +5 -5
  2. package/dist/analyzer/index.js +4 -4
  3. package/dist/{chunk-A3OZNHPE.cjs → chunk-3CBAAWG2.cjs} +44 -41
  4. package/dist/chunk-3CBAAWG2.cjs.map +1 -0
  5. package/dist/{chunk-WCDZQK62.cjs → chunk-6QHUSSDH.cjs} +1 -1
  6. package/dist/chunk-6QHUSSDH.cjs.map +1 -0
  7. package/dist/{chunk-FPDZNUSO.js → chunk-7KGYHFQ2.js} +9 -6
  8. package/dist/chunk-7KGYHFQ2.js.map +1 -0
  9. package/dist/{chunk-WN67YB26.js → chunk-BALOBQT5.js} +2 -2
  10. package/dist/{chunk-NWU5AYN6.js → chunk-D6YGEKAS.js} +3 -3
  11. package/dist/{chunk-VJPJCQC3.cjs → chunk-OCUXVRES.cjs} +11 -11
  12. package/dist/{chunk-5AHXAQFY.cjs → chunk-TKJRRBN7.cjs} +6 -6
  13. package/dist/{chunk-MHJ3WXXI.js → chunk-XPA5KLS5.js} +1 -1
  14. package/dist/chunk-XPA5KLS5.js.map +1 -0
  15. package/dist/{extensions--QIs0QPB.d.ts → extensions-CxJyLZaY.d.ts} +11 -3
  16. package/dist/{extensions-BLw7Bdmp.d.cts → extensions-qzNCq0DK.d.cts} +11 -3
  17. package/dist/extensions.d.cts +1 -1
  18. package/dist/extensions.d.ts +1 -1
  19. package/dist/index.cjs +5 -5
  20. package/dist/index.d.cts +1 -1
  21. package/dist/index.d.ts +1 -1
  22. package/dist/index.js +4 -4
  23. package/dist/operation/index.cjs +4 -4
  24. package/dist/operation/index.d.cts +1 -1
  25. package/dist/operation/index.d.ts +1 -1
  26. package/dist/operation/index.js +3 -3
  27. package/dist/operation/lib/get-parameters-as-json-schema.cjs +3 -3
  28. package/dist/operation/lib/get-parameters-as-json-schema.d.cts +1 -1
  29. package/dist/operation/lib/get-parameters-as-json-schema.d.ts +1 -1
  30. package/dist/operation/lib/get-parameters-as-json-schema.js +2 -2
  31. package/dist/types.cjs +2 -2
  32. package/dist/types.d.cts +13 -1
  33. package/dist/types.d.ts +13 -1
  34. package/dist/types.js +1 -1
  35. package/dist/utils.cjs +3 -3
  36. package/dist/utils.d.cts +1 -1
  37. package/dist/utils.d.ts +1 -1
  38. package/dist/utils.js +2 -2
  39. package/package.json +2 -2
  40. package/dist/chunk-A3OZNHPE.cjs.map +0 -1
  41. package/dist/chunk-FPDZNUSO.js.map +0 -1
  42. package/dist/chunk-MHJ3WXXI.js.map +0 -1
  43. package/dist/chunk-WCDZQK62.cjs.map +0 -1
  44. /package/dist/{chunk-WN67YB26.js.map → chunk-BALOBQT5.js.map} +0 -0
  45. /package/dist/{chunk-NWU5AYN6.js.map → chunk-D6YGEKAS.js.map} +0 -0
  46. /package/dist/{chunk-VJPJCQC3.cjs.map → chunk-OCUXVRES.cjs.map} +0 -0
  47. /package/dist/{chunk-5AHXAQFY.cjs.map → chunk-TKJRRBN7.cjs.map} +0 -0
@@ -1,15 +1,15 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunk5AHXAQFYcjs = require('../chunk-5AHXAQFY.cjs');
4
- require('../chunk-A3OZNHPE.cjs');
3
+ var _chunkTKJRRBN7cjs = require('../chunk-TKJRRBN7.cjs');
4
+ require('../chunk-3CBAAWG2.cjs');
5
5
  require('../chunk-VIIXOUMH.cjs');
6
- require('../chunk-VJPJCQC3.cjs');
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-WCDZQK62.cjs');
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, _chunk5AHXAQFYcjs.Oas)(JSON.parse(JSON.stringify(definition)));
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();
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  Oas
3
- } from "../chunk-NWU5AYN6.js";
4
- import "../chunk-FPDZNUSO.js";
3
+ } from "../chunk-D6YGEKAS.js";
4
+ import "../chunk-7KGYHFQ2.js";
5
5
  import "../chunk-SITXIAYE.js";
6
- import "../chunk-WN67YB26.js";
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-MHJ3WXXI.js";
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 _chunkVJPJCQC3cjs = require('./chunk-VJPJCQC3.cjs');
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 _chunkWCDZQK62cjs = require('./chunk-WCDZQK62.cjs');
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 (_chunkWCDZQK62cjs.isRef.call(void 0, param) && _chunkWCDZQK62cjs.isRef.call(void 0, param2)) {
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 (!_chunkVJPJCQC3cjs.isObject.call(void 0, thing)) {
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 (!_chunkVJPJCQC3cjs.matches_mimetype_default.xml(mediaType)) {
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 (_chunkWCDZQK62cjs.isRef.call(void 0, response)) {
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 = _chunkVJPJCQC3cjs.matches_mimetype_default.json;
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] = _chunkVJPJCQC3cjs.toJSONSchema.call(void 0, header.schema, {
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 _chunkVJPJCQC3cjs.toJSONSchema.call(void 0, _chunkVJPJCQC3cjs.cloneObject.call(void 0, content[contentTypes[i]].schema), {
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 _chunkVJPJCQC3cjs.toJSONSchema.call(void 0, _chunkVJPJCQC3cjs.cloneObject.call(void 0, content[contentType].schema), {
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 = _chunkVJPJCQC3cjs.cloneObject.call(void 0, foundSchema);
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: _chunkVJPJCQC3cjs.isPrimitive.call(void 0, schema) ? schema : {
526
+ schema: _chunkOCUXVREScjs.isPrimitive.call(void 0, schema) ? schema : {
527
527
  ...schema,
528
- $schema: _chunkVJPJCQC3cjs.getSchemaVersionString.call(void 0, schema, api)
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 (_chunkVJPJCQC3cjs.matches_mimetype_default.json(t)) {
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 _chunkVJPJCQC3cjs.matches_mimetype_default.formUrlEncoded(this.getContentType());
602
+ return _chunkOCUXVREScjs.matches_mimetype_default.formUrlEncoded(this.getContentType());
603
603
  }
604
604
  isMultipart() {
605
- return _chunkVJPJCQC3cjs.matches_mimetype_default.multipart(this.getContentType());
605
+ return _chunkOCUXVREScjs.matches_mimetype_default.multipart(this.getContentType());
606
606
  }
607
607
  isJson() {
608
- return _chunkVJPJCQC3cjs.matches_mimetype_default.json(this.getContentType());
608
+ return _chunkOCUXVREScjs.matches_mimetype_default.json(this.getContentType());
609
609
  }
610
610
  isXml() {
611
- return _chunkVJPJCQC3cjs.matches_mimetype_default.xml(this.getContentType());
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].findIndex((sec) => sec._key === security.security._key);
705
- if (exists < 0) {
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', _31 => _31.camelCase]) || _optionalChain([opts, 'optionalAccess', _32 => _32.friendlyCase]) ? /[^a-zA-Z0-9_]/g : /[^a-zA-Z0-9]/g, "-").replace(/--+/g, "-").replace(/^-|-$/g, "");
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', _33 => _33.camelCase]) || _optionalChain([opts, 'optionalAccess', _34 => _34.friendlyCase])) {
791
- if (_optionalChain([opts, 'optionalAccess', _35 => _35.friendlyCase])) {
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', _36 => _36.schema, 'optionalAccess', _37 => _37.parameters]) || [];
865
- const commonParams = _optionalChain([this, 'access', _38 => _38.api, 'optionalAccess', _39 => _39.paths, 'optionalAccess', _40 => _40[this.path], 'optionalAccess', _41 => _41.parameters]) || [];
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 _chunkVJPJCQC3cjs.getParametersAsJSONSchema.call(void 0, this, this.api, {
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 (_chunkWCDZQK62cjs.isRef.call(void 0, requestBody)) {
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 (_chunkWCDZQK62cjs.isRef.call(void 0, requestBody)) {
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 (_chunkWCDZQK62cjs.isRef.call(void 0, requestBody)) {
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 && _chunkVJPJCQC3cjs.matches_mimetype_default.json(mt)) {
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 (_chunkWCDZQK62cjs.isRef.call(void 0, response)) {
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 (!_chunkWCDZQK62cjs.isRef.call(void 0, cb)) {
1076
+ if (!_chunk6QHUSSDHcjs.isRef.call(void 0, cb)) {
1074
1077
  const exp = cb[expression];
1075
- if (!_chunkWCDZQK62cjs.isRef.call(void 0, exp)) {
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', _42 => _42.schema, 'optionalAccess', _43 => _43[extension]]);
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', _44 => _44.schema, 'optionalAccess', _45 => _45.summary]) && typeof this.schema.summary === "string") {
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', _46 => _46.schema, 'optionalAccess', _47 => _47.description]) && typeof this.schema.description === "string") {
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', _48 => _48.schema, 'optionalAccess', _49 => _49.parameters]) || [];
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', _50 => _50.schema, 'optionalAccess', _51 => _51.summary]) && typeof this.schema.summary === "string") {
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', _52 => _52.schema, 'optionalAccess', _53 => _53.description]) && typeof this.schema.description === "string") {
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-A3OZNHPE.cjs.map
1218
+ //# sourceMappingURL=chunk-3CBAAWG2.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/operation/lib/dedupe-common-parameters.ts","../src/samples/index.ts","../src/samples/utils.ts","../src/operation/lib/get-mediatype-examples.ts","../src/operation/lib/get-response-examples.ts","../src/operation/lib/get-callback-examples.ts","../src/operation/lib/get-example-groups.ts","../src/operation/lib/get-requestbody-examples.ts","../src/operation/lib/get-response-as-json-schema.ts","../src/operation/index.ts"],"names":[],"mappings":";;;;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AAAA,IACvF;AAEA,WAAO;AAAA,EACT;AACF;AAEO,IAAM,UAAN,cAAsB,UAAU;AAAA,EAMrC,aAAqB;AACnB,QAAI,KAAK,QAAQ,WAAW,OAAO,KAAK,OAAO,YAAY,UAAU;AACnE,aAAO,KAAK,OAAO;AAAA,IACrB,WAAW,KAAK,IAAI,SAAS,KAAK,IAAI,EAAE,WAAW,OAAO,KAAK,IAAI,SAAS,KAAK,IAAI,EAAE,YAAY,UAAU;AAC3G,aAAO,KAAK,IAAI,SAAS,KAAK,IAAI,EAAE;AAAA,IACtC;AAEA,WAAO;AAAA,EACT;AAAA,EAEA,iBAAyB;AACvB,QAAI,KAAK,QAAQ,eAAe,OAAO,KAAK,OAAO,gBAAgB,UAAU;AAC3E,aAAO,KAAK,OAAO;AAAA,IACrB,WACE,KAAK,IAAI,SAAS,KAAK,IAAI,EAAE,eAC7B,OAAO,KAAK,IAAI,SAAS,KAAK,IAAI,EAAE,gBAAgB,UACpD;AACA,aAAO,KAAK,IAAI,SAAS,KAAK,IAAI,EAAE;AAAA,IACtC;AAEA,WAAO;AAAA,EACT;AACF","sourcesContent":["import * as RMOAS from '../../types.js';\n\n/**\n * With an array of common parameters filter down them to what isn't already present in a list of\n * non-common parameters.\n *\n * @param parameters Array of parameters defined at the operation level.\n * @param commonParameters Array of **common** parameters defined at the path item level.\n */\nexport function dedupeCommonParameters(parameters: RMOAS.ParameterObject[], commonParameters: RMOAS.ParameterObject[]) {\n return commonParameters.filter((param: RMOAS.ParameterObject) => {\n return !parameters.find((param2: RMOAS.ParameterObject) => {\n if (param.name && param2.name) {\n return param.name === param2.name && param.in === param2.in;\n } else if (RMOAS.isRef(param) && RMOAS.isRef(param2)) {\n return param.$ref === param2.$ref;\n }\n\n return false;\n });\n });\n}\n","/**\n * This file has been extracted and modified from Swagger UI.\n *\n * @license Apache-2.0\n * @see {@link https://github.com/swagger-api/swagger-ui/blob/master/src/core/plugins/samples/fn.js}\n */\nimport type * as RMOAS from '../types.js';\n\nimport mergeJSONSchemaAllOf from 'json-schema-merge-allof';\nimport memoize from 'memoizee';\n\nimport { objectify, usesPolymorphism, isFunc, normalizeArray, deeplyStripKey } from './utils.js';\n\nconst sampleDefaults = (genericSample: boolean | number | string) => {\n return (schema: RMOAS.SchemaObject): typeof genericSample =>\n typeof schema.default === typeof genericSample ? schema.default : genericSample;\n};\n\nconst primitives: Record<string, (arg: RMOAS.SchemaObject | void) => boolean | number | string> = {\n string: sampleDefaults('string'),\n string_email: sampleDefaults('user@example.com'),\n 'string_date-time': sampleDefaults(new Date().toISOString()),\n string_date: sampleDefaults(new Date().toISOString().substring(0, 10)),\n 'string_YYYY-MM-DD': sampleDefaults(new Date().toISOString().substring(0, 10)),\n string_uuid: sampleDefaults('3fa85f64-5717-4562-b3fc-2c963f66afa6'),\n string_hostname: sampleDefaults('example.com'),\n string_ipv4: sampleDefaults('198.51.100.42'),\n string_ipv6: sampleDefaults('2001:0db8:5b96:0000:0000:426f:8e17:642a'),\n number: sampleDefaults(0),\n number_float: sampleDefaults(0.0),\n integer: sampleDefaults(0),\n boolean: sampleDefaults(true),\n};\n\nconst primitive = (schema: RMOAS.SchemaObject) => {\n schema = objectify(schema);\n const { format } = schema;\n let { type } = schema;\n\n if (type === 'null') {\n return null;\n } else if (Array.isArray(type)) {\n if (type.length === 1) {\n type = type[0];\n } else {\n // If one of our types is `null` then we should generate a sample for the non-null value.\n if (type.includes('null')) {\n type = type.filter(t => t !== 'null');\n }\n\n type = type.shift();\n }\n }\n\n // @todo add support for if `type` is an array\n const fn = primitives[`${type}_${format}`] || primitives[type as string];\n if (isFunc(fn)) {\n return fn(schema);\n }\n\n return `Unknown Type: ${schema.type}`;\n};\n\n/**\n * Generate a piece of sample data from a JSON Schema object. If `example` declarations are present\n * they will be utilized, but generally this will generate fake data for the information present in\n * the schema.\n *\n * @param schema JSON Schema to generate a sample for.\n */\nfunction sampleFromSchema(\n schema: RMOAS.SchemaObject,\n opts: {\n /**\n * If you wish to include data that's flagged as `readOnly`.\n */\n includeReadOnly?: boolean;\n\n /**\n * If you wish to include data that's flatted as `writeOnly`.\n */\n includeWriteOnly?: boolean;\n } = {},\n): Record<string, unknown> | unknown[] | boolean | number | string | null | undefined {\n const objectifySchema = objectify(schema);\n let { type } = objectifySchema;\n\n const hasPolymorphism = usesPolymorphism(objectifySchema);\n if (hasPolymorphism === 'allOf') {\n try {\n return sampleFromSchema(\n mergeJSONSchemaAllOf(objectifySchema, {\n resolvers: {\n // Ignore any unrecognized OAS-specific keywords that might be present on the schema\n // (like `xml`).\n defaultResolver: mergeJSONSchemaAllOf.options.resolvers.title,\n },\n }),\n opts,\n );\n } catch (error) {\n return undefined;\n }\n } else if (hasPolymorphism) {\n const samples = (objectifySchema[hasPolymorphism] as RMOAS.SchemaObject[]).map(s => {\n return sampleFromSchema(s, opts);\n });\n\n if (samples.length === 1) {\n return samples[0];\n } else if (samples.some(s => s === null)) {\n // If one of our samples is null then we should try to surface the first non-null one.\n return samples.find(s => s !== null);\n }\n\n // If we still don't have a sample then we should just return whatever the first sample we've\n // got is. The sample might not be a _full_ example but it should be enough to act as a sample.\n return samples[0];\n }\n\n const { example, additionalProperties, properties, items } = objectifySchema;\n const { includeReadOnly, includeWriteOnly } = opts;\n\n if (example !== undefined) {\n return deeplyStripKey(example, '$$ref', (val: string) => {\n // do a couple of quick sanity tests to ensure the value\n // looks like a $$ref that swagger-client generates.\n return typeof val === 'string' && val.indexOf('#') > -1;\n });\n }\n\n if (!type) {\n if (properties || additionalProperties) {\n type = 'object';\n } else if (items) {\n type = 'array';\n } else {\n return undefined;\n }\n }\n\n if (type === 'object' || (Array.isArray(type) && type.includes('object'))) {\n const props = objectify(properties);\n const obj: Record<string, any> = {};\n // eslint-disable-next-line no-restricted-syntax\n for (const name in props) {\n if (props[name] && props[name].deprecated) {\n // eslint-disable-next-line no-continue\n continue;\n }\n\n if (props[name] && props[name].readOnly && !includeReadOnly) {\n // eslint-disable-next-line no-continue\n continue;\n }\n\n if (props[name] && props[name].writeOnly && !includeWriteOnly) {\n // eslint-disable-next-line no-continue\n continue;\n }\n\n if (props[name].examples?.length) {\n obj[name] = props[name].examples[0];\n // eslint-disable-next-line no-continue\n continue;\n }\n\n obj[name] = sampleFromSchema(props[name], opts);\n }\n\n if (additionalProperties === true) {\n obj.additionalProp = {};\n } else if (additionalProperties) {\n const additionalProps = objectify(additionalProperties);\n const additionalPropVal = sampleFromSchema(additionalProps, opts);\n\n obj.additionalProp = additionalPropVal;\n }\n\n return obj;\n }\n\n if (type === 'array' || (Array.isArray(type) && type.includes('array'))) {\n // `items` should always be present on arrays, but if it isn't we should at least do our best\n // to support its absence.\n if (typeof items === 'undefined') {\n return [];\n }\n\n if (Array.isArray(items.anyOf)) {\n return items.anyOf.map((i: RMOAS.SchemaObject) => sampleFromSchema(i, opts));\n }\n\n if (Array.isArray(items.oneOf)) {\n return items.oneOf.map((i: RMOAS.SchemaObject) => sampleFromSchema(i, opts));\n }\n\n return [sampleFromSchema(items, opts)];\n }\n\n if (schema.enum) {\n if (schema.default) {\n return schema.default;\n }\n\n return normalizeArray(schema.enum as string[])[0];\n }\n\n if (type === 'file') {\n return undefined;\n }\n\n return primitive(schema);\n}\n\nexport default memoize(sampleFromSchema);\n","/**\n * Portions of this file have been extracted and modified from Swagger UI.\n *\n * @license Apache-2.0\n * @see {@link https://github.com/swagger-api/swagger-ui/blob/master/src/core/utils.js}\n */\nimport type * as RMOAS from '../types.js';\n\nimport { isObject } from '../lib/helpers.js';\n\nexport function usesPolymorphism(schema: RMOAS.SchemaObject) {\n if (schema.oneOf) {\n return 'oneOf';\n } else if (schema.anyOf) {\n return 'anyOf';\n } else if (schema.allOf) {\n return 'allOf';\n }\n\n return false;\n}\n\nexport function objectify(thing: Record<string, unknown> | unknown): Record<string, any> {\n if (!isObject(thing)) {\n return {};\n }\n\n return thing;\n}\n\nexport function normalizeArray(arr: (number | string)[] | number | string) {\n if (Array.isArray(arr)) {\n return arr;\n }\n\n return [arr];\n}\n\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport function isFunc(thing: unknown): thing is Function {\n return typeof thing === 'function';\n}\n\n// Deeply strips a specific key from an object.\n//\n// `predicate` can be used to discriminate the stripping further,\n// by preserving the key's place in the object based on its value.\n// @todo make this have a better type than `any`\nexport function deeplyStripKey(\n input: unknown,\n keyToStrip: string,\n predicate = (obj: unknown, key?: string): boolean => true, // eslint-disable-line @typescript-eslint/no-unused-vars\n): RMOAS.SchemaObject | any {\n if (typeof input !== 'object' || Array.isArray(input) || input === null || !keyToStrip) {\n return input;\n }\n\n const obj = { ...input } as Record<string, RMOAS.SchemaObject>;\n\n Object.keys(obj).forEach(k => {\n if (k === keyToStrip && predicate(obj[k], k)) {\n delete obj[k];\n return;\n }\n\n obj[k] = deeplyStripKey(obj[k], keyToStrip, predicate);\n });\n\n return obj;\n}\n","import type * as RMOAS from '../../types.js';\n\nimport matchesMimeType from '../../lib/matches-mimetype.js';\nimport sampleFromSchema from '../../samples/index.js';\n\nexport interface MediaTypeExample {\n description?: string;\n summary?: string;\n title?: string;\n value: unknown;\n}\n\n/**\n * Extracts a collection of examples from an OpenAPI Media Type Object. The example will either\n * come from the `example` property, the first item in an `examples` array, or if none of those are\n * present it will generate an example based off its schema.\n *\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md#mediaTypeObject}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#mediaTypeObject}\n * @param mediaType The media type that we're looking for examples for.\n * @param mediaTypeObject The media type object that we're looking for examples for.\n */\nexport function getMediaTypeExamples(\n mediaType: string,\n mediaTypeObject: RMOAS.MediaTypeObject,\n opts: {\n /**\n * If you wish to include data that's flagged as `readOnly`.\n */\n includeReadOnly?: boolean;\n\n /**\n * If you wish to include data that's flatted as `writeOnly`.\n */\n includeWriteOnly?: boolean;\n } = {},\n) {\n if (mediaTypeObject.example) {\n return [\n {\n value: mediaTypeObject.example,\n },\n ];\n } else if (mediaTypeObject.examples) {\n const { examples } = mediaTypeObject;\n const multipleExamples = Object.keys(examples)\n .map(key => {\n let summary = key;\n let description;\n\n let example = examples[key];\n if (example !== null && typeof example === 'object') {\n if ('summary' in example) {\n summary = example.summary;\n }\n\n if ('description' in example) {\n description = example.description;\n }\n\n if ('value' in example) {\n // If we have a $ref here then it's a circular reference and we should ignore it.\n if (example.value !== null && typeof example.value === 'object' && '$ref' in example.value) {\n return false;\n }\n\n example = example.value;\n }\n }\n\n const ret: MediaTypeExample = { summary, title: key, value: example };\n if (description) {\n ret.description = description;\n }\n\n return ret;\n })\n .filter(Boolean) as MediaTypeExample[];\n\n // If we were able to grab examples from the `examples` property return them (`examples` can\n // sometimes be an empty object), otherwise we should try to generate some instead.\n if (multipleExamples.length) {\n return multipleExamples;\n }\n }\n\n if (mediaTypeObject.schema) {\n // We do not fully support XML so we shouldn't generate XML samples for XML schemas.\n if (!matchesMimeType.xml(mediaType)) {\n return [\n {\n value: sampleFromSchema(JSON.parse(JSON.stringify(mediaTypeObject.schema)), opts),\n },\n ];\n }\n }\n\n return [];\n}\n","import type { MediaTypeExample } from './get-mediatype-examples.js';\nimport type * as RMOAS from '../../types.js';\n\nimport { isRef } from '../../types.js';\n\nimport { getMediaTypeExamples } from './get-mediatype-examples.js';\n\nexport type ResponseExamples = {\n mediaTypes: Record<string, MediaTypeExample[]>;\n onlyHeaders?: boolean;\n status: string;\n}[];\n\n/**\n * Retrieve a collection of response examples keyed, by their media type.\n *\n * @param operation Operation to retrieve response examples for.\n */\nexport function getResponseExamples(operation: RMOAS.OperationObject) {\n return Object.keys(operation.responses || {})\n .map(status => {\n const response = operation.responses[status];\n let onlyHeaders = false;\n\n // If we have a $ref here that means that this was a circular ref so we should ignore it.\n if (isRef(response)) {\n return false;\n }\n\n const mediaTypes: Record<string, MediaTypeExample[]> = {};\n (response.content ? Object.keys(response.content) : []).forEach(mediaType => {\n if (!mediaType) return;\n\n const mediaTypeObject = response.content[mediaType];\n const examples = getMediaTypeExamples(mediaType, mediaTypeObject, {\n includeReadOnly: true,\n includeWriteOnly: false,\n });\n\n if (examples) {\n mediaTypes[mediaType] = examples;\n }\n });\n\n // If the response has no content, but has headers, hardcode an empty example so the headers\n // modal will still display\n if (response.headers && Object.keys(response.headers).length && !Object.keys(mediaTypes).length) {\n mediaTypes['*/*'] = [];\n onlyHeaders = true;\n }\n\n if (!Object.keys(mediaTypes).length) {\n return false;\n }\n\n return {\n status,\n mediaTypes,\n ...(onlyHeaders ? { onlyHeaders } : {}),\n };\n })\n .filter(Boolean) as ResponseExamples;\n}\n","import type { ResponseExamples } from './get-response-examples.js';\nimport type * as RMOAS from '../../types.js';\n\nimport { getResponseExamples } from './get-response-examples.js';\n\nexport type CallbackExamples = {\n example: ResponseExamples;\n expression: string;\n identifier: string;\n method: string;\n}[];\n\n/**\n * With an OpenAPI Operation Object return back a collection of examples for any callbacks that may\n * be present.\n *\n * @param operation Operation to retrieve callback examples from.\n */\nexport function getCallbackExamples(operation: RMOAS.OperationObject) {\n const ret: CallbackExamples = [];\n\n // spreads the contents of the map for each callback so there's not nested arrays returned\n return ret.concat(\n ...Object.keys(operation.callbacks || {}).map(identifier => {\n const callback = operation.callbacks[identifier] as RMOAS.CallbackObject;\n\n // spreads the contents again so there's not nested arrays returned\n return []\n .concat(\n ...Object.keys(callback).map(expression => {\n return Object.keys(callback[expression]).map(method => {\n const pathItem = callback[expression] as Record<string, RMOAS.OperationObject>;\n const example = getResponseExamples(pathItem[method]);\n if (example.length === 0) return false;\n\n return {\n identifier,\n expression,\n method,\n example,\n };\n });\n }),\n )\n .filter(Boolean);\n }),\n );\n}\n","import type { MediaTypeExample } from './get-mediatype-examples.js';\nimport type * as RMOAS from '../../types.js';\nimport type { Operation } from '../index.js';\nimport type { OpenAPIV3 } from 'openapi-types';\n\nimport { getExtension, type Extensions } from '../../extensions.js';\n\nexport type ExampleGroups = Record<\n string,\n {\n /**\n * Array of custom code samples that contain `correspondingExample` key.\n * Mutually exclusive of `request`. Note that if this object is present,\n * there may or may not be corresponding responses in the `response` object.\n */\n customCodeSamples?: (Extensions['code-samples'] & {\n /**\n * The index in the originally defined `code-samples` array\n */\n originalIndex: number;\n })[];\n\n /**\n * Title of example group. This is derived from the `summary` field of one of\n * the operation's example objects. The precedence is as follows (from highest to lowest):\n * 1. The first custom code sample's `name` field.\n * 2. The first request parameter (e.g., cookie/header/path/query) example object that\n * contains a `summary` field\n * 3. The request body example object's `summary` field\n * 4. The response example object's `summary` field\n *\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#example-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#example-object}\n */\n name: string;\n\n /**\n * Object containing the example request data for the current example key.\n * Mutually exclusive of `customCodeSamples`. If `customCodeSamples` is present,\n * any request example definitions are ignored.\n */\n request?: RMOAS.DataForHAR;\n\n /**\n * Object containing the example response data for the current example key.\n */\n response?: {\n /**\n * The content type of the current example\n *\n * @example \"application/json\"\n * @example \"text/plain\"\n */\n mediaType: string;\n\n /**\n * The entire response example object. The example value itself is contained\n * within `value`.\n *\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#example-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#example-object}\n */\n mediaTypeExample: MediaTypeExample;\n\n /**\n * The HTTP status code for the current response example\n *\n * @example \"2xx\"\n * @example \"400\"\n */\n status: string;\n };\n }\n>;\n\n/**\n * Internal key to represent custom code samples that do not have a corresponding response example.\n */\nconst noCorrespondingResponseKey = 'NoCorrespondingResponseForCustomCodeSample';\n\n/**\n * Takes a groups object and an operation and adds any matching response examples\n * to existing groups object\n */\nfunction addMatchingResponseExamples(groups: ExampleGroups, operation: Operation) {\n operation.getResponseExamples().forEach(example => {\n Object.entries(example.mediaTypes || {}).forEach(([mediaType, mediaTypeExamples]) => {\n mediaTypeExamples.forEach(mediaTypeExample => {\n // only add a response example if the `title` field exists\n // and it matches one of the existing example keys\n if (mediaTypeExample.title && Object.keys(groups).includes(mediaTypeExample.title)) {\n groups[mediaTypeExample.title].response = {\n mediaType,\n mediaTypeExample,\n status: example.status,\n };\n\n // if the current group doesn't already have a name set,\n // use the response example object's summary field\n if (!groups[mediaTypeExample.title].name) {\n groups[mediaTypeExample.title].name = mediaTypeExample.summary;\n }\n }\n });\n });\n });\n}\n\n/**\n * Returns a name for the given custom code sample. If there isn't already one defined,\n * we construct a fallback value based on where the sample is in the array.\n */\nfunction getDefaultName(sample: Extensions['code-samples'], count: Record<string, number>): string {\n return sample.name && sample.name.length > 0\n ? sample.name\n : `Default${count[sample.language] > 1 ? ` #${count[sample.language]}` : ''}`;\n}\n\n/**\n * Returns an object with groups of all example definitions (body/header/query/path/response/etc.).\n * The examples are grouped by their key when defined via the `examples` map.\n *\n * Any custom code samples defined via the `x-readme.code-samples` extension are returned,\n * regardless of if they have a matching response example.\n *\n * For standard OAS request parameter (e.g., body/header/query/path/etc.) examples,\n * they are only present in the return object if they have a corresponding response example\n * (i.e., a response example with the same key in the `examples` map).\n */\nexport function getExampleGroups(operation: Operation): ExampleGroups {\n const namelessCodeSampleCounts: Record<string, number> = {};\n const groups: ExampleGroups = {};\n\n // add custom code samples\n const codeSamples = getExtension('code-samples', operation.api, operation) as Extensions['code-samples'][];\n codeSamples?.forEach((sample, i) => {\n if (namelessCodeSampleCounts[sample.language]) {\n namelessCodeSampleCounts[sample.language] += 1;\n } else {\n namelessCodeSampleCounts[sample.language] = 1;\n }\n const name = getDefaultName(sample, namelessCodeSampleCounts);\n\n // sample contains `correspondingExample` key\n if (groups[sample.correspondingExample]?.customCodeSamples?.length) {\n groups[sample.correspondingExample].customCodeSamples.push({ ...sample, name, originalIndex: i });\n } else if (sample.correspondingExample) {\n groups[sample.correspondingExample] = {\n name,\n customCodeSamples: [{ ...sample, name, originalIndex: i }],\n };\n }\n\n // sample does not contain a corresponding response example\n else if (groups[noCorrespondingResponseKey]?.customCodeSamples?.length) {\n groups[noCorrespondingResponseKey].customCodeSamples.push({ ...sample, name, originalIndex: i });\n } else {\n groups[noCorrespondingResponseKey] = {\n name,\n customCodeSamples: [{ ...sample, name, originalIndex: i }],\n };\n }\n });\n\n // if we added any custom code samples, add the corresponding response examples and return\n if (Object.keys(groups).length) {\n addMatchingResponseExamples(groups, operation);\n return groups;\n }\n\n // add request param examples\n operation.getParameters().forEach(param => {\n Object.entries(param.examples || {}).forEach(([exampleKey, paramExample]: [string, OpenAPIV3.ExampleObject]) => {\n groups[exampleKey] = {\n ...groups[exampleKey],\n name: groups[exampleKey]?.name || paramExample.summary,\n request: {\n ...groups[exampleKey]?.request,\n [param.in]: {\n ...groups[exampleKey]?.request?.[param.in],\n [param.name]: paramExample.value,\n },\n },\n };\n });\n });\n\n // add request body examples\n operation.getRequestBodyExamples().forEach(requestExample => {\n requestExample.examples.forEach((mediaTypeExample: MediaTypeExample) => {\n if (mediaTypeExample.title) {\n const mediaType = requestExample.mediaType === 'application/x-www-form-urlencoded' ? 'formData' : 'body';\n groups[mediaTypeExample.title] = {\n ...groups[mediaTypeExample.title],\n name: groups[mediaTypeExample.title]?.name || mediaTypeExample.summary,\n request: {\n ...groups[mediaTypeExample.title]?.request,\n [mediaType]: mediaTypeExample.value,\n },\n };\n }\n });\n });\n\n // if we added any request examples, add the corresponding response examples\n if (Object.keys(groups).length) {\n addMatchingResponseExamples(groups, operation);\n }\n\n // prune any objects that don't have both a request and a response\n Object.entries(groups).forEach(([groupId, group]) => {\n if (group.request && !group.response) {\n delete groups[groupId];\n }\n });\n\n return groups;\n}\n","import type { MediaTypeExample } from './get-mediatype-examples.js';\nimport type * as RMOAS from '../../types.js';\n\nimport { getMediaTypeExamples } from './get-mediatype-examples.js';\n\nexport type RequestBodyExamples = {\n examples: MediaTypeExample[];\n mediaType: string;\n}[];\n\n/**\n * Retrieve a collection of request body examples, keyed by their media type.\n *\n * @param operation Operation to retrieve requestBody examples for.\n */\nexport function getRequestBodyExamples(operation: RMOAS.OperationObject) {\n // `requestBody` will never have `$ref` pointers here so we need to work around the type that we\n // have from `RMOAS.OperationObject`.\n const requestBody = operation.requestBody as RMOAS.RequestBodyObject;\n if (!requestBody || !requestBody.content) {\n return [];\n }\n\n return Object.keys(requestBody.content || {})\n .map(mediaType => {\n const mediaTypeObject = requestBody.content[mediaType];\n const examples = getMediaTypeExamples(mediaType, mediaTypeObject, {\n includeReadOnly: false,\n includeWriteOnly: true,\n });\n\n if (!examples.length) {\n return false;\n }\n\n return {\n mediaType,\n examples,\n };\n })\n .filter(Boolean) as RequestBodyExamples;\n}\n","import type {\n ComponentsObject,\n MediaTypeObject,\n OASDocument,\n ResponseObject,\n SchemaObject,\n HeaderObject,\n} from '../../types.js';\nimport type { Operation } from '../index.js';\n\nimport cloneObject from '../../lib/clone-object.js';\nimport { isPrimitive } from '../../lib/helpers.js';\nimport matches from '../../lib/matches-mimetype.js';\nimport { toJSONSchema, getSchemaVersionString } from '../../lib/openapi-to-json-schema.js';\n\nconst isJSON = matches.json;\n\n/**\n * Turn a header map from OpenAPI 3.0.3 (and some earlier versions too) into a schema.\n *\n * Note: This does not support OpenAPI 3.1.0's header format.\n *\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#headerObject}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.3.md#headerObject}\n * @param response Response object to build a JSON Schema object for its headers for.\n */\nfunction buildHeadersSchema(\n response: ResponseObject,\n opts?: {\n /**\n * With a transformer you can transform any data within a given schema, like say if you want to\n * rewrite a potentially unsafe `title` that might be eventually used as a JS variable name,\n * just make sure to return your transformed schema.\n */\n transformer?: (schema: SchemaObject) => SchemaObject;\n },\n) {\n const headers = response.headers;\n\n const headersSchema: SchemaObject = {\n type: 'object',\n properties: {},\n };\n\n Object.keys(headers).forEach(key => {\n if (headers[key] && (headers[key] as HeaderObject).schema) {\n const header: HeaderObject = headers[key] as HeaderObject;\n\n // TODO: Response headers are essentially parameters in OAS\n // This means they can have content instead of schema.\n // We should probably support that in the future\n headersSchema.properties[key] = toJSONSchema(header.schema, {\n addEnumsToDescriptions: true,\n transformer: opts.transformer,\n });\n\n if (header.description) {\n (headersSchema.properties[key] as HeaderObject).description = header.description;\n }\n }\n });\n\n const headersWrapper: {\n description?: string;\n label: string;\n schema: SchemaObject;\n type: string;\n } = {\n schema: headersSchema,\n type: 'object',\n label: 'Headers',\n };\n\n if (response.description && headersWrapper.schema) {\n headersWrapper.description = response.description;\n }\n\n return headersWrapper;\n}\n\n/**\n * Extract all the response schemas, matching the format of `get-parameters-as-json-schema`.\n *\n * Note: This expects a dereferenced schema.\n *\n * @param operation Operation to construct a response JSON Schema for.\n * @param api The OpenAPI definition that this operation originates.\n * @param statusCode The response status code to generate a schema for.\n */\nexport function getResponseAsJSONSchema(\n operation: Operation,\n api: OASDocument,\n statusCode: number | string,\n opts?: {\n includeDiscriminatorMappingRefs?: boolean;\n /**\n * With a transformer you can transform any data within a given schema, like say if you want\n * to rewrite a potentially unsafe `title` that might be eventually used as a JS variable\n * name, just make sure to return your transformed schema.\n */\n transformer?: (schema: SchemaObject) => SchemaObject;\n },\n) {\n const response = operation.getResponseByStatusCode(statusCode);\n const jsonSchema = [];\n\n if (!response) {\n return null;\n }\n\n let hasCircularRefs = false;\n let hasDiscriminatorMappingRefs = false;\n\n function refLogger(ref: string, type: 'discriminator' | 'ref') {\n if (type === 'ref') {\n hasCircularRefs = true;\n } else {\n hasDiscriminatorMappingRefs = true;\n }\n }\n\n /**\n * @param content An array of `MediaTypeObject`'s to retrieve a preferred schema out of. We\n * prefer JSON media types.\n */\n function getPreferredSchema(content: Record<string, MediaTypeObject>) {\n if (!content) {\n return null;\n }\n\n const contentTypes = Object.keys(content);\n if (!contentTypes.length) {\n return null;\n }\n\n // eslint-disable-next-line no-plusplus\n for (let i = 0; i < contentTypes.length; i++) {\n if (isJSON(contentTypes[i])) {\n return toJSONSchema(cloneObject(content[contentTypes[i]].schema), {\n addEnumsToDescriptions: true,\n refLogger,\n transformer: opts.transformer,\n });\n }\n }\n\n // We always want to prefer the JSON-compatible content types over everything else but if we\n // haven't found one we should default to the first available.\n const contentType = contentTypes.shift();\n return toJSONSchema(cloneObject(content[contentType].schema), {\n addEnumsToDescriptions: true,\n refLogger,\n transformer: opts.transformer,\n });\n }\n\n const foundSchema = getPreferredSchema((response as ResponseObject).content);\n if (foundSchema) {\n const schema = cloneObject(foundSchema);\n const schemaWrapper: {\n description?: string;\n label: string;\n schema: SchemaObject;\n type: string[] | string;\n } = {\n // If there's no `type` then the root schema is a circular `$ref` that we likely won't be\n // able to render so instead of generating a JSON Schema with an `undefined` type we should\n // default to `string` so there's at least *something* the end-user can interact with.\n type: foundSchema.type || 'string',\n schema: isPrimitive(schema)\n ? schema\n : {\n ...schema,\n $schema: getSchemaVersionString(schema, api),\n },\n label: 'Response body',\n };\n\n if ((response as ResponseObject).description && schemaWrapper.schema) {\n schemaWrapper.description = (response as ResponseObject).description;\n }\n\n /**\n * Since this library assumes that the schema has already been dereferenced, adding every\n * component here that **isn't** circular adds a ton of bloat so it'd be cool if `components`\n * was just the remaining `$ref` pointers that are still being referenced.\n *\n * @todo\n */\n if (api.components && schemaWrapper.schema) {\n // We should only include components if we've got circular refs or we have discriminator\n // mapping refs (we want to include them).\n if (hasCircularRefs || (hasDiscriminatorMappingRefs && opts.includeDiscriminatorMappingRefs)) {\n ((schemaWrapper.schema as SchemaObject).components as ComponentsObject) = api.components as ComponentsObject;\n }\n }\n\n jsonSchema.push(schemaWrapper);\n }\n\n // 3.0.3 and earlier headers. TODO: New format for 3.1.0\n if ((response as ResponseObject).headers) {\n jsonSchema.push(buildHeadersSchema(response as ResponseObject, opts));\n }\n\n return jsonSchema.length ? jsonSchema : null;\n}\n","import type { CallbackExamples } from './lib/get-callback-examples.js';\nimport type { getParametersAsJSONSchemaOptions } from './lib/get-parameters-as-json-schema.js';\nimport type { RequestBodyExamples } from './lib/get-requestbody-examples.js';\nimport type { ResponseExamples } from './lib/get-response-examples.js';\nimport type { Extensions } from '../extensions.js';\nimport type { SecurityType } from '../types.js';\nimport type { OpenAPIV3, OpenAPIV3_1 } from 'openapi-types';\n\nimport findSchemaDefinition from '../lib/find-schema-definition.js';\nimport matchesMimeType from '../lib/matches-mimetype.js';\nimport * as RMOAS from '../types.js';\nimport { supportedMethods } from '../utils.js';\n\nimport { dedupeCommonParameters } from './lib/dedupe-common-parameters.js';\nimport { getCallbackExamples } from './lib/get-callback-examples.js';\nimport { getExampleGroups, type ExampleGroups } from './lib/get-example-groups.js';\nimport { getParametersAsJSONSchema } from './lib/get-parameters-as-json-schema.js';\nimport { getRequestBodyExamples } from './lib/get-requestbody-examples.js';\nimport { getResponseAsJSONSchema } from './lib/get-response-as-json-schema.js';\nimport { getResponseExamples } from './lib/get-response-examples.js';\n\nexport class Operation {\n /**\n * Schema of the operation from the API Definition.\n */\n schema: RMOAS.OperationObject;\n\n /**\n * OpenAPI API Definition that this operation originated from.\n */\n api: RMOAS.OASDocument;\n\n /**\n * Path that this operation is targeted towards.\n */\n path: string;\n\n /**\n * HTTP Method that this operation is targeted towards.\n */\n method: RMOAS.HttpMethods;\n\n /**\n * The primary Content Type that this operation accepts.\n */\n contentType: string;\n\n /**\n * An object with groups of all example definitions (body/header/query/path/response/etc.)\n */\n exampleGroups: ExampleGroups;\n\n /**\n * Request body examples for this operation.\n */\n requestBodyExamples: RequestBodyExamples;\n\n /**\n * Response examples for this operation.\n */\n responseExamples: ResponseExamples;\n\n /**\n * Callback examples for this operation (if it has callbacks).\n */\n callbackExamples: CallbackExamples;\n\n /**\n * Flattened out arrays of both request and response headers that are utilized on this operation.\n */\n headers: {\n request: string[];\n response: string[];\n };\n\n constructor(api: RMOAS.OASDocument, path: string, method: RMOAS.HttpMethods, operation: RMOAS.OperationObject) {\n this.schema = operation;\n this.api = api;\n this.path = path;\n this.method = method;\n\n this.contentType = undefined;\n this.requestBodyExamples = undefined;\n this.responseExamples = undefined;\n this.callbackExamples = undefined;\n this.exampleGroups = undefined;\n }\n\n getSummary(): string {\n if (this.schema?.summary && typeof this.schema.summary === 'string') {\n return this.schema.summary;\n } else if (this.api.paths[this.path].summary && typeof this.api.paths[this.path].summary === 'string') {\n return this.api.paths[this.path].summary;\n }\n\n return undefined;\n }\n\n getDescription(): string {\n if (this.schema?.description && typeof this.schema.description === 'string') {\n return this.schema.description;\n } else if (this.api.paths[this.path].description && typeof this.api.paths[this.path].description === 'string') {\n return this.api.paths[this.path].description;\n }\n\n return undefined;\n }\n\n getContentType(): string {\n if (this.contentType) {\n return this.contentType;\n }\n\n let types: string[] = [];\n if (this.schema.requestBody) {\n if ('$ref' in this.schema.requestBody) {\n this.schema.requestBody = findSchemaDefinition(this.schema.requestBody.$ref, this.api);\n }\n\n if ('content' in this.schema.requestBody) {\n types = Object.keys(this.schema.requestBody.content);\n }\n }\n\n this.contentType = 'application/json';\n if (types && types.length) {\n this.contentType = types[0];\n }\n\n // Favor JSON if it exists\n types.forEach(t => {\n if (matchesMimeType.json(t)) {\n this.contentType = t;\n }\n });\n\n return this.contentType;\n }\n\n isFormUrlEncoded(): boolean {\n return matchesMimeType.formUrlEncoded(this.getContentType());\n }\n\n isMultipart(): boolean {\n return matchesMimeType.multipart(this.getContentType());\n }\n\n isJson(): boolean {\n return matchesMimeType.json(this.getContentType());\n }\n\n isXml(): boolean {\n return matchesMimeType.xml(this.getContentType());\n }\n\n /**\n * Returns an array of all security requirements associated wtih this operation. If none are\n * defined at the operation level, the securities for the entire API definition are returned\n * (with an empty array as a final fallback).\n *\n */\n getSecurity(): RMOAS.SecurityRequirementObject[] {\n if (!this.api?.components?.securitySchemes || !Object.keys(this.api.components.securitySchemes).length) {\n return [];\n }\n\n return this.schema.security || this.api.security || [];\n }\n\n /**\n * Retrieve a collection of grouped security schemes. The inner array determines AND-grouped\n * security schemes, the outer array determines OR-groups.\n *\n * @see {@link https://swagger.io/docs/specification/authentication/#multiple}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#security-requirement-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#securityRequirementObject}\n * @param filterInvalid Optional flag that, when set to `true`, filters out invalid/nonexistent\n * security schemes, rather than returning `false`.\n */\n getSecurityWithTypes(\n filterInvalid = false,\n ): ((false | { security: RMOAS.KeyedSecuritySchemeObject; type: SecurityType })[] | false)[] {\n const securityRequirements = this.getSecurity();\n\n return securityRequirements.map(requirement => {\n let keys;\n try {\n keys = Object.keys(requirement);\n } catch (e) {\n return false;\n }\n\n const keysWithTypes = keys.map(key => {\n let security;\n try {\n // Remove the reference type, because we know this will be dereferenced\n security = this.api.components.securitySchemes[key] as RMOAS.KeyedSecuritySchemeObject;\n } catch (e) {\n return false;\n }\n\n if (!security) return false;\n\n let type: SecurityType = null;\n\n if (security.type === 'http') {\n if (security.scheme === 'basic') type = 'Basic';\n else if (security.scheme === 'bearer') type = 'Bearer';\n else type = security.type;\n } else if (security.type === 'oauth2') {\n type = 'OAuth2';\n } else if (security.type === 'apiKey') {\n if (security.in === 'query') type = 'Query';\n else if (security.in === 'header') type = 'Header';\n else if (security.in === 'cookie') type = 'Cookie';\n else type = security.type;\n } else {\n return false;\n }\n\n return {\n type,\n security: {\n ...security,\n _key: key,\n _requirements: requirement[key],\n },\n };\n });\n\n if (filterInvalid) return keysWithTypes.filter(key => key !== false);\n\n return keysWithTypes;\n });\n }\n\n /**\n * Retrieve an object where the keys are unique scheme types, and the values are arrays\n * containing each security scheme of that type.\n *\n */\n prepareSecurity(): Record<SecurityType, RMOAS.KeyedSecuritySchemeObject[]> {\n const securitiesWithTypes = this.getSecurityWithTypes();\n\n return securitiesWithTypes.reduce(\n (prev, securities) => {\n if (!securities) return prev;\n\n securities.forEach(security => {\n // Remove non-existent schemes\n if (!security) return;\n if (!prev[security.type]) prev[security.type] = [];\n\n // Only add schemes we haven't seen yet.\n const exists = prev[security.type].some(sec => sec._key === security.security._key);\n if (!exists) {\n // Since an operation can require the same security scheme several times (each with different scope requirements),\n // including the `_requirements` in this object would be misleading since we dedupe the security schemes.\n // eslint-disable-next-line no-underscore-dangle\n if (security.security?._requirements) delete security.security._requirements;\n prev[security.type].push(security.security);\n }\n });\n\n return prev;\n },\n {} as Record<SecurityType, RMOAS.KeyedSecuritySchemeObject[]>,\n );\n }\n\n getHeaders(): Operation['headers'] {\n this.headers = {\n request: [],\n response: [],\n };\n\n const security = this.prepareSecurity();\n if (security.Header) {\n this.headers.request = (security.Header as OpenAPIV3_1.ApiKeySecurityScheme[]).map(h => {\n return h.name;\n });\n }\n\n if (security.Bearer || security.Basic || security.OAuth2) {\n this.headers.request.push('Authorization');\n }\n\n if (security.Cookie) {\n this.headers.request.push('Cookie');\n }\n\n if (this.schema.parameters) {\n this.headers.request = this.headers.request.concat(\n // Remove the reference object because we will have already dereferenced.\n (this.schema.parameters as OpenAPIV3_1.ParameterObject[] | OpenAPIV3.ParameterObject[])\n .map(p => {\n if (p.in && p.in === 'header') return p.name;\n return undefined;\n })\n .filter(p => p),\n );\n }\n\n if (this.schema.responses) {\n this.headers.response = Object.keys(this.schema.responses)\n // Remove the reference object because we will have already dereferenced.\n .filter(r => (this.schema.responses[r] as RMOAS.ResponseObject).headers)\n .map(r =>\n // Remove the reference object because we will have already dereferenced.\n Object.keys((this.schema.responses[r] as RMOAS.ResponseObject).headers),\n )\n .reduce((a, b) => a.concat(b), []);\n }\n\n // If the operation doesn't already specify a `content-type` request header, we check if the\n // path operation request body contains content, which implies that we should also include the\n // `content-type` header.\n if (!this.headers.request.includes('Content-Type') && this.schema.requestBody) {\n if (\n (this.schema.requestBody as RMOAS.RequestBodyObject).content &&\n Object.keys((this.schema.requestBody as RMOAS.RequestBodyObject).content)\n ) {\n this.headers.request.push('Content-Type');\n }\n }\n\n // This is a similar approach, but in this case if we check the response content and prioritize\n // the `accept` request header and `content-type` request header.\n if (this.schema.responses) {\n if (\n Object.keys(this.schema.responses).some(\n response => !!(this.schema.responses[response] as RMOAS.ResponseObject).content,\n )\n ) {\n if (!this.headers.request.includes('Accept')) this.headers.request.push('Accept');\n if (!this.headers.response.includes('Content-Type')) this.headers.response.push('Content-Type');\n }\n }\n\n return this.headers;\n }\n\n /**\n * Determine if the operation has an operation present in its schema. Note that if one is present\n * in the schema but is an empty string then this will return false.\n *\n */\n hasOperationId(): boolean {\n return Boolean('operationId' in this.schema && this.schema.operationId.length);\n }\n\n /**\n * Get an `operationId` for this operation. If one is not present (it's not required by the spec!)\n * a hash of the path and method will be returned instead.\n *\n */\n getOperationId(\n opts: {\n /**\n * Generate a JS method-friendly operation ID when one isn't present.\n *\n * For backwards compatiblity reasons this option will be indefinitely supported however we\n * recommend using `friendlyCase` instead as it's a heavily improved version of this option.\n *\n * @see {opts.friendlyCase}\n * @deprecated\n */\n camelCase?: boolean;\n\n /**\n * Generate a human-friendly, but still camelCase, operation ID when one isn't present. The\n * difference between this and `camelCase` is that this also ensure that consecutive words are\n * not present in the resulting ID. For example, for the endpoint `/candidate/{candidate}` will\n * return `getCandidateCandidate` for `camelCase` however `friendlyCase` will return\n * `getCandidate`.\n *\n * The reason this friendliness is just not a part of the `camelCase` option is because we have\n * a number of consumers of the old operation ID style and making that change there would a\n * breaking change that we don't have any easy way to resolve.\n */\n friendlyCase?: boolean;\n } = {},\n ): string {\n function sanitize(id: string) {\n // We aren't sanitizing underscores here by default in order to preserve operation IDs that\n // were already generated with this method in the past.\n return id\n .replace(opts?.camelCase || opts?.friendlyCase ? /[^a-zA-Z0-9_]/g : /[^a-zA-Z0-9]/g, '-') // Remove weird characters\n .replace(/--+/g, '-') // Remove double --'s\n .replace(/^-|-$/g, ''); // Don't start or end with -\n }\n\n let operationId;\n if (this.hasOperationId()) {\n operationId = this.schema.operationId;\n } else {\n operationId = sanitize(this.path).toLowerCase();\n }\n\n const method = this.method.toLowerCase();\n if (opts?.camelCase || opts?.friendlyCase) {\n if (opts?.friendlyCase) {\n // In order to generate friendlier operation IDs we should swap out underscores with spaces\n // so the end result will be _slightly_ more camelCase.\n operationId = operationId.replaceAll('_', ' ');\n\n if (!this.hasOperationId()) {\n // In another effort to generate friendly operation IDs we should prevent words from\n // appearing in consecutive order (eg. `/candidate/{candidate}` should generate\n // `getCandidate` not `getCandidateCandidate`). However we only want to do this if we're\n // generating the operation ID as if they intentionally added a consecutive word into the\n // operation ID then we should respect that.\n operationId = operationId\n .replace(/[^a-zA-Z0-9_]+(.)/g, (_, chr) => ` ${chr}`)\n .split(' ')\n .filter((word, i, arr) => word !== arr[i - 1])\n .join(' ');\n }\n }\n\n operationId = operationId.replace(/[^a-zA-Z0-9_]+(.)/g, (_, chr) => chr.toUpperCase());\n if (this.hasOperationId()) {\n operationId = sanitize(operationId);\n }\n\n // Never start with a number.\n operationId = operationId.replace(/^[0-9]/g, match => `_${match}`);\n\n // Ensure that the first character of an `operationId` is always lowercase.\n operationId = operationId.charAt(0).toLowerCase() + operationId.slice(1);\n\n // If the generated `operationId` already starts with the method (eg. `getPets`) we don't want\n // to double it up into `getGetPets`.\n if (operationId.startsWith(method)) {\n return operationId;\n }\n\n // If this operation already has an `operationId` and we just cleaned it up then we shouldn't\n // prefix it with an HTTP method.\n if (this.hasOperationId()) {\n return operationId;\n }\n\n // Because we're merging the `operationId` into an HTTP method we need to reset the first\n // character of it back to lowercase so we end up with `getBuster`, not `getbuster`.\n operationId = operationId.charAt(0).toUpperCase() + operationId.slice(1);\n return `${method}${operationId}`;\n } else if (this.hasOperationId()) {\n return operationId;\n }\n\n return `${method}_${operationId}`;\n }\n\n /**\n * Return an array of all tags, and their metadata, that exist on this operation.\n *\n */\n getTags(): RMOAS.TagObject[] {\n if (!('tags' in this.schema)) {\n return [];\n }\n\n const oasTagMap: Map<string, RMOAS.TagObject> = new Map();\n if ('tags' in this.api) {\n this.api.tags.forEach((tag: RMOAS.TagObject) => {\n oasTagMap.set(tag.name, tag);\n });\n }\n\n const oasTags = Object.fromEntries(oasTagMap);\n\n const tags: RMOAS.TagObject[] = [];\n if (Array.isArray(this.schema.tags)) {\n this.schema.tags.forEach(tag => {\n if (tag in oasTags) {\n tags.push(oasTags[tag]);\n } else {\n tags.push({\n name: tag,\n });\n }\n });\n }\n\n return tags;\n }\n\n /**\n * Return is the operation is flagged as `deprecated` or not.\n *\n */\n isDeprecated(): boolean {\n return 'deprecated' in this.schema ? this.schema.deprecated : false;\n }\n\n /**\n * Determine if the operation has any (non-request body) parameters.\n *\n */\n hasParameters() {\n return !!this.getParameters().length;\n }\n\n /**\n * Return the parameters (non-request body) on the operation.\n *\n */\n getParameters(): RMOAS.ParameterObject[] {\n let parameters = (this.schema?.parameters || []) as RMOAS.ParameterObject[];\n const commonParams = (this.api?.paths?.[this.path]?.parameters || []) as RMOAS.ParameterObject[];\n if (commonParams.length) {\n parameters = parameters.concat(dedupeCommonParameters(parameters, commonParams) || []);\n }\n\n return parameters;\n }\n\n /**\n * Determine if this operation has any required parameters.\n *\n */\n hasRequiredParameters() {\n return this.getParameters().some(param => 'required' in param && param.required);\n }\n\n /**\n * Convert the operation into an array of JSON Schema schemas for each available type of\n * parameter available on the operation.\n *\n */\n getParametersAsJSONSchema(opts: getParametersAsJSONSchemaOptions = {}) {\n return getParametersAsJSONSchema(this, this.api, {\n includeDiscriminatorMappingRefs: true,\n transformer: (s: RMOAS.SchemaObject) => s,\n ...opts,\n });\n }\n\n /**\n * Get a single response for this status code, formatted as JSON schema.\n *\n * @param statusCode Status code to pull a JSON Schema response for.\n */\n getResponseAsJSONSchema(\n statusCode: number | string,\n opts: {\n /**\n * If you wish to include discriminator mapping `$ref` components alongside your\n * `discriminator` in schemas. Defaults to `true`.\n */\n includeDiscriminatorMappingRefs?: boolean;\n\n /**\n * With a transformer you can transform any data within a given schema, like say if you want\n * to rewrite a potentially unsafe `title` that might be eventually used as a JS variable\n * name, just make sure to return your transformed schema.\n */\n transformer?: (schema: RMOAS.SchemaObject) => RMOAS.SchemaObject;\n } = {},\n ) {\n return getResponseAsJSONSchema(this, this.api, statusCode, {\n includeDiscriminatorMappingRefs: true,\n transformer: (s: RMOAS.SchemaObject) => s,\n ...opts,\n });\n }\n\n /**\n * Get an array of all valid response status codes for this operation.\n *\n */\n getResponseStatusCodes(): string[] {\n return this.schema.responses ? Object.keys(this.schema.responses) : [];\n }\n\n /**\n * Determine if the operation has any request bodies.\n *\n */\n hasRequestBody(): boolean {\n return !!this.schema.requestBody;\n }\n\n /**\n * Retrieve the list of all available media types that the operations request body can accept.\n *\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#mediaTypeObject}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#mediaTypeObject}\n */\n getRequestBodyMediaTypes() {\n if (!this.hasRequestBody()) {\n return [];\n }\n\n const requestBody = this.schema.requestBody;\n if (RMOAS.isRef(requestBody)) {\n // If the request body is still a `$ref` pointer we should return false because this library\n // assumes that you've run dereferencing beforehand.\n return [];\n }\n\n return Object.keys(requestBody.content);\n }\n\n /**\n * Determine if this operation has a required request body.\n *\n */\n hasRequiredRequestBody() {\n if (!this.hasRequestBody()) {\n return false;\n }\n\n const requestBody = this.schema.requestBody;\n if (RMOAS.isRef(requestBody)) {\n return false;\n }\n\n if (requestBody.required) {\n return true;\n }\n\n // The OpenAPI spec isn't clear on the differentiation between schema `required` and\n // `requestBody.required` because you can have required top-level schema properties but a\n // non-required requestBody that negates each other.\n //\n // To kind of work ourselves around this and present a better QOL for this accessor, if at this\n // final point where we don't have a required request body, but the underlying Media Type Object\n // schema says that it has required properties then we should ultimately recognize that this\n // request body is required -- even as the request body description says otherwise.\n return !!this.getParametersAsJSONSchema()\n .filter(js => ['body', 'formData'].includes(js.type))\n .find(js => js.schema && Array.isArray(js.schema.required) && js.schema.required.length);\n }\n\n /**\n * Retrieve a specific request body content schema off this operation.\n *\n * If no media type is supplied this will return either the first available JSON-like request\n * body, or the first available if there are no JSON-like media types present. When this return\n * comes back it's in the form of an array with the first key being the selected media type,\n * followed by the media type object in question.\n *\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#mediaTypeObject}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#mediaTypeObject}\n * @param mediaType Specific request body media type to retrieve if present.\n */\n getRequestBody(mediaType?: string): RMOAS.MediaTypeObject | false | [string, RMOAS.MediaTypeObject, ...string[]] {\n if (!this.hasRequestBody()) {\n return false;\n }\n\n const requestBody = this.schema.requestBody;\n if (RMOAS.isRef(requestBody)) {\n // If the request body is still a `$ref` pointer we should return false because this library\n // assumes that you've run dereferencing beforehand.\n return false;\n }\n\n if (mediaType) {\n if (!(mediaType in requestBody.content)) {\n return false;\n }\n\n return requestBody.content[mediaType];\n }\n\n // Since no media type was supplied we need to find either the first JSON-like media type that\n // we've got, or the first available of anything else if no JSON-like media types are present.\n let availableMediaType: string;\n const mediaTypes = this.getRequestBodyMediaTypes();\n mediaTypes.forEach((mt: string) => {\n if (!availableMediaType && matchesMimeType.json(mt)) {\n availableMediaType = mt;\n }\n });\n\n if (!availableMediaType) {\n mediaTypes.forEach((mt: string) => {\n if (!availableMediaType) {\n availableMediaType = mt;\n }\n });\n }\n\n if (availableMediaType) {\n return [\n availableMediaType,\n requestBody.content[availableMediaType],\n ...(requestBody.description ? [requestBody.description] : []),\n ];\n }\n\n return false;\n }\n\n /**\n * Retrieve an array of request body examples that this operation has.\n *\n */\n getRequestBodyExamples(): RequestBodyExamples {\n if (this.requestBodyExamples) {\n return this.requestBodyExamples;\n }\n\n this.requestBodyExamples = getRequestBodyExamples(this.schema);\n return this.requestBodyExamples;\n }\n\n /**\n * Return a specific response out of the operation by a given HTTP status code.\n *\n * @param statusCode Status code to pull a response object for.\n */\n getResponseByStatusCode(statusCode: number | string): RMOAS.ResponseObject | boolean {\n if (!this.schema.responses) {\n return false;\n }\n\n if (typeof this.schema.responses[statusCode] === 'undefined') {\n return false;\n }\n\n const response = this.schema.responses[statusCode];\n\n if (RMOAS.isRef(response)) {\n return false;\n }\n\n // Remove the reference from the type, because it will already be dereferenced.\n return response;\n }\n\n /**\n * Retrieve an array of response examples that this operation has.\n *\n */\n getResponseExamples(): ResponseExamples {\n if (this.responseExamples) {\n return this.responseExamples;\n }\n\n // @todo Remove this `as` once we convert getResponseExamples\n this.responseExamples = getResponseExamples(this.schema) as ResponseExamples;\n return this.responseExamples;\n }\n\n /**\n * Determine if the operation has callbacks.\n *\n */\n hasCallbacks(): boolean {\n return !!this.schema.callbacks;\n }\n\n /**\n * Retrieve a specific callback.\n *\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#callbackObject}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#callbackObject}\n * @param identifier Callback identifier to look for.\n * @param expression Callback expression to look for.\n * @param method HTTP Method on the callback to look for.\n */\n getCallback(identifier: string, expression: string, method: RMOAS.HttpMethods): Callback | false {\n if (!this.schema.callbacks) return false;\n\n // The usage of `as` in the below is to remove the possibility of a ref type, since we've\n // dereferenced.\n const callback = this.schema.callbacks[identifier]\n ? (((this.schema.callbacks as Record<string, RMOAS.CallbackObject>)[identifier] as RMOAS.CallbackObject)[\n expression\n ] as RMOAS.PathItemObject)\n : false;\n\n if (!callback || !callback[method]) return false;\n return new Callback(this.api, expression, method, callback[method], identifier, callback);\n }\n\n /**\n * Retrieve an array of operations created from each callback.\n *\n */\n getCallbacks(): (Callback | false)[] | false {\n const callbackOperations: (Callback | false)[] = [];\n if (!this.hasCallbacks()) return false;\n\n Object.keys(this.schema.callbacks).forEach(callback => {\n Object.keys(this.schema.callbacks[callback]).forEach(expression => {\n const cb = this.schema.callbacks[callback];\n\n if (!RMOAS.isRef(cb)) {\n const exp = cb[expression];\n\n if (!RMOAS.isRef(exp)) {\n Object.keys(exp).forEach((method: RMOAS.HttpMethods) => {\n if (!supportedMethods.has(method)) return;\n\n callbackOperations.push(this.getCallback(callback, expression, method));\n });\n }\n }\n });\n });\n\n return callbackOperations;\n }\n\n /**\n * Retrieve an array of callback examples that this operation has.\n *\n */\n getCallbackExamples(): CallbackExamples {\n if (this.callbackExamples) {\n return this.callbackExamples;\n }\n\n this.callbackExamples = getCallbackExamples(this.schema);\n return this.callbackExamples;\n }\n\n /**\n * Determine if a given a custom specification extension exists within the operation.\n *\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#specificationExtensions}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specificationExtensions}\n * @param extension Specification extension to lookup.\n */\n hasExtension(extension: string) {\n return Boolean(this.schema && extension in this.schema);\n }\n\n /**\n * Retrieve a custom specification extension off of the operation.\n *\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#specificationExtensions}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specificationExtensions}\n * @param extension Specification extension to lookup.\n *\n * @deprecated Use `oas.getExtension(extension, operation)` instead.\n */\n getExtension(extension: string | keyof Extensions) {\n return this.schema?.[extension];\n }\n\n /**\n * Returns an object with groups of all example definitions (body/header/query/path/response/etc.).\n * The examples are grouped by their key when defined via the `examples` map.\n *\n * Any custom code samples defined via the `x-readme.code-samples` extension are returned,\n * regardless of if they have a matching response example.\n *\n * For standard OAS request parameter (e.g., body/header/query/path/etc.) examples,\n * they are only present in the return object if they have a corresponding response example\n * (i.e., a response example with the same key in the `examples` map).\n */\n getExampleGroups(): ExampleGroups {\n if (this.exampleGroups) return this.exampleGroups;\n\n const groups = getExampleGroups(this);\n\n this.exampleGroups = groups;\n\n return groups;\n }\n}\n\nexport class Callback extends Operation {\n /**\n * The identifier that this callback is set to.\n */\n identifier: string;\n\n /**\n * The parent path item object that this Callback exists within.\n */\n parentSchema: RMOAS.PathItemObject;\n\n constructor(\n oas: RMOAS.OASDocument,\n path: string,\n method: RMOAS.HttpMethods,\n operation: RMOAS.OperationObject,\n identifier: string,\n parentPathItem: RMOAS.PathItemObject,\n ) {\n super(oas, path, method, operation);\n\n this.identifier = identifier;\n this.parentSchema = parentPathItem;\n }\n\n /**\n * Return the primary identifier for this callback.\n *\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#callback-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#callbackObject}\n */\n getIdentifier(): string {\n return this.identifier;\n }\n\n getSummary(): string {\n if (this.schema?.summary && typeof this.schema.summary === 'string') {\n return this.schema.summary;\n } else if (this.parentSchema.summary && typeof this.parentSchema.summary === 'string') {\n return this.parentSchema.summary;\n }\n\n return undefined;\n }\n\n getDescription(): string {\n if (this.schema?.description && typeof this.schema.description === 'string') {\n return this.schema.description;\n } else if (this.parentSchema.description && typeof this.parentSchema.description === 'string') {\n return this.parentSchema.description;\n }\n\n return undefined;\n }\n\n getParameters(): RMOAS.ParameterObject[] {\n let parameters = (this.schema?.parameters || []) as RMOAS.ParameterObject[];\n const commonParams = (this.parentSchema.parameters || []) as RMOAS.ParameterObject[];\n if (commonParams.length) {\n parameters = parameters.concat(dedupeCommonParameters(parameters, commonParams) || []);\n }\n\n return parameters;\n }\n}\n\nexport class Webhook extends Operation {\n /**\n * OpenAPI API Definition that this webhook originated from.\n */\n declare api: RMOAS.OAS31Document;\n\n getSummary(): string {\n if (this.schema?.summary && typeof this.schema.summary === 'string') {\n return this.schema.summary;\n } else if (this.api.webhooks[this.path].summary && typeof this.api.webhooks[this.path].summary === 'string') {\n return this.api.webhooks[this.path].summary;\n }\n\n return undefined;\n }\n\n getDescription(): string {\n if (this.schema?.description && typeof this.schema.description === 'string') {\n return this.schema.description;\n } else if (\n this.api.webhooks[this.path].description &&\n typeof this.api.webhooks[this.path].description === 'string'\n ) {\n return this.api.webhooks[this.path].description;\n }\n\n return undefined;\n }\n}\n"]}
@@ -14,4 +14,4 @@ function isSchema(check, isPolymorphicAllOfChild = false) {
14
14
 
15
15
 
16
16
  exports.isRef = isRef; exports.isOAS31 = isOAS31; exports.isSchema = isSchema;
17
- //# sourceMappingURL=chunk-WCDZQK62.cjs.map
17
+ //# sourceMappingURL=chunk-6QHUSSDH.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/types.ts"],"names":[],"mappings":";AASO,SAAS,MAAM,OAAkF;AACtG,SAAQ,MAAkE,SAAS;AACrF;AAMO,SAAS,QAAQ,OAAiF;AACvG,SAAO,MAAM,YAAY;AAC3B;AAyMO,SAAS,SAAS,OAAgB,0BAA0B,OAA8B;AAC/F,SACG,MAAuB,SAAS,UAChC,MAAuB,UAAU,UACjC,MAAuB,UAAU,UACjC,MAAuB,UAAU,UAClC;AAEJ","sourcesContent":["import type { JSONSchema4, JSONSchema6, JSONSchema7 } from 'json-schema';\nimport type { OpenAPIV3, OpenAPIV3_1 } from 'openapi-types';\n\nexport type JSONSchema = JSONSchema4 | JSONSchema6 | JSONSchema7;\n\n/**\n * @param check Data to determine if it contains a ReferenceObject (`$ref` pointer`).\n * @returns If the supplied data has a `$ref` pointer.\n */\nexport function isRef(check: unknown): check is OpenAPIV3_1.ReferenceObject | OpenAPIV3.ReferenceObject {\n return (check as OpenAPIV3_1.ReferenceObject | OpenAPIV3.ReferenceObject).$ref !== undefined;\n}\n\n/**\n * @param check API definition to determine if it's a 3.1 definition.\n * @returns If the definition is a 3.1 definition.\n */\nexport function isOAS31(check: OpenAPIV3_1.Document | OpenAPIV3.Document): check is OpenAPIV3_1.Document {\n return check.openapi === '3.1.0';\n}\n\n/**\n * Data shape for taking OpenAPI operation data and converting it into HAR.\n *\n * @see {@link https://github.com/readmeio/oas/tree/main/packages/oas-to-har}\n */\nexport interface DataForHAR {\n body?: any;\n cookie?: Record<string, any>;\n formData?: Record<string, any>; // `application/x-www-form-urlencoded` requests payloads.\n header?: Record<string, any>;\n path?: Record<string, any>;\n query?: Record<string, any>;\n server?: {\n selected: number;\n variables?: Record<string, unknown>;\n };\n}\n\nexport interface User {\n [key: string]: unknown;\n keys?: {\n [key: string]: unknown;\n name: number | string;\n pass?: number | string;\n user?: number | string;\n }[];\n}\n\n/**\n * The type of security scheme. Used by `operation.getSecurityWithTypes()` and `operation.prepareSecurity()`.\n */\nexport type SecurityType = 'apiKey' | 'Basic' | 'Bearer' | 'Cookie' | 'Header' | 'http' | 'OAuth2' | 'Query';\n\nexport type HttpMethods =\n | OpenAPIV3_1.HttpMethods\n | OpenAPIV3.HttpMethods\n | 'delete'\n | 'get'\n | 'head'\n | 'options'\n | 'patch'\n | 'post'\n | 'put'\n | 'trace';\n\n// The following are custom OpenAPI types that we use throughout this library, sans\n// `ReferenceObject` because we assume that the API definition has been dereferenced.\n//\n// These are organized by how they're defined in the OpenAPI Specification.\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#oasObject}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#oasObject}\n */\n// eslint-disable-next-line @typescript-eslint/sort-type-constituents\nexport type OASDocument = (OpenAPIV3_1.Document | OpenAPIV3.Document) &\n // `x-*` extensions\n Record<string, unknown>;\n\nexport type OAS31Document = OpenAPIV3_1.Document &\n // `x-*` extensions\n Record<string, unknown>;\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#serverObject}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#serverObject}\n */\nexport type ServerObject = OpenAPIV3_1.ServerObject | OpenAPIV3.ServerObject;\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#serverVariableObject}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#serverVariableObject}\n */\nexport type ServerVariableObject = OpenAPIV3_1.ServerVariableObject | OpenAPIV3.ServerVariableObject;\nexport type ServerVariablesObject = Record<string, ServerVariableObject>;\nexport type ServerVariable = Record<\n string,\n { default?: number | string }[] | Record<string, never> | number | string | { default?: number | string }\n>;\n\nexport interface Servers {\n selected: number;\n variables: ServerVariable;\n}\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#componentsObject}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#componentsObject}\n */\nexport type ComponentsObject = OpenAPIV3_1.ComponentsObject | OpenAPIV3.ComponentsObject;\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#pathsObject}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#pathsObject}\n */\nexport type PathsObject = OpenAPIV3_1.PathsObject | OpenAPIV3.PathsObject;\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#pathItemObject}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#pathItemObject}\n */\nexport type PathItemObject = OpenAPIV3_1.PathItemObject | OpenAPIV3.PathItemObject;\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#operationObject}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#operationObject}\n */\n// eslint-disable-next-line @typescript-eslint/sort-type-constituents\nexport type OperationObject = (OpenAPIV3_1.OperationObject | OpenAPIV3.OperationObject) &\n // `x-*` extensions\n Record<string, unknown>;\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#parameterObject}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterObject}\n */\nexport type ParameterObject = {\n in: 'cookie' | 'header' | 'path' | 'query';\n} & (OpenAPIV3_1.ParameterObject | OpenAPIV3.ParameterObject);\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#requestBodyObject}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#requestBodyObject}\n */\nexport type RequestBodyObject = OpenAPIV3_1.RequestBodyObject | OpenAPIV3.RequestBodyObject;\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#mediaTypeObject}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#mediaTypeObject}\n */\nexport type MediaTypeObject = OpenAPIV3_1.MediaTypeObject | OpenAPIV3.MediaTypeObject;\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#responseObject}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#responseObject}\n */\nexport type ResponseObject = OpenAPIV3_1.ResponseObject | OpenAPIV3.ResponseObject;\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#callbackObject}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#callbackObject}\n */\nexport type CallbackObject = OpenAPIV3_1.CallbackObject | OpenAPIV3.CallbackObject;\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#exampleObject}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.3.md#exampleObject}\n */\nexport type ExampleObject = OpenAPIV3_1.ExampleObject | OpenAPIV3.ExampleObject;\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#tagObject}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#tagObject}\n */\nexport type TagObject = OpenAPIV3_1.TagObject | OpenAPIV3.TagObject;\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#headerObject}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#headerObject}\n */\nexport type HeaderObject = OpenAPIV3_1.HeaderObject | OpenAPIV3.HeaderObject;\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#schemaObject}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#schemaObject}\n */\nexport type SchemaObject = {\n // OpenAPI-specific properties\n externalDocs?: unknown;\n xml?: unknown;\n} & {\n // TODO: We should split this into one type for v3 and one type for v3.1 to ensure type accuracy.\n $schema?: string;\n\n // We add this to the schema to help out with circular refs\n components?: OpenAPIV3_1.ComponentsObject;\n\n deprecated?: boolean;\n example?: unknown;\n examples?: unknown[];\n nullable?: boolean;\n readOnly?: boolean;\n writeOnly?: boolean;\n\n // We add this extension within our dereferencing work to preserve the origin dereferenced\n // schemas.\n 'x-readme-ref-name'?: string;\n} & ( // eslint-disable-next-line @typescript-eslint/sort-type-constituents\n | OpenAPIV3.SchemaObject\n | OpenAPIV3_1.SchemaObject\n // Adding `JSONSchema` to this because `json-schema-merge-allof` expects those.\n | JSONSchema\n );\n\n/**\n * @param check JSON Schema object to determine if it's a non-polymorphic schema.\n * @param isPolymorphicAllOfChild If this JSON Schema object is the child of a polymorphic `allOf`.\n * @returns If the JSON Schema object is a JSON Schema object.\n */\nexport function isSchema(check: unknown, isPolymorphicAllOfChild = false): check is SchemaObject {\n return (\n (check as SchemaObject).type !== undefined ||\n (check as SchemaObject).allOf !== undefined ||\n (check as SchemaObject).anyOf !== undefined ||\n (check as SchemaObject).oneOf !== undefined ||\n isPolymorphicAllOfChild\n );\n}\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#securitySchemeObject}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#securitySchemeObject}\n */\nexport type SecuritySchemeObject = OpenAPIV3_1.SecuritySchemeObject | OpenAPIV3.SecuritySchemeObject;\n\nexport type SecuritySchemesObject = Record<string, SecuritySchemeObject>;\n\nexport type KeyedSecuritySchemeObject = SecuritySchemeObject & {\n /**\n * The key for the given security scheme object\n */\n _key: string;\n\n /**\n * An array of required scopes for the given security scheme object.\n * Used for `oauth2` security scheme types.\n */\n _requirements?: string[];\n\n // `x-default` is our custom extension for specifying auth defaults.\n // https://docs.readme.com/docs/openapi-extensions#authentication-defaults\n 'x-default'?: number | string;\n};\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#securityRequirementObject}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#securityRequirementObject}\n */\nexport type SecurityRequirementObject = OpenAPIV3_1.SecurityRequirementObject | OpenAPIV3.SecurityRequirementObject;\n"]}