oas 28.2.0 → 28.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/analyzer/index.cjs +7 -7
- package/dist/analyzer/index.js +5 -5
- package/dist/chunk-47ELBTA5.js +32 -0
- package/dist/chunk-47ELBTA5.js.map +1 -0
- package/dist/{chunk-N37BGVKV.cjs → chunk-6JSHPV2O.cjs} +1 -1
- package/dist/chunk-6JSHPV2O.cjs.map +1 -0
- package/dist/{chunk-WCXAO744.cjs → chunk-DUQ3BL5H.cjs} +19 -19
- package/dist/{chunk-WCXAO744.cjs.map → chunk-DUQ3BL5H.cjs.map} +1 -1
- package/dist/{chunk-J5RLIWSD.js → chunk-FISLBMFJ.js} +4 -4
- package/dist/{chunk-FHMF4CEN.js → chunk-NBQXNFZT.js} +1 -1
- package/dist/chunk-NBQXNFZT.js.map +1 -0
- package/dist/{chunk-5H5ODYVE.cjs → chunk-R33HRXQA.cjs} +29 -29
- package/dist/{chunk-5H5ODYVE.cjs.map → chunk-R33HRXQA.cjs.map} +1 -1
- package/dist/{chunk-ATLAOOV5.js → chunk-SVQE2R3T.js} +5 -5
- package/dist/{chunk-ATLAOOV5.js.map → chunk-SVQE2R3T.js.map} +1 -1
- package/dist/{chunk-FBOFXOMD.js → chunk-TRLQJSYU.js} +4 -4
- package/dist/chunk-UZVIB6QV.cjs +32 -0
- package/dist/chunk-UZVIB6QV.cjs.map +1 -0
- package/dist/{chunk-YKTDUFLY.cjs → chunk-ZGCROLGH.cjs} +13 -13
- package/dist/chunk-ZGCROLGH.cjs.map +1 -0
- package/dist/{extensions-CJIHlfU6.d.ts → extensions-DAFceEIL.d.ts} +14 -1
- package/dist/{extensions-HnzLmmuw.d.cts → extensions-DlGC1TJ1.d.cts} +14 -1
- package/dist/extensions.cjs +2 -2
- package/dist/extensions.d.cts +1 -1
- package/dist/extensions.d.ts +1 -1
- package/dist/extensions.js +1 -1
- package/dist/index.cjs +6 -6
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -5
- package/dist/operation/index.cjs +5 -5
- package/dist/operation/index.d.cts +1 -1
- package/dist/operation/index.d.ts +1 -1
- package/dist/operation/index.js +4 -4
- package/dist/operation/lib/get-parameters-as-json-schema.cjs +4 -4
- package/dist/operation/lib/get-parameters-as-json-schema.d.cts +1 -1
- package/dist/operation/lib/get-parameters-as-json-schema.d.ts +1 -1
- package/dist/operation/lib/get-parameters-as-json-schema.js +3 -3
- package/dist/types.cjs +10 -2
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +24 -2
- package/dist/types.d.ts +24 -2
- package/dist/types.js +11 -3
- package/dist/utils.cjs +4 -4
- package/dist/utils.d.cts +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +3 -3
- package/package.json +4 -4
- package/dist/chunk-EQEXNJJE.cjs +0 -17
- package/dist/chunk-EQEXNJJE.cjs.map +0 -1
- package/dist/chunk-FHMF4CEN.js.map +0 -1
- package/dist/chunk-N37BGVKV.cjs.map +0 -1
- package/dist/chunk-UCEHCARG.js +0 -17
- package/dist/chunk-UCEHCARG.js.map +0 -1
- package/dist/chunk-YKTDUFLY.cjs.map +0 -1
- /package/dist/{chunk-J5RLIWSD.js.map → chunk-FISLBMFJ.js.map} +0 -0
- /package/dist/{chunk-FBOFXOMD.js.map → chunk-TRLQJSYU.js.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/extensions.ts"],"sourcesContent":["import type { Operation } from './operation/index.js';\nimport type { OASDocument } from './types.js';\n\n/**\n * Enables custom-written code samples to be set for your operations. Use this if you have specific\n * formatting that may not be followed by the auto-generated code samples. Custom code samples are\n * treated as static content.\n *\n * This extension only be placed at the operation level.\n *\n * @defaultValue []\n * @see {@link https://docs.readme.com/main/docs/openapi-extensions#custom-code-samples}\n * @example\n * {\n * \"x-readme\": {\n * \"code-samples\": [\n * {\n * \"language\": \"curl\",\n * \"code\": \"curl -X POST https://api.example.com/v2/alert\",\n * \"name\": \"Custom cURL snippet\",\n * \"install\": \"brew install curl\"\n * },\n * {\n * \"language\": \"php\",\n * \"code\": \"<?php echo \\\"This is our custom PHP code snippet.\\\"; ?>\",\n * \"name\": \"Custom PHP snippet\"\n * }\n * ]\n * }\n * }\n */\nexport const CODE_SAMPLES = 'code-samples';\n\n/**\n * Disables the API Explorer's \"Try It\" button, preventing users from making API requests from\n * within your docs. Users will still be able to fill out any entry fields (path or query\n * parameters, etc.), and code snippets will be auto-generated based on the user's input, however\n * to interact with your API the user will need to copy the code snippet and execute it outside of\n * your docs.\n *\n * This **does not** disable your API Reference documentation.\n *\n * @defaultValue true\n * @see {@link https://docs.readme.com/main/docs/openapi-extensions#disable-the-api-explorer}\n * @example\n * {\n * \"x-readme\": {\n * \"explorer-enabled\": true\n * }\n * }\n */\nexport const EXPLORER_ENABLED = 'explorer-enabled';\n\n/**\n * Adds static headers to add to each request. Use this when there are specific headers unique to\n * your API.\n *\n * @defaultValue []\n * @see {@link https://docs.readme.com/main/docs/openapi-extensions#static-headers}\n * @example\n * {\n * \"x-readme\": {\n * \"headers\": [\n * {\n * \"key\": \"X-Static-Header-One\",\n * \"value\": \"owlbert\"\n * },\n * {\n * \"key\": \"X-Static-Header-Two\",\n * \"value\": \"owlivia\"\n * }\n * ]\n * }\n * }\n */\nexport const HEADERS = 'headers';\n\n/**\n * Disables API requests from the API Explorer's \"Try It\" button from being sent into our [API\n * Metrics](https://readme.com/metrics) for you and your users. Additionally on any API endpoint\n * that this is disabled on your users will not see lists or graphs of previous requests they've\n * made against that API endpoint — either through the API Explorer's interactivity or through one\n * of our [Metrics SDKs](https://docs.readme.com/main/docs/api-metrics-setup) (if you have those\n * installed on your API).\n *\n * @defaultValue true\n * @see {@link https://docs.readme.com/main/docs/openapi-extensions#disable-api-metrics}\n * @example\n * {\n * \"x-readme\": {\n * \"metrics-defaults\": false\n * }\n * }\n */\nexport const METRICS_ENABLED = 'metrics-enabled';\n\n/**\n * Configuration options for OAuth flows in the API Explorer.\n *\n * @defaultValue {}\n * @see {@link https://docs.readme.com/main/docs/openapi-extensions#oauth-configuration-options}\n * @example\n * {\n * \"x-readme\": {\n * \"oauth-options\": {\n * \"scopeSeparator\": \",\",\n * \"useInsecureClientAuthentication\": true,\n * \"usePkce\": false\n * }\n * }\n * }\n */\nexport const OAUTH_OPTIONS = 'oauth-options';\n\n/**\n * Controls the order of parameters on your API Reference pages.\n *\n * Your custom ordering **must** contain all of our available parameter types:\n *\n * - `path`: Path parameters\n * - `query`: Query parameters\n * - `body`: Non-`application/x-www-form-urlencoded` request body payloads\n * - `cookie`: Cookie parameters\n * - `form`: `application/x-www-form-urlencoded` request body payloads\n * - `header`: Header parameters\n *\n * @defaultValue ['path', 'query', 'body', 'cookie', 'form', 'header']\n * @see {@link https://docs.readme.com/main/docs/openapi-extensions#parameter-ordering}\n * @example\n * {\n * \"x-readme\": {\n * \"parameter-ordering\": ['path', 'query', 'header', 'cookie', 'body', 'form']\n * }\n * }\n */\nexport const PARAMETER_ORDERING = 'parameter-ordering';\n\n/**\n * Toggles the CORS proxy used when making API requests from within your docs (via the \"Try It\"\n * button). If your API is already set up to return CORS headers, you can safely disable this\n * feature.\n *\n * Disabling the CORS proxy will make the request directly from the user's browser and will prevent\n * [Metrics](https://docs.readme.com/main/docs/getting-started-with-metrics) data from being logged\n * by us unless [Metrics have already set up on your backend](https://docs.readme.com/main/docs/api-metrics-setup).\n *\n * @defaultValue true\n * @see {@link https://docs.readme.com/main/docs/openapi-extensions#cors-proxy-enabled}\n * @example\n * {\n * \"x-readme\": {\n * \"proxy-enabled\": true\n * }\n * }\n */\nexport const PROXY_ENABLED = 'proxy-enabled';\n\n/**\n * Toggles what languages are shown by default for code samples in the API Explorer. This only\n * affects what languages are initially shown to the user; if the user picks another language from\n * the three-dot menu, that language and the respective auto-generated code snippet will also appear\n * as an option in the API Explorer.\n *\n * @defaultValue ['shell', 'node', 'ruby', 'php', 'python', 'java', 'csharp']\n * @see {@link https://docs.readme.com/main/docs/openapi-extensions#code-sample-languages}\n * @example\n * {\n * \"x-readme\": {\n * \"samples-languages\": [\"shell\", \"node\", \"ruby\", \"javascript\", \"python\"]\n * }\n * }\n */\nexport const SAMPLES_LANGUAGES = 'samples-languages';\n\n/**\n * Toggles if you will see code snippets for ReadMe's SDK code generator tool `api`.\n *\n * @defaultValue true\n * @see {@link https://api.readme.dev}\n * @example\n * {\n * \"x-readme\": {\n * \"simple-mode\": false\n * }\n * }\n */\nexport const SIMPLE_MODE = 'simple-mode';\n\n/**\n * If `true`, tags are generated from the file top-down. If `false`, we sort the tags\n * based off the `tags` array in the OAS file.\n *\n * @defaultValue false\n * @see {@link https://docs.readme.com/main/docs/openapi-extensions#disable-tag-sorting}\n * @example\n * {\n * \"x-readme\": {\n * \"disable-tag-sorting\": true\n * }\n * }\n */\nexport const DISABLE_TAG_SORTING = 'disable-tag-sorting';\n\nexport interface Extensions {\n [CODE_SAMPLES]: {\n /**\n * Custom code snippet\n * @example \"curl -X POST https://api.example.com/v2/alert\"\n */\n code: string;\n /**\n * Corresponding response example\n * @see {@link https://docs.readme.com/main/docs/openapi-extensions#corresponding-response-examples}\n */\n correspondingExample?: string;\n /**\n * Library installation instructions\n * @example \"brew install httpie\"\n * @example \"npm install node-fetch@2 --save\"\n */\n install?: string;\n /**\n * Language for syntax highlighting\n * @example shell\n */\n language: string;\n /**\n * Optional title for code sample\n * @example \"Custom cURL snippet\"\n */\n name?: string;\n }[];\n [DISABLE_TAG_SORTING]: boolean;\n [EXPLORER_ENABLED]: boolean;\n [HEADERS]: Record<string, number | string>[];\n [METRICS_ENABLED]: boolean;\n [OAUTH_OPTIONS]: {\n /**\n * Scope separator for passing scopes. This value will be URL-encoded.\n *\n * @example \",\"\n * @example \"+\"\n * @default \" \"\n * @see {@link https://datatracker.ietf.org/doc/html/rfc6749#section-3.3} Scope separators information from OAuth 2.0 specification\n */\n scopeSeparator?: string;\n\n /**\n * When enabled, the client credentials (i.e., `client_id` and `client_secret`) are sent in the request body (NOT recommended).\n * When disabled (the default), client credentials are sent using the HTTP Basic Authentication scheme.\n *\n * This is applicable for all requests to the token endpoint.\n *\n * @see {@link https://datatracker.ietf.org/doc/html/rfc6749#section-2.3.1}\n * @see {@link https://datatracker.ietf.org/doc/html/rfc6749#section-3.2}\n *\n * @example true\n * @default false\n */\n useInsecureClientAuthentication?: boolean;\n\n /**\n * When enabled, uses PKCE (Proof Key for Code Exchange) for the authorization code flow.\n * The client secret is replaced with an auto-generated code verifier and code challenge.\n * When disabled, uses the standard OAuth 2.0 authorization code flow with client credentials.\n *\n * @see {@link https://datatracker.ietf.org/doc/html/rfc7636#section-4.1}\n * @see {@link https://datatracker.ietf.org/doc/html/rfc7636#section-4.2}\n *\n * @example true\n * @default false\n */\n usePkce?: boolean;\n };\n [PARAMETER_ORDERING]: ('body' | 'cookie' | 'form' | 'header' | 'path' | 'query')[];\n [PROXY_ENABLED]: boolean;\n [SAMPLES_LANGUAGES]: string[];\n [SIMPLE_MODE]: boolean;\n}\n\nexport const extensionDefaults: Extensions = {\n [CODE_SAMPLES]: undefined,\n [DISABLE_TAG_SORTING]: false,\n [EXPLORER_ENABLED]: true,\n [HEADERS]: undefined,\n [METRICS_ENABLED]: true,\n [OAUTH_OPTIONS]: {},\n [PARAMETER_ORDERING]: ['path', 'query', 'body', 'cookie', 'form', 'header'],\n [PROXY_ENABLED]: true,\n [SAMPLES_LANGUAGES]: ['shell', 'node', 'ruby', 'php', 'python', 'java', 'csharp'],\n [SIMPLE_MODE]: true,\n};\n\n/**\n * Determing if an OpenAPI definition has an extension set in its root schema.\n *\n */\nexport function hasRootExtension(extension: string | keyof Extensions, api: OASDocument): boolean {\n return Boolean(api && extension in api);\n}\n\n/**\n * Retrieve a custom specification extension off of the API definition.\n *\n */\nexport function getExtension(extension: string | keyof Extensions, api: OASDocument, operation?: Operation): any {\n if (operation) {\n if (operation.hasExtension('x-readme')) {\n const data = operation.getExtension('x-readme') as Extensions;\n if (data && typeof data === 'object' && extension in data) {\n return data[extension as keyof Extensions];\n }\n }\n\n if (operation.hasExtension(`x-${extension}`)) {\n return operation.getExtension(`x-${extension}`);\n } else if (operation.hasExtension(extension)) {\n return operation.getExtension(extension);\n }\n }\n\n // Because our `code-samples` extension is intended for operation-level use, if it's instead\n // placed at the API definition root level then we should ignore it and return our set defaults.\n if (extension === CODE_SAMPLES) {\n return extensionDefaults[extension];\n }\n\n if (hasRootExtension('x-readme', api)) {\n const data = api?.['x-readme'] as Extensions;\n if (data && typeof data === 'object' && extension in data) {\n return data[extension as keyof Extensions];\n }\n }\n\n if (hasRootExtension(`x-${extension}`, api)) {\n return api?.[`x-${extension}`];\n } else if (hasRootExtension(extension, api)) {\n return api?.[extension];\n }\n\n // If this is otherwise an extension of our own then we should return the default value for it.\n if (extension in extensionDefaults) {\n return extensionDefaults[extension as keyof Extensions];\n }\n\n return undefined;\n}\n\n/**\n * Validate that the data for an instanceof our `PARAMETER_ORDERING` extension is properly\n * configured.\n *\n * @private\n */\nexport function validateParameterOrdering(\n ordering: (typeof extensionDefaults)[typeof PARAMETER_ORDERING] | undefined,\n extension: string,\n): void {\n const defaultValue = extensionDefaults[PARAMETER_ORDERING];\n const requiredLength = defaultValue.length;\n const defaultsHuman = `${defaultValue.slice(0, -1).join(', ')}, and ${defaultValue.slice(-1)}`;\n\n if (ordering.length !== requiredLength) {\n throw new TypeError(`\"${extension}\" must contain ${requiredLength} items comprised of: ${defaultsHuman}`);\n }\n\n const intersection = ordering.filter(value => defaultValue.includes(value.toLowerCase() as any));\n if (intersection.length !== requiredLength) {\n throw new TypeError(`\"${extension}\" must contain ${requiredLength} items comprised of: ${defaultsHuman}`);\n }\n}\n"],"mappings":";AA+BO,IAAM,eAAe;AAoBrB,IAAM,mBAAmB;AAwBzB,IAAM,UAAU;AAmBhB,IAAM,kBAAkB;AAkBxB,IAAM,gBAAgB;AAuBtB,IAAM,qBAAqB;AAoB3B,IAAM,gBAAgB;AAiBtB,IAAM,oBAAoB;AAc1B,IAAM,cAAc;AAepB,IAAM,sBAAsB;AA+E5B,IAAM,oBAAgC;AAAA,EAC3C,CAAC,YAAY,GAAG;AAAA,EAChB,CAAC,mBAAmB,GAAG;AAAA,EACvB,CAAC,gBAAgB,GAAG;AAAA,EACpB,CAAC,OAAO,GAAG;AAAA,EACX,CAAC,eAAe,GAAG;AAAA,EACnB,CAAC,aAAa,GAAG,CAAC;AAAA,EAClB,CAAC,kBAAkB,GAAG,CAAC,QAAQ,SAAS,QAAQ,UAAU,QAAQ,QAAQ;AAAA,EAC1E,CAAC,aAAa,GAAG;AAAA,EACjB,CAAC,iBAAiB,GAAG,CAAC,SAAS,QAAQ,QAAQ,OAAO,UAAU,QAAQ,QAAQ;AAAA,EAChF,CAAC,WAAW,GAAG;AACjB;AAMO,SAAS,iBAAiB,WAAsC,KAA2B;AAChG,SAAO,QAAQ,OAAO,aAAa,GAAG;AACxC;AAMO,SAAS,aAAa,WAAsC,KAAkB,WAA4B;AAC/G,MAAI,WAAW;AACb,QAAI,UAAU,aAAa,UAAU,GAAG;AACtC,YAAM,OAAO,UAAU,aAAa,UAAU;AAC9C,UAAI,QAAQ,OAAO,SAAS,YAAY,aAAa,MAAM;AACzD,eAAO,KAAK,SAA6B;AAAA,MAC3C;AAAA,IACF;AAEA,QAAI,UAAU,aAAa,KAAK,SAAS,EAAE,GAAG;AAC5C,aAAO,UAAU,aAAa,KAAK,SAAS,EAAE;AAAA,IAChD,WAAW,UAAU,aAAa,SAAS,GAAG;AAC5C,aAAO,UAAU,aAAa,SAAS;AAAA,IACzC;AAAA,EACF;AAIA,MAAI,cAAc,cAAc;AAC9B,WAAO,kBAAkB,SAAS;AAAA,EACpC;AAEA,MAAI,iBAAiB,YAAY,GAAG,GAAG;AACrC,UAAM,OAAO,MAAM,UAAU;AAC7B,QAAI,QAAQ,OAAO,SAAS,YAAY,aAAa,MAAM;AACzD,aAAO,KAAK,SAA6B;AAAA,IAC3C;AAAA,EACF;AAEA,MAAI,iBAAiB,KAAK,SAAS,IAAI,GAAG,GAAG;AAC3C,WAAO,MAAM,KAAK,SAAS,EAAE;AAAA,EAC/B,WAAW,iBAAiB,WAAW,GAAG,GAAG;AAC3C,WAAO,MAAM,SAAS;AAAA,EACxB;AAGA,MAAI,aAAa,mBAAmB;AAClC,WAAO,kBAAkB,SAA6B;AAAA,EACxD;AAEA,SAAO;AACT;AAQO,SAAS,0BACd,UACA,WACM;AACN,QAAM,eAAe,kBAAkB,kBAAkB;AACzD,QAAM,iBAAiB,aAAa;AACpC,QAAM,gBAAgB,GAAG,aAAa,MAAM,GAAG,EAAE,EAAE,KAAK,IAAI,CAAC,SAAS,aAAa,MAAM,EAAE,CAAC;AAE5F,MAAI,SAAS,WAAW,gBAAgB;AACtC,UAAM,IAAI,UAAU,IAAI,SAAS,kBAAkB,cAAc,wBAAwB,aAAa,EAAE;AAAA,EAC1G;AAEA,QAAM,eAAe,SAAS,OAAO,WAAS,aAAa,SAAS,MAAM,YAAY,CAAQ,CAAC;AAC/F,MAAI,aAAa,WAAW,gBAAgB;AAC1C,UAAM,IAAI,UAAU,IAAI,SAAS,kBAAkB,cAAc,wBAAwB,aAAa,EAAE;AAAA,EAC1G;AACF;","names":[]}
|
|
@@ -10,13 +10,13 @@ var _chunk4DBNE7RJcjs = require('./chunk-4DBNE7RJ.cjs');
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _chunkZGCROLGHcjs = require('./chunk-ZGCROLGH.cjs');
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _chunk6JSHPV2Ocjs = require('./chunk-6JSHPV2O.cjs');
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
var
|
|
19
|
+
var _chunkUZVIB6QVcjs = require('./chunk-UZVIB6QV.cjs');
|
|
20
20
|
|
|
21
21
|
// src/operation/lib/dedupe-common-parameters.ts
|
|
22
22
|
function dedupeCommonParameters(parameters, commonParameters) {
|
|
@@ -24,7 +24,7 @@ function dedupeCommonParameters(parameters, commonParameters) {
|
|
|
24
24
|
return !parameters.find((param2) => {
|
|
25
25
|
if (param.name && param2.name) {
|
|
26
26
|
return param.name === param2.name && param.in === param2.in;
|
|
27
|
-
} else if (
|
|
27
|
+
} else if (_chunkUZVIB6QVcjs.isRef.call(void 0, param) && _chunkUZVIB6QVcjs.isRef.call(void 0, param2)) {
|
|
28
28
|
return param.$ref === param2.$ref;
|
|
29
29
|
}
|
|
30
30
|
return false;
|
|
@@ -48,7 +48,7 @@ function usesPolymorphism(schema) {
|
|
|
48
48
|
return false;
|
|
49
49
|
}
|
|
50
50
|
function objectify(thing) {
|
|
51
|
-
if (!
|
|
51
|
+
if (!_chunkZGCROLGHcjs.isObject.call(void 0, thing)) {
|
|
52
52
|
return {};
|
|
53
53
|
}
|
|
54
54
|
return thing;
|
|
@@ -257,7 +257,7 @@ function getMediaTypeExamples(mediaType, mediaTypeObject, opts = {}) {
|
|
|
257
257
|
}
|
|
258
258
|
}
|
|
259
259
|
if (mediaTypeObject.schema) {
|
|
260
|
-
if (!
|
|
260
|
+
if (!_chunkZGCROLGHcjs.matches_mimetype_default.xml(mediaType)) {
|
|
261
261
|
return [
|
|
262
262
|
{
|
|
263
263
|
value: samples_default(JSON.parse(JSON.stringify(mediaTypeObject.schema)), opts)
|
|
@@ -273,7 +273,7 @@ function getResponseExamples(operation) {
|
|
|
273
273
|
return Object.keys(operation.responses || {}).map((status) => {
|
|
274
274
|
const response = operation.responses[status];
|
|
275
275
|
let onlyHeaders = false;
|
|
276
|
-
if (
|
|
276
|
+
if (_chunkUZVIB6QVcjs.isRef.call(void 0, response)) {
|
|
277
277
|
return false;
|
|
278
278
|
}
|
|
279
279
|
const mediaTypes = {};
|
|
@@ -354,7 +354,7 @@ function getDefaultName(sample, count) {
|
|
|
354
354
|
function getExampleGroups(operation) {
|
|
355
355
|
const namelessCodeSampleCounts = {};
|
|
356
356
|
const groups = {};
|
|
357
|
-
const codeSamples =
|
|
357
|
+
const codeSamples = _chunk6JSHPV2Ocjs.getExtension.call(void 0, "code-samples", operation.api, operation);
|
|
358
358
|
_optionalChain([codeSamples, 'optionalAccess', _11 => _11.forEach, 'call', _12 => _12((sample, i) => {
|
|
359
359
|
if (namelessCodeSampleCounts[sample.language]) {
|
|
360
360
|
namelessCodeSampleCounts[sample.language] += 1;
|
|
@@ -446,7 +446,7 @@ function getRequestBodyExamples(operation) {
|
|
|
446
446
|
}
|
|
447
447
|
|
|
448
448
|
// src/operation/lib/get-response-as-json-schema.ts
|
|
449
|
-
var isJSON =
|
|
449
|
+
var isJSON = _chunkZGCROLGHcjs.matches_mimetype_default.json;
|
|
450
450
|
function buildHeadersSchema(response, opts) {
|
|
451
451
|
const headers = response.headers;
|
|
452
452
|
const headersSchema = {
|
|
@@ -456,7 +456,7 @@ function buildHeadersSchema(response, opts) {
|
|
|
456
456
|
Object.keys(headers).forEach((key) => {
|
|
457
457
|
if (headers[key] && headers[key].schema) {
|
|
458
458
|
const header = headers[key];
|
|
459
|
-
headersSchema.properties[key] =
|
|
459
|
+
headersSchema.properties[key] = _chunkZGCROLGHcjs.toJSONSchema.call(void 0, header.schema, {
|
|
460
460
|
addEnumsToDescriptions: true,
|
|
461
461
|
transformer: opts.transformer
|
|
462
462
|
});
|
|
@@ -500,7 +500,7 @@ function getResponseAsJSONSchema(operation, api, statusCode, opts) {
|
|
|
500
500
|
}
|
|
501
501
|
for (let i = 0; i < contentTypes.length; i++) {
|
|
502
502
|
if (isJSON(contentTypes[i])) {
|
|
503
|
-
return
|
|
503
|
+
return _chunkZGCROLGHcjs.toJSONSchema.call(void 0, _chunkZGCROLGHcjs.cloneObject.call(void 0, content[contentTypes[i]].schema), {
|
|
504
504
|
addEnumsToDescriptions: true,
|
|
505
505
|
refLogger,
|
|
506
506
|
transformer: opts.transformer
|
|
@@ -508,7 +508,7 @@ function getResponseAsJSONSchema(operation, api, statusCode, opts) {
|
|
|
508
508
|
}
|
|
509
509
|
}
|
|
510
510
|
const contentType = contentTypes.shift();
|
|
511
|
-
return
|
|
511
|
+
return _chunkZGCROLGHcjs.toJSONSchema.call(void 0, _chunkZGCROLGHcjs.cloneObject.call(void 0, content[contentType].schema), {
|
|
512
512
|
addEnumsToDescriptions: true,
|
|
513
513
|
refLogger,
|
|
514
514
|
transformer: opts.transformer
|
|
@@ -516,15 +516,15 @@ function getResponseAsJSONSchema(operation, api, statusCode, opts) {
|
|
|
516
516
|
}
|
|
517
517
|
const foundSchema = getPreferredSchema(response.content);
|
|
518
518
|
if (foundSchema) {
|
|
519
|
-
const schema =
|
|
519
|
+
const schema = _chunkZGCROLGHcjs.cloneObject.call(void 0, foundSchema);
|
|
520
520
|
const schemaWrapper = {
|
|
521
521
|
// If there's no `type` then the root schema is a circular `$ref` that we likely won't be
|
|
522
522
|
// able to render so instead of generating a JSON Schema with an `undefined` type we should
|
|
523
523
|
// default to `string` so there's at least *something* the end-user can interact with.
|
|
524
524
|
type: foundSchema.type || "string",
|
|
525
|
-
schema:
|
|
525
|
+
schema: _chunkZGCROLGHcjs.isPrimitive.call(void 0, schema) ? schema : {
|
|
526
526
|
...schema,
|
|
527
|
-
$schema:
|
|
527
|
+
$schema: _chunkZGCROLGHcjs.getSchemaVersionString.call(void 0, schema, api)
|
|
528
528
|
},
|
|
529
529
|
label: "Response body"
|
|
530
530
|
};
|
|
@@ -678,23 +678,23 @@ var Operation = class {
|
|
|
678
678
|
this.contentType = types[0];
|
|
679
679
|
}
|
|
680
680
|
types.forEach((t) => {
|
|
681
|
-
if (
|
|
681
|
+
if (_chunkZGCROLGHcjs.matches_mimetype_default.json(t)) {
|
|
682
682
|
this.contentType = t;
|
|
683
683
|
}
|
|
684
684
|
});
|
|
685
685
|
return this.contentType;
|
|
686
686
|
}
|
|
687
687
|
isFormUrlEncoded() {
|
|
688
|
-
return
|
|
688
|
+
return _chunkZGCROLGHcjs.matches_mimetype_default.formUrlEncoded(this.getContentType());
|
|
689
689
|
}
|
|
690
690
|
isMultipart() {
|
|
691
|
-
return
|
|
691
|
+
return _chunkZGCROLGHcjs.matches_mimetype_default.multipart(this.getContentType());
|
|
692
692
|
}
|
|
693
693
|
isJson() {
|
|
694
|
-
return
|
|
694
|
+
return _chunkZGCROLGHcjs.matches_mimetype_default.json(this.getContentType());
|
|
695
695
|
}
|
|
696
696
|
isXml() {
|
|
697
|
-
return
|
|
697
|
+
return _chunkZGCROLGHcjs.matches_mimetype_default.xml(this.getContentType());
|
|
698
698
|
}
|
|
699
699
|
/**
|
|
700
700
|
* Checks if the current operation is a webhook or not.
|
|
@@ -939,7 +939,7 @@ var Operation = class {
|
|
|
939
939
|
*
|
|
940
940
|
*/
|
|
941
941
|
getParametersAsJSONSchema(opts = {}) {
|
|
942
|
-
return
|
|
942
|
+
return _chunkZGCROLGHcjs.getParametersAsJSONSchema.call(void 0, this, this.api, {
|
|
943
943
|
includeDiscriminatorMappingRefs: true,
|
|
944
944
|
transformer: (s) => s,
|
|
945
945
|
...opts
|
|
@@ -982,7 +982,7 @@ var Operation = class {
|
|
|
982
982
|
return [];
|
|
983
983
|
}
|
|
984
984
|
const requestBody = this.schema.requestBody;
|
|
985
|
-
if (
|
|
985
|
+
if (_chunkUZVIB6QVcjs.isRef.call(void 0, requestBody)) {
|
|
986
986
|
return [];
|
|
987
987
|
}
|
|
988
988
|
return Object.keys(requestBody.content);
|
|
@@ -996,7 +996,7 @@ var Operation = class {
|
|
|
996
996
|
return false;
|
|
997
997
|
}
|
|
998
998
|
const requestBody = this.schema.requestBody;
|
|
999
|
-
if (
|
|
999
|
+
if (_chunkUZVIB6QVcjs.isRef.call(void 0, requestBody)) {
|
|
1000
1000
|
return false;
|
|
1001
1001
|
}
|
|
1002
1002
|
if (requestBody.required) {
|
|
@@ -1021,7 +1021,7 @@ var Operation = class {
|
|
|
1021
1021
|
return false;
|
|
1022
1022
|
}
|
|
1023
1023
|
const requestBody = this.schema.requestBody;
|
|
1024
|
-
if (
|
|
1024
|
+
if (_chunkUZVIB6QVcjs.isRef.call(void 0, requestBody)) {
|
|
1025
1025
|
return false;
|
|
1026
1026
|
}
|
|
1027
1027
|
if (mediaType) {
|
|
@@ -1033,7 +1033,7 @@ var Operation = class {
|
|
|
1033
1033
|
let availableMediaType;
|
|
1034
1034
|
const mediaTypes = this.getRequestBodyMediaTypes();
|
|
1035
1035
|
mediaTypes.forEach((mt) => {
|
|
1036
|
-
if (!availableMediaType &&
|
|
1036
|
+
if (!availableMediaType && _chunkZGCROLGHcjs.matches_mimetype_default.json(mt)) {
|
|
1037
1037
|
availableMediaType = mt;
|
|
1038
1038
|
}
|
|
1039
1039
|
});
|
|
@@ -1078,7 +1078,7 @@ var Operation = class {
|
|
|
1078
1078
|
return false;
|
|
1079
1079
|
}
|
|
1080
1080
|
const response = this.schema.responses[statusCode];
|
|
1081
|
-
if (
|
|
1081
|
+
if (_chunkUZVIB6QVcjs.isRef.call(void 0, response)) {
|
|
1082
1082
|
return false;
|
|
1083
1083
|
}
|
|
1084
1084
|
return response;
|
|
@@ -1126,9 +1126,9 @@ var Operation = class {
|
|
|
1126
1126
|
Object.keys(this.schema.callbacks).forEach((callback) => {
|
|
1127
1127
|
Object.keys(this.schema.callbacks[callback]).forEach((expression) => {
|
|
1128
1128
|
const cb = this.schema.callbacks[callback];
|
|
1129
|
-
if (!
|
|
1129
|
+
if (!_chunkUZVIB6QVcjs.isRef.call(void 0, cb)) {
|
|
1130
1130
|
const exp = cb[expression];
|
|
1131
|
-
if (!
|
|
1131
|
+
if (!_chunkUZVIB6QVcjs.isRef.call(void 0, exp)) {
|
|
1132
1132
|
Object.keys(exp).forEach((method) => {
|
|
1133
1133
|
if (!_chunk4DBNE7RJcjs.supportedMethods.includes(method)) return;
|
|
1134
1134
|
callbackOperations.push(this.getCallback(callback, expression, method));
|
|
@@ -1274,4 +1274,4 @@ exports.Operation = Operation; exports.Callback = Callback; exports.Webhook = We
|
|
|
1274
1274
|
* @license Apache-2.0
|
|
1275
1275
|
* @see {@link https://github.com/swagger-api/swagger-ui/blob/master/src/core/plugins/samples/fn.js}
|
|
1276
1276
|
*/
|
|
1277
|
-
//# sourceMappingURL=chunk-
|
|
1277
|
+
//# sourceMappingURL=chunk-R33HRXQA.cjs.map
|