Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/docusaurus-plugin-openapi-docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
},
"dependencies": {
"@apidevtools/json-schema-ref-parser": "^15.3.3",
"@redocly/openapi-core": "^1.34.3",
"@redocly/openapi-core": "^2.25.2",
"allof-merge": "^0.6.6",
"chalk": "^4.1.2",
"clsx": "^2.1.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
* ========================================================================== */

import $RefParser from "@apidevtools/json-schema-ref-parser";
import { bundle, Config } from "@redocly/openapi-core";
import { bundle, createConfig } from "@redocly/openapi-core";
import type { Source, Document } from "@redocly/openapi-core";
import { ResolvedConfig } from "@redocly/openapi-core/lib/config";
import chalk from "chalk";
// @ts-ignore
import { convertObj } from "swagger2openapi";
Expand Down Expand Up @@ -116,7 +115,7 @@ async function resolveJsonRefs(specUrlOrObject: object | string) {
}

export async function loadAndResolveSpec(specUrlOrObject: object | string) {
const config = new Config({} as ResolvedConfig);
const config = await createConfig({});
const bundleOpts = {
config,
base: process.cwd(),
Expand All @@ -137,10 +136,13 @@ export async function loadAndResolveSpec(specUrlOrObject: object | string) {
const {
bundle: { parsed },
} = await bundle(bundleOpts);
const parsedSpec = parsed as any;

//Pre-processing before resolving JSON refs
if (parsed.components) {
for (let [component, type] of Object.entries(parsed.components) as any) {
if (parsedSpec.components) {
for (let [component, type] of Object.entries(
parsedSpec.components
) as any) {
if (component === "schemas") {
for (let [schemaKey, schemaValue] of Object.entries(type) as any) {
const title: string | undefined = schemaValue["title"];
Expand All @@ -152,7 +154,7 @@ export async function loadAndResolveSpec(specUrlOrObject: object | string) {
}
}

const resolved = await resolveJsonRefs(parsed);
const resolved = await resolveJsonRefs(parsedSpec);

// Force serialization and replace circular $ref pointers
// @ts-ignore
Expand Down
75 changes: 57 additions & 18 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1176,7 +1176,7 @@
dependencies:
core-js-pure "^3.43.0"

"@babel/runtime@^7.1.2", "@babel/runtime@^7.10.3", "@babel/runtime@^7.12.13", "@babel/runtime@^7.12.5", "@babel/runtime@^7.14.6", "@babel/runtime@^7.16.3", "@babel/runtime@^7.25.9", "@babel/runtime@^7.7.2":
"@babel/runtime@^7.1.2", "@babel/runtime@^7.10.3", "@babel/runtime@^7.12.13", "@babel/runtime@^7.12.5", "@babel/runtime@^7.14.6", "@babel/runtime@^7.16.3", "@babel/runtime@^7.18.3", "@babel/runtime@^7.25.9", "@babel/runtime@^7.7.2":
version "7.28.6"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.28.6.tgz#d267a43cb1836dc4d182cce93ae75ba954ef6d2b"
integrity sha512-05WQkdpL9COIMz4LjTxGpPNCdlpyimKppYNoJ5Di5EUObifl8t4tuLuUBBZEpoLYOmfvIWrsp9fCl0HoPRVTdA==
Expand Down Expand Up @@ -3875,33 +3875,36 @@
resolved "https://registry.yarnpkg.com/@polka/url/-/url-1.0.0-next.29.tgz#5a40109a1ab5f84d6fd8fc928b19f367cbe7e7b1"
integrity sha512-wwQAWhWSuHaag8c4q/KN/vCoeOJYshAIvMQwD4GpSb3OiZklFfvAgmj0VCBBImRpuF/aFgIRzllXlVX93Jevww==

"@redocly/ajv@^8.11.2":
version "8.17.1"
resolved "https://registry.yarnpkg.com/@redocly/ajv/-/ajv-8.17.1.tgz#e2b1722cbc8b4cd7e05da14a745d3ddd03293734"
integrity sha512-EDtsGZS964mf9zAUXAl9Ew16eYbeyAFWhsPr0fX6oaJxgd8rApYlPBf0joyhnUHz88WxrigyFtTaqqzXNzPgqw==
"@redocly/ajv@^8.18.0":
version "8.18.1"
resolved "https://registry.yarnpkg.com/@redocly/ajv/-/ajv-8.18.1.tgz#55f99831e6b37fcfdb1048aea497006c4af2d97f"
integrity sha512-Ifm/pP/tul1qmAecpbVxCBluVE32rKfjf8gYXH4xI2gCv9mRWFhJMHzkPDM4TXlxwPQYIFegymlsy8lXz7optA==
dependencies:
fast-deep-equal "^3.1.3"
fast-uri "^3.0.1"
json-schema-traverse "^1.0.0"
require-from-string "^2.0.2"

"@redocly/config@^0.22.0":
version "0.22.2"
resolved "https://registry.yarnpkg.com/@redocly/config/-/config-0.22.2.tgz#9a05e694816d53a5236cf8768d3cad0e49d8b116"
integrity sha512-roRDai8/zr2S9YfmzUfNhKjOF0NdcOIqF7bhf4MVC5UxpjIysDjyudvlAiVbpPHp3eDRWbdzUgtkK1a7YiDNyQ==
"@redocly/config@^0.45.0":
version "0.45.0"
resolved "https://registry.yarnpkg.com/@redocly/config/-/config-0.45.0.tgz#38afcd2ecdd56f44a80b23d0c733e2449a70f559"
integrity sha512-V+wNusPQUaYV1c5s9iptfKQ2Ggno4bMeiyXdNILxqZS87gttwPfqlqHKHKFyz006voS3JsR295cbpx3GlsIxKg==
dependencies:
json-schema-to-ts "2.7.2"

"@redocly/openapi-core@^1.34.3":
version "1.34.6"
resolved "https://registry.yarnpkg.com/@redocly/openapi-core/-/openapi-core-1.34.6.tgz#6230b140530dc6f1d0684c52d0f31dce0ef3cb3b"
integrity sha512-2+O+riuIUgVSuLl3Lyh5AplWZyVMNuG2F98/o6NrutKJfW4/GTZdPpZlIphS0HGgcOHgmWcCSHj+dWFlZaGSHw==
"@redocly/openapi-core@^2.25.2":
version "2.25.3"
resolved "https://registry.yarnpkg.com/@redocly/openapi-core/-/openapi-core-2.25.3.tgz#83e11c2f9fe4e79b1642a08598b0b9e13c8f9d3c"
integrity sha512-GIu3Mdym5IDIPCvXTzMZ6TQw/+7sKd52PdysxNVe7zBk22ExSGnVE9UAk9BaLOzXT77PJWDUwaimBdJoPpxHMA==
dependencies:
"@redocly/ajv" "^8.11.2"
"@redocly/config" "^0.22.0"
"@redocly/ajv" "^8.18.0"
"@redocly/config" "^0.45.0"
ajv "npm:@redocly/ajv@8.18.0"
ajv-formats "^3.0.1"
colorette "^1.2.0"
https-proxy-agent "^7.0.5"
js-levenshtein "^1.1.6"
js-yaml "^4.1.0"
minimatch "^5.0.1"
picomatch "^4.0.4"
pluralize "^8.0.0"
yaml-ast-parser "0.0.43"

Expand Down Expand Up @@ -5459,6 +5462,13 @@ ajv-formats@2.1.1, ajv-formats@^2.1.1:
dependencies:
ajv "^8.0.0"

ajv-formats@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/ajv-formats/-/ajv-formats-3.0.1.tgz#3d5dc762bca17679c3c2ea7e90ad6b7532309578"
integrity sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ==
dependencies:
ajv "^8.0.0"

ajv-keywords@^3.5.2:
version "3.5.2"
resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.5.2.tgz#31f29da5ab6e00d1c2d329acf7b5929614d5014d"
Expand Down Expand Up @@ -5491,6 +5501,16 @@ ajv@^8.0.0, ajv@^8.0.1, ajv@^8.11.0, ajv@^8.9.0:
json-schema-traverse "^1.0.0"
require-from-string "^2.0.2"

"ajv@npm:@redocly/ajv@8.18.0":
version "8.18.0"
resolved "https://registry.yarnpkg.com/@redocly/ajv/-/ajv-8.18.0.tgz#e6c7ba549111838baa950bc31acbc84b06f0239f"
integrity sha512-F+LMD2IDIXuHxgpLJh3nkLj9+tSaEzoUWd+7fONGq5pe2169FUDjpEkOfEpoGLz1sbZni/69p07OsecNfAOpqA==
dependencies:
fast-deep-equal "^3.1.3"
fast-uri "^3.0.1"
json-schema-traverse "^1.0.0"
require-from-string "^2.0.2"

algoliasearch-helper@^3.26.0:
version "3.27.0"
resolved "https://registry.yarnpkg.com/algoliasearch-helper/-/algoliasearch-helper-3.27.0.tgz#987c18b715ed0ecb303711feaa14335e5b8516e1"
Expand Down Expand Up @@ -9949,7 +9969,7 @@ https-proxy-agent@^5.0.0:
agent-base "6"
debug "4"

https-proxy-agent@^7.0.1, https-proxy-agent@^7.0.5:
https-proxy-agent@^7.0.1:
version "7.0.6"
resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz#da8dfeac7da130b05c2ba4b59c9b6cd66611a6b9"
integrity sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==
Expand Down Expand Up @@ -11328,6 +11348,15 @@ json-schema-merge-allof@0.8.1:
json-schema-compare "^0.2.2"
lodash "^4.17.20"

json-schema-to-ts@2.7.2:
version "2.7.2"
resolved "https://registry.yarnpkg.com/json-schema-to-ts/-/json-schema-to-ts-2.7.2.tgz#e8df41d7153e5517f0e68dbe57be12bb3609d6d5"
integrity sha512-R1JfqKqbBR4qE8UyBR56Ms30LL62/nlhoz+1UkfI/VE7p54Awu919FZ6ZUPG8zIa3XB65usPJgr1ONVncUGSaQ==
dependencies:
"@babel/runtime" "^7.18.3"
"@types/json-schema" "^7.0.9"
ts-algebra "^1.2.0"

json-schema-traverse@^0.4.1:
version "0.4.1"
resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660"
Expand Down Expand Up @@ -14077,6 +14106,11 @@ picomatch@^4.0.2, picomatch@^4.0.3:
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-4.0.3.tgz#796c76136d1eead715db1e7bad785dedd695a042"
integrity sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==

picomatch@^4.0.4:
version "4.0.4"
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-4.0.4.tgz#fd6f5e00a143086e074dffe4c924b8fb293b0589"
integrity sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==

pify@^2.2.0, pify@^2.3.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c"
Expand Down Expand Up @@ -17146,6 +17180,11 @@ truncate-utf8-bytes@^1.0.0:
dependencies:
utf8-byte-length "^1.0.1"

ts-algebra@^1.2.0:
version "1.2.2"
resolved "https://registry.yarnpkg.com/ts-algebra/-/ts-algebra-1.2.2.tgz#b75d301c28cd4126cd344760a47b43e48e2872e0"
integrity sha512-kloPhf1hq3JbCPOTYoOWDKxebWjNb2o/LKnNfkWhxVVisFFmMJPPdJeGoGmM+iRLyoXAR61e08Pb+vUXINg8aA==

ts-api-utils@^1.0.1:
version "1.4.3"
resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-1.4.3.tgz#bfc2215fe6528fecab2b0fba570a2e8a4263b064"
Expand Down
Loading