mirror of
https://github.com/hanzo-docs/docs.git
synced 2026-10-25 04:20:02 +00:00
OpenAPI: replace @apidevtools/json-schema-ref-parser with @scalar/openapi-parser
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'fumadocs-openapi': minor
|
||||
---
|
||||
|
||||
Replace `@apidevtools/json-schema-ref-parser` with `@scalar/openapi-parser`
|
||||
+10
-10
@@ -14,10 +14,10 @@
|
||||
"dependencies": {
|
||||
"@inkeep/ai-api": "^0.8.0",
|
||||
"@oramacloud/client": "^2.1.4",
|
||||
"@radix-ui/react-dialog": "^1.1.2",
|
||||
"@radix-ui/react-popover": "^1.1.2",
|
||||
"@radix-ui/react-slot": "^1.1.0",
|
||||
"@radix-ui/react-tooltip": "^1.1.4",
|
||||
"@radix-ui/react-dialog": "^1.1.3",
|
||||
"@radix-ui/react-popover": "^1.1.3",
|
||||
"@radix-ui/react-slot": "^1.1.1",
|
||||
"@radix-ui/react-tooltip": "^1.1.5",
|
||||
"@shikijs/rehype": "^1.24.2",
|
||||
"@theguild/remark-mermaid": "^0.1.3",
|
||||
"babel-plugin-react-compiler": "19.0.0-beta-df7b47d-20241124",
|
||||
@@ -33,7 +33,7 @@
|
||||
"hast-util-to-jsx-runtime": "^2.3.2",
|
||||
"katex": "^0.16.15",
|
||||
"lucide-react": "^0.468.0",
|
||||
"next": "15.0.4",
|
||||
"next": "15.1.0",
|
||||
"phenomenon": "^1.6.0",
|
||||
"react": "^19.0.0",
|
||||
"react-dom": "^19.0.0",
|
||||
@@ -47,16 +47,16 @@
|
||||
"scroll-into-view-if-needed": "^3.1.0",
|
||||
"shiki": "^1.24.2",
|
||||
"tailwind-merge": "^2.5.5",
|
||||
"zod": "^3.24.0"
|
||||
"zod": "^3.24.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@fumadocs/cli": "workspace:*",
|
||||
"@next/bundle-analyzer": "15.0.4",
|
||||
"@next/env": "15.0.4",
|
||||
"@next/eslint-plugin-next": "15.0.4",
|
||||
"@next/bundle-analyzer": "15.1.0",
|
||||
"@next/env": "15.1.0",
|
||||
"@next/eslint-plugin-next": "15.1.0",
|
||||
"@types/hast": "^3.0.4",
|
||||
"@types/mdx": "^2.0.13",
|
||||
"@types/node": "22.10.1",
|
||||
"@types/node": "22.10.2",
|
||||
"@types/react": "^19.0.1",
|
||||
"@types/react-dom": "^19.0.2",
|
||||
"autoprefixer": "^10.4.20",
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
"@fumadocs/content-collections": "workspace:*",
|
||||
"fumadocs-core": "workspace:*",
|
||||
"fumadocs-ui": "workspace:*",
|
||||
"next": "^15.0.4",
|
||||
"next": "^15.1.0",
|
||||
"react": "19.0.0",
|
||||
"react-dom": "19.0.0"
|
||||
},
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
"fumadocs-core": "workspace:*",
|
||||
"fumadocs-mdx": "workspace:*",
|
||||
"fumadocs-ui": "workspace:*",
|
||||
"next": "15.0.4",
|
||||
"next": "15.1.0",
|
||||
"react": "19.0.0",
|
||||
"react-dom": "19.0.0"
|
||||
},
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
"fumadocs-core": "workspace:*",
|
||||
"fumadocs-mdx": "workspace:*",
|
||||
"fumadocs-ui": "workspace:*",
|
||||
"next": "15.0.4",
|
||||
"next": "15.1.0",
|
||||
"react": "19.0.0",
|
||||
"react-dom": "19.0.0"
|
||||
},
|
||||
|
||||
@@ -14,13 +14,13 @@
|
||||
"fumadocs-mdx": "workspace:*",
|
||||
"fumadocs-openapi": "workspace:*",
|
||||
"fumadocs-ui": "workspace:*",
|
||||
"next": "15.0.4",
|
||||
"next": "15.1.0",
|
||||
"postcss": "^8.4.49",
|
||||
"react": "19.0.0",
|
||||
"react-dom": "19.0.0",
|
||||
"shiki": "^1.24.2",
|
||||
"tailwindcss": "^3.4.16",
|
||||
"zod": "^3.24.0"
|
||||
"zod": "^3.24.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/mdx": "^2.0.13",
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
"@fumadocs/mdx-remote": "workspace:*",
|
||||
"fumadocs-core": "workspace:*",
|
||||
"fumadocs-ui": "workspace:*",
|
||||
"next": "15.0.4",
|
||||
"next": "15.1.0",
|
||||
"react": "19.0.0",
|
||||
"react-dom": "19.0.0"
|
||||
},
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/cross-spawn": "^6.0.6",
|
||||
"@types/node": "22.10.1",
|
||||
"@types/node": "22.10.2",
|
||||
"@types/react": "^19.0.1",
|
||||
"eslint-config-custom": "workspace:*",
|
||||
"fast-glob": "^3.3.1",
|
||||
|
||||
@@ -37,12 +37,12 @@
|
||||
"devDependencies": {
|
||||
"@content-collections/core": "^0.7.3",
|
||||
"@content-collections/mdx": "^0.2.0",
|
||||
"@types/node": "22.10.1",
|
||||
"@types/node": "22.10.2",
|
||||
"eslint-config-custom": "workspace:*",
|
||||
"fumadocs-core": "workspace:*",
|
||||
"tsconfig": "workspace:*",
|
||||
"unified": "^11.0.5",
|
||||
"zod": "^3.24.0"
|
||||
"zod": "^3.24.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@content-collections/core": "0.x.x",
|
||||
|
||||
@@ -103,14 +103,14 @@
|
||||
"@types/hast": "^3.0.4",
|
||||
"@types/mdast": "^4.0.3",
|
||||
"@types/negotiator": "^0.6.3",
|
||||
"@types/node": "22.10.1",
|
||||
"@types/node": "22.10.2",
|
||||
"@types/react": "^19.0.1",
|
||||
"@types/react-dom": "^19.0.2",
|
||||
"algoliasearch": "4.24.0",
|
||||
"eslint-config-custom": "workspace:*",
|
||||
"mdast-util-mdx-jsx": "^3.1.3",
|
||||
"mdast-util-mdxjs-esm": "^2.0.1",
|
||||
"next": "^15.0.4",
|
||||
"next": "^15.1.0",
|
||||
"remark-mdx": "^3.1.0",
|
||||
"remark-rehype": "^11.1.1",
|
||||
"shiki-transformers": "^1.0.1",
|
||||
|
||||
@@ -9,11 +9,11 @@
|
||||
"@content-collections/mdx": "^0.2.0",
|
||||
"@content-collections/next": "^0.2.4",
|
||||
"@types/mdx": "^2.0.13",
|
||||
"@types/node": "22.10.1",
|
||||
"@types/node": "22.10.2",
|
||||
"@types/react": "^19.0.1",
|
||||
"@types/react-dom": "^19.0.2",
|
||||
"autoprefixer": "^10.4.20",
|
||||
"next": "15.0.4",
|
||||
"next": "15.1.0",
|
||||
"postcss": "^8.4.49",
|
||||
"react": "^19.0.0",
|
||||
"react-dom": "^19.0.0",
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/cross-spawn": "^6.0.6",
|
||||
"@types/node": "22.10.1",
|
||||
"@types/node": "22.10.2",
|
||||
"eslint-config-custom": "workspace:*",
|
||||
"fast-glob": "^3.3.1",
|
||||
"tsconfig": "workspace:*"
|
||||
|
||||
@@ -33,14 +33,14 @@
|
||||
"npm-to-yarn": "^3.0.0",
|
||||
"ts-morph": "^24.0.0",
|
||||
"unist-util-visit": "^5.0.0",
|
||||
"zod": "^3.24.0"
|
||||
"zod": "^3.24.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@mdx-js/mdx": "^3.1.0",
|
||||
"@types/estree": "^1.0.6",
|
||||
"@types/hast": "^3.0.4",
|
||||
"@types/mdast": "^4.0.3",
|
||||
"@types/node": "22.10.1",
|
||||
"@types/node": "22.10.2",
|
||||
"eslint-config-custom": "workspace:*",
|
||||
"remark": "^15.0.0",
|
||||
"tsconfig": "workspace:*",
|
||||
|
||||
@@ -67,17 +67,17 @@
|
||||
"gray-matter": "^4.0.3",
|
||||
"micromatch": "^4.0.8",
|
||||
"ws": "^8.18.0",
|
||||
"zod": "^3.24.0"
|
||||
"zod": "^3.24.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/mdx": "^2.0.13",
|
||||
"@types/micromatch": "^4.0.9",
|
||||
"@types/node": "22.10.1",
|
||||
"@types/node": "22.10.2",
|
||||
"@types/react": "^19.0.1",
|
||||
"@types/ws": "^8.5.13",
|
||||
"eslint-config-custom": "workspace:*",
|
||||
"fumadocs-core": "workspace:*",
|
||||
"next": "15.0.4",
|
||||
"next": "15.1.0",
|
||||
"tsconfig": "workspace:*",
|
||||
"unified": "^11.0.5",
|
||||
"vfile": "^6.0.3"
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
"fast-glob": "^3.3.1",
|
||||
"gray-matter": "^4.0.3",
|
||||
"micromatch": "^4.0.8",
|
||||
"zod": "^3.24.0"
|
||||
"zod": "^3.24.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/cross-spawn": "^6.0.6",
|
||||
@@ -60,7 +60,7 @@
|
||||
"@types/react": "^19.0.1",
|
||||
"eslint-config-custom": "workspace:*",
|
||||
"fumadocs-core": "workspace:*",
|
||||
"next": "^15.0.4",
|
||||
"next": "^15.1.0",
|
||||
"tsconfig": "workspace:*",
|
||||
"unified": "^11.0.5",
|
||||
"vfile": "^6.0.3",
|
||||
|
||||
@@ -38,11 +38,10 @@
|
||||
"types:check": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@apidevtools/json-schema-ref-parser": "^11.7.3",
|
||||
"@fumari/json-schema-to-typescript": "^1.1.2",
|
||||
"@radix-ui/react-select": "^2.1.2",
|
||||
"@radix-ui/react-slot": "^1.1.0",
|
||||
"@scalar/openapi-parser": "^0.8.10",
|
||||
"@radix-ui/react-select": "^2.1.3",
|
||||
"@radix-ui/react-slot": "^1.1.1",
|
||||
"@scalar/openapi-parser": "0.10.0",
|
||||
"ajv-draft-04": "^1.0.0",
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"fast-glob": "^3.3.1",
|
||||
@@ -52,20 +51,20 @@
|
||||
"hast-util-to-jsx-runtime": "^2.3.2",
|
||||
"js-yaml": "^4.1.0",
|
||||
"openapi-sampler": "^1.6.1",
|
||||
"react-hook-form": "^7.54.0",
|
||||
"react-hook-form": "^7.54.1",
|
||||
"remark": "^15.0.1",
|
||||
"remark-rehype": "^11.1.1",
|
||||
"shiki": "^1.24.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/js-yaml": "^4.0.9",
|
||||
"@types/node": "22.10.1",
|
||||
"@types/node": "22.10.2",
|
||||
"@types/openapi-sampler": "^1.0.3",
|
||||
"@types/react": "^19.0.1",
|
||||
"bunchee": "^6.0.3",
|
||||
"eslint-config-custom": "workspace:*",
|
||||
"lucide-react": "^0.468.0",
|
||||
"next": "15.0.4",
|
||||
"next": "15.1.0",
|
||||
"openapi-types": "^12.1.3",
|
||||
"tsconfig": "workspace:*"
|
||||
},
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import type { DereferenceMap, Document } from '@/types';
|
||||
import Parser from '@apidevtools/json-schema-ref-parser';
|
||||
import type { NoReference } from '@/utils/schema';
|
||||
import type { OpenAPIV3, OpenAPIV3_1 } from 'openapi-types';
|
||||
import { upgrade } from '@scalar/openapi-parser';
|
||||
import { load, dereference, upgrade } from '@scalar/openapi-parser';
|
||||
import { fetchUrls } from '@scalar/openapi-parser/plugins/fetch-urls';
|
||||
import { readFiles } from '@scalar/openapi-parser/plugins/read-files';
|
||||
|
||||
export type DocumentInput = string | OpenAPIV3_1.Document | OpenAPIV3.Document;
|
||||
|
||||
@@ -25,27 +26,21 @@ export async function processDocument(
|
||||
|
||||
if (cached) return cached;
|
||||
|
||||
let bundled = await Parser.bundle<OpenAPIV3_1.Document | OpenAPIV3.Document>(
|
||||
document,
|
||||
{ mutateInputSchema: false },
|
||||
);
|
||||
bundled = upgrade(bundled).specification;
|
||||
|
||||
const dereferenceMap: DereferenceMap = new Map();
|
||||
const dereferenced = await Parser.dereference<NoReference<Document>>(
|
||||
bundled,
|
||||
{
|
||||
mutateInputSchema: true,
|
||||
dereference: {
|
||||
onDereference($ref: string, schema: unknown) {
|
||||
dereferenceMap.set(schema, $ref);
|
||||
},
|
||||
},
|
||||
const loaded = await load(document, {
|
||||
plugins: [readFiles(), fetchUrls()],
|
||||
});
|
||||
|
||||
// upgrade
|
||||
loaded.specification = upgrade(loaded.specification).specification;
|
||||
const { schema: dereferenced } = await dereference(loaded.filesystem, {
|
||||
onDereference({ ref, schema }) {
|
||||
dereferenceMap.set(schema, ref);
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
const processed: ProcessedDocument = {
|
||||
document: dereferenced,
|
||||
document: dereferenced as NoReference<Document>,
|
||||
dereferenceMap,
|
||||
};
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
"types:check": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@radix-ui/react-popover": "^1.1.2",
|
||||
"@radix-ui/react-popover": "^1.1.3",
|
||||
"@shikijs/twoslash": "^1.24.2",
|
||||
"mdast-util-from-markdown": "^2.0.2",
|
||||
"mdast-util-gfm": "^3.0.0",
|
||||
@@ -46,7 +46,7 @@
|
||||
"devDependencies": {
|
||||
"@types/hast": "^3.0.4",
|
||||
"@types/mdast": "^4.0.3",
|
||||
"@types/node": "22.10.1",
|
||||
"@types/node": "22.10.2",
|
||||
"@types/react": "^19.0.1",
|
||||
"eslint-config-custom": "workspace:*",
|
||||
"fumadocs-ui": "workspace:*",
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
"types:check": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/node": "22.10.1",
|
||||
"@types/node": "22.10.2",
|
||||
"fast-glob": "^3.3.1",
|
||||
"hast-util-to-jsx-runtime": "^2.3.2",
|
||||
"mdast-util-from-markdown": "^2.0.2",
|
||||
|
||||
+10
-10
@@ -62,15 +62,15 @@
|
||||
"types:check": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@radix-ui/react-accordion": "^1.2.1",
|
||||
"@radix-ui/react-collapsible": "^1.1.1",
|
||||
"@radix-ui/react-dialog": "^1.1.2",
|
||||
"@radix-ui/react-accordion": "^1.2.2",
|
||||
"@radix-ui/react-collapsible": "^1.1.2",
|
||||
"@radix-ui/react-dialog": "^1.1.3",
|
||||
"@radix-ui/react-direction": "^1.1.0",
|
||||
"@radix-ui/react-navigation-menu": "^1.2.1",
|
||||
"@radix-ui/react-popover": "^1.1.2",
|
||||
"@radix-ui/react-scroll-area": "^1.2.1",
|
||||
"@radix-ui/react-slot": "^1.1.0",
|
||||
"@radix-ui/react-tabs": "^1.1.1",
|
||||
"@radix-ui/react-navigation-menu": "^1.2.2",
|
||||
"@radix-ui/react-popover": "^1.1.3",
|
||||
"@radix-ui/react-scroll-area": "^1.2.2",
|
||||
"@radix-ui/react-slot": "^1.1.1",
|
||||
"@radix-ui/react-tabs": "^1.1.2",
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"fumadocs-core": "workspace:*",
|
||||
"lodash.merge": "^4.6.2",
|
||||
@@ -82,13 +82,13 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@fumadocs/cli": "workspace:*",
|
||||
"@next/eslint-plugin-next": "^15.0.4",
|
||||
"@next/eslint-plugin-next": "^15.1.0",
|
||||
"@types/lodash.merge": "^4.6.9",
|
||||
"@types/react": "^19.0.1",
|
||||
"@types/react-dom": "^19.0.2",
|
||||
"autoprefixer": "^10.4.20",
|
||||
"eslint-config-custom": "workspace:*",
|
||||
"next": "15.0.4",
|
||||
"next": "15.1.0",
|
||||
"postcss": "^8.4.49",
|
||||
"postcss-cli": "^11.0.0",
|
||||
"tailwindcss": "^3.4.16",
|
||||
|
||||
Generated
+354
-392
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user