mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-26 20:27:00 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d980d7a9ea | |||
| eab3b7aea4 | |||
| 3af177be19 |
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"@gitbook/react-openapi": patch
|
||||
---
|
||||
|
||||
Merge simple alternatives
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"@gitbook/react-openapi": patch
|
||||
---
|
||||
|
||||
Bump scalar packages
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"gitbook": patch
|
||||
---
|
||||
|
||||
Fix dropdown menu not staying fixed
|
||||
+1
-2
@@ -20,8 +20,7 @@
|
||||
"**/.wrangler/**/*",
|
||||
"packages/openapi-parser/src/fixtures/**/*",
|
||||
"packages/emoji-codepoints/index.ts",
|
||||
"packages/icons/src/data/*.json",
|
||||
"packages/cache-do/worker-configuration.d.ts"
|
||||
"packages/icons/src/data/*.json"
|
||||
]
|
||||
},
|
||||
"formatter": {
|
||||
|
||||
@@ -234,8 +234,8 @@
|
||||
"version": "1.1.10",
|
||||
"dependencies": {
|
||||
"@gitbook/openapi-parser": "workspace:*",
|
||||
"@scalar/api-client-react": "^1.2.19",
|
||||
"@scalar/oas-utils": "^0.2.130",
|
||||
"@scalar/api-client-react": "^1.2.5",
|
||||
"@scalar/oas-utils": "^0.2.120",
|
||||
"clsx": "^2.1.1",
|
||||
"flatted": "^3.2.9",
|
||||
"json-xml-parse": "^1.3.0",
|
||||
@@ -1076,21 +1076,21 @@
|
||||
|
||||
"@rollup/pluginutils": ["@rollup/pluginutils@5.1.4", "", { "dependencies": { "@types/estree": "^1.0.0", "estree-walker": "^2.0.2", "picomatch": "^4.0.2" }, "peerDependencies": { "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" }, "optionalPeers": ["rollup"] }, "sha512-USm05zrsFxYLPdWWq+K3STlWiT/3ELn3RcV5hJMghpeAIhxfsUIg6mt12CBJBInWMV4VneoV7SfGv8xIwo2qNQ=="],
|
||||
|
||||
"@scalar/api-client": ["@scalar/api-client@2.3.19", "", { "dependencies": { "@headlessui/tailwindcss": "^0.2.0", "@headlessui/vue": "^1.7.20", "@scalar/components": "0.13.47", "@scalar/draggable": "0.1.11", "@scalar/icons": "0.1.3", "@scalar/import": "0.3.13", "@scalar/oas-utils": "0.2.130", "@scalar/object-utils": "1.1.13", "@scalar/openapi-parser": "0.10.14", "@scalar/openapi-types": "0.2.0", "@scalar/postman-to-openapi": "0.2.3", "@scalar/snippetz": "0.2.19", "@scalar/themes": "0.9.86", "@scalar/types": "0.1.7", "@scalar/use-codemirror": "0.11.92", "@scalar/use-hooks": "0.1.40", "@scalar/use-toasts": "0.7.9", "@scalar/use-tooltip": "1.0.6", "@vueuse/core": "^10.10.0", "@vueuse/integrations": "^11.2.0", "focus-trap": "^7", "fuse.js": "^7.0.0", "microdiff": "^1.4.0", "nanoid": "^5.1.5", "pretty-bytes": "^6.1.1", "pretty-ms": "^8.0.0", "shell-quote": "^1.8.1", "type-fest": "^4.20.0", "vue": "^3.5.12", "vue-router": "^4.3.0", "whatwg-mimetype": "^4.0.0", "yaml": "^2.4.5", "zod": "^3.23.8" } }, "sha512-1Scff4QL6UExxcmSYv5j1dktvQZTXbmDUJp99RqmUROEhneNWEeWaZe+GZWsda5mvDoe4vP9zZKaymkulBDKYQ=="],
|
||||
"@scalar/api-client": ["@scalar/api-client@2.3.5", "", { "dependencies": { "@headlessui/tailwindcss": "^0.2.0", "@headlessui/vue": "^1.7.20", "@scalar/components": "0.13.37", "@scalar/draggable": "0.1.11", "@scalar/icons": "0.1.3", "@scalar/import": "0.3.2", "@scalar/oas-utils": "0.2.120", "@scalar/object-utils": "1.1.13", "@scalar/openapi-parser": "0.10.10", "@scalar/openapi-types": "0.1.9", "@scalar/postman-to-openapi": "0.1.43", "@scalar/snippetz": "0.2.16", "@scalar/themes": "0.9.79", "@scalar/types": "0.1.1", "@scalar/use-codemirror": "0.11.82", "@scalar/use-hooks": "0.1.33", "@scalar/use-toasts": "0.7.9", "@scalar/use-tooltip": "1.0.6", "@vueuse/core": "^10.10.0", "@vueuse/integrations": "^11.2.0", "focus-trap": "^7", "fuse.js": "^7.0.0", "microdiff": "^1.4.0", "nanoid": "^5.0.9", "pretty-bytes": "^6.1.1", "pretty-ms": "^8.0.0", "shell-quote": "^1.8.1", "vue": "^3.5.12", "vue-router": "^4.3.0", "whatwg-mimetype": "^4.0.0", "yaml": "^2.4.5", "zod": "^3.23.8" } }, "sha512-bVBP8H3laa4VG3dExv4Ak/Kf+q9z8aK/Glpv6CPE0wxgZJWxwkJoSrvwxUE+46JktSObUrhu4xQiqSCmBz8esQ=="],
|
||||
|
||||
"@scalar/api-client-react": ["@scalar/api-client-react@1.2.19", "", { "dependencies": { "@scalar/api-client": "2.3.19", "@scalar/types": "0.1.7", "vue": "^3.5.12" }, "peerDependencies": { "react": "^18.0.0 || ^19.0.0" } }, "sha512-zWUQvzAgOQ+oAbzswOlN42OJhwKku5RIIfBlukFMT31ceun3cp8e7+RT5DS6qwwQ2FROhSaqqsdM+o7VQ6pXkA=="],
|
||||
"@scalar/api-client-react": ["@scalar/api-client-react@1.2.5", "", { "dependencies": { "@scalar/api-client": "2.3.5", "@scalar/types": "0.1.1", "vue": "^3.5.12" }, "peerDependencies": { "react": "^18.0.0 || ^19.0.0" } }, "sha512-DpVDWb1rtNeU8ZqLX2Duos018q/++b3qIOYs7MzB2cXNg1802ZO7tPywXbYyizxLuy/dziI3UwGkjBuOKKXMGQ=="],
|
||||
|
||||
"@scalar/code-highlight": ["@scalar/code-highlight@0.0.27", "", { "dependencies": { "hast-util-to-text": "^4.0.2", "highlight.js": "^11.9.0", "highlightjs-curl": "^1.3.0", "highlightjs-vue": "^1.0.0", "lowlight": "^3.1.0", "rehype-external-links": "^3.0.0", "rehype-format": "^5.0.0", "rehype-parse": "^9.0.0", "rehype-raw": "^7.0.0", "rehype-sanitize": "^6.0.0", "rehype-stringify": "^10.0.0", "remark-gfm": "^4.0.0", "remark-parse": "^11.0.0", "remark-rehype": "^11.1.0", "remark-stringify": "^11.0.0", "unified": "^11.0.4", "unist-util-visit": "^5.0.0" } }, "sha512-A61FUxqD278L+iLtdbMl4+Pg72wtMrnAYft8v1FNY44uf6UfmM47eDVmzWrc7bSvDevg3ho5QA8cKiJBHXZHJA=="],
|
||||
"@scalar/code-highlight": ["@scalar/code-highlight@0.0.25", "", { "dependencies": { "hast-util-to-text": "^4.0.2", "highlight.js": "^11.9.0", "highlightjs-curl": "^1.3.0", "highlightjs-vue": "^1.0.0", "lowlight": "^3.1.0", "rehype-external-links": "^3.0.0", "rehype-format": "^5.0.0", "rehype-parse": "^9.0.0", "rehype-raw": "^7.0.0", "rehype-sanitize": "^6.0.0", "rehype-stringify": "^10.0.0", "remark-gfm": "^4.0.0", "remark-parse": "^11.0.0", "remark-rehype": "^11.1.0", "remark-stringify": "^11.0.0", "unified": "^11.0.4", "unist-util-visit": "^5.0.0" } }, "sha512-rmiXaAoL3Zl+OycIO1CMj8apaeAU/p41EmCpHTxInZiFVW0++iClce2fun1lK6qjTMZneR6UwE4qBKiUUVLCpg=="],
|
||||
|
||||
"@scalar/components": ["@scalar/components@0.13.47", "", { "dependencies": { "@floating-ui/utils": "^0.2.2", "@floating-ui/vue": "^1.0.2", "@headlessui/vue": "^1.7.20", "@scalar/code-highlight": "0.0.27", "@scalar/themes": "0.9.86", "@scalar/use-hooks": "0.1.40", "@scalar/use-toasts": "0.7.9", "@vueuse/core": "^10.10.0", "cva": "1.0.0-beta.2", "nanoid": "^5.1.5", "pretty-bytes": "^6.1.1", "radix-vue": "^1.9.3", "tailwind-merge": "^2.5.5", "vue": "^3.5.12" } }, "sha512-e88mKKsCEspd06bpPQPnhtEvCo/jjoFFOX9yUSV9sr0sWFZHi0ihq1zvnpLKpULyS+C5zzyoN/tGVhmaYpXgyg=="],
|
||||
"@scalar/components": ["@scalar/components@0.13.37", "", { "dependencies": { "@floating-ui/utils": "^0.2.2", "@floating-ui/vue": "^1.0.2", "@headlessui/vue": "^1.7.20", "@scalar/code-highlight": "0.0.25", "@scalar/themes": "0.9.79", "@scalar/use-hooks": "0.1.33", "@scalar/use-toasts": "0.7.9", "@vueuse/core": "^10.10.0", "cva": "1.0.0-beta.2", "nanoid": "^5.0.9", "pretty-bytes": "^6.1.1", "radix-vue": "^1.9.3", "tailwind-merge": "^2.5.5", "vue": "^3.5.12" } }, "sha512-bhJxg0I63nUH0qoZgb8nyHKCSzL8L9widP2WIYymIvXpCFLwCvF64Z0CAbihwgXxq0YblPvNM+g5N3dRtmXqdA=="],
|
||||
|
||||
"@scalar/draggable": ["@scalar/draggable@0.1.11", "", { "dependencies": { "vue": "^3.5.12" } }, "sha512-EQW9N1+mDORhsbjdtCI3XDvmUKsuKw1uf6r3kT1Mm2zQKT+rWwA0ChsAkEN6OG62C0YumMuXpH71h1seAWptxw=="],
|
||||
|
||||
"@scalar/icons": ["@scalar/icons@0.1.3", "", { "dependencies": { "vue": "^3.5.12" } }, "sha512-Bl46u7WsJ7NYjW1Fva7SMvw9c/92pGBP8B68tvDc+QevQ04DVNxw6+ny1NU/PnLtpuu1rUpPdtSCAkV1OdQGZQ=="],
|
||||
|
||||
"@scalar/import": ["@scalar/import@0.3.13", "", { "dependencies": { "@scalar/oas-utils": "0.2.130", "@scalar/openapi-parser": "0.10.14", "yaml": "^2.4.5" } }, "sha512-ooKyRxwtvMpxBnoLt9mSJF8er5rCR6RzGJaIMRCj7ViN776eY4mbLiYcXre/LO8XfLSHb1p7XbNDhfFyTHaUlw=="],
|
||||
"@scalar/import": ["@scalar/import@0.3.2", "", { "dependencies": { "@scalar/oas-utils": "0.2.120", "@scalar/openapi-parser": "0.10.10", "yaml": "^2.4.5" } }, "sha512-de7IDZgEYOhhgaq8lFFbfiJ4Hx/ITIXvuLA8SfSl5UQKg+LxiOnnn/5PSKF+pnjWmUf7Kz/ds0eHOXpZv5iMkw=="],
|
||||
|
||||
"@scalar/oas-utils": ["@scalar/oas-utils@0.2.130", "", { "dependencies": { "@hyperjump/json-schema": "^1.9.6", "@scalar/object-utils": "1.1.13", "@scalar/openapi-types": "0.2.0", "@scalar/themes": "0.9.86", "@scalar/types": "0.1.7", "flatted": "^3.3.1", "microdiff": "^1.4.0", "nanoid": "^5.1.5", "type-fest": "^4.20.0", "yaml": "^2.4.5", "zod": "^3.23.8" } }, "sha512-sVpdc3+3c/WiNrKEIwzJ+ml2ZQBjarMOTDJCM/IrvYhrJE0nHrdkzxlJgNPi++vJbVl0saYt8LhEItALv7NziA=="],
|
||||
"@scalar/oas-utils": ["@scalar/oas-utils@0.2.120", "", { "dependencies": { "@hyperjump/json-schema": "^1.9.6", "@scalar/object-utils": "1.1.13", "@scalar/openapi-types": "0.1.9", "@scalar/themes": "0.9.79", "@scalar/types": "0.1.1", "flatted": "^3.3.1", "microdiff": "^1.4.0", "nanoid": "^5.0.9", "yaml": "^2.4.5", "zod": "^3.23.8" } }, "sha512-npu0uLClqqXVZfxMdKBWxkWCmONK0jKaUcfmVhGza9Jij5aJyvdfDw6vH/Hh+DghgECwAvQLQeIBZTxjr9ufzg=="],
|
||||
|
||||
"@scalar/object-utils": ["@scalar/object-utils@1.1.13", "", { "dependencies": { "flatted": "^3.3.1", "just-clone": "^6.2.0", "ts-deepmerge": "^7.0.1" } }, "sha512-311eTykIXgOtjCs4VTELj9UMT97jHTWc5qkGNoIzZ5nxjCcvOVe7kDQobIkE8dGT+ybOgHz5qly02Eu7nVHeZQ=="],
|
||||
|
||||
@@ -1098,17 +1098,17 @@
|
||||
|
||||
"@scalar/openapi-types": ["@scalar/openapi-types@0.1.9", "", {}, "sha512-HQQudOSQBU7ewzfnBW9LhDmBE2XOJgSfwrh5PlUB7zJup/kaRkBGNgV2wMjNz9Af/uztiU/xNrO179FysmUT+g=="],
|
||||
|
||||
"@scalar/postman-to-openapi": ["@scalar/postman-to-openapi@0.2.3", "", { "dependencies": { "@scalar/oas-utils": "0.2.130", "@scalar/openapi-types": "0.2.0" } }, "sha512-/I5QbDFy+Sh29EIEgub/ztI+1eNtHRn+mln726hR+uWOyVyaDk0FfNC0R4XOn8SsDNyu5eqPbXBb9vceTVG6jQ=="],
|
||||
"@scalar/postman-to-openapi": ["@scalar/postman-to-openapi@0.1.43", "", { "dependencies": { "@scalar/oas-utils": "0.2.120", "@scalar/openapi-types": "0.1.9" } }, "sha512-gLOkYYPCTKYFBOwyBOKZDc0seZjntmwPTchJUr3oxGQmLB1Y5VBJ+8fXJCTp5TwKiiztjALJs79y9s7jXBdWMA=="],
|
||||
|
||||
"@scalar/snippetz": ["@scalar/snippetz@0.2.19", "", { "dependencies": { "stringify-object": "^5.0.0" } }, "sha512-fxC5mL3AZWiXAM21sMe1QU1/mu5KceN8ZmzFaP3xmdK26o/MkPKSLGVWW7w6OQkZi5hNloLHXXQiaI235qomEg=="],
|
||||
"@scalar/snippetz": ["@scalar/snippetz@0.2.16", "", { "dependencies": { "stringify-object": "^5.0.0" } }, "sha512-xtIY4kvV619IF2uXg6fDw7emtXwuJeWzLunGAaUTIOwNRw5mGSKqJnLcSnIiSdH54YmN8D2CtdJRo2VxPP9/Wg=="],
|
||||
|
||||
"@scalar/themes": ["@scalar/themes@0.9.86", "", { "dependencies": { "@scalar/types": "0.1.7" } }, "sha512-QUHo9g5oSWi+0Lm1vJY9TaMZRau8LHg+vte7q5BVTBnu6NuQfigCaN+ouQ73FqIVd96TwMO6Db+dilK1B+9row=="],
|
||||
"@scalar/themes": ["@scalar/themes@0.9.79", "", { "dependencies": { "@scalar/types": "0.1.1" } }, "sha512-zWiHCZAIjPGa8X9o/NORBPRMTMblLEz2+2RcfW9yIKNO/8H4Gz0rltiGGlJ6vX0o+qHwx7AdgfY+7njmWQR4ng=="],
|
||||
|
||||
"@scalar/types": ["@scalar/types@0.1.7", "", { "dependencies": { "@scalar/openapi-types": "0.2.0", "@unhead/schema": "^1.11.11", "nanoid": "^5.1.5", "type-fest": "^4.20.0", "zod": "^3.23.8" } }, "sha512-irIDYzTQG2KLvFbuTI8k2Pz/R4JR+zUUSykVTbEMatkzMmVFnn1VzNSMlODbadycwZunbnL2tA27AXed9URVjw=="],
|
||||
"@scalar/types": ["@scalar/types@0.1.1", "", { "dependencies": { "@scalar/openapi-types": "0.1.9", "@unhead/schema": "^1.11.11", "zod": "^3.23.8" } }, "sha512-LlUX6AmOOGoRqOMoO835V2FezM1KiO5UlvQC3poT/s7oqD6ranqwRNFxyrPz/IxClPYR+SV1yBUSNKely4ZQhQ=="],
|
||||
|
||||
"@scalar/use-codemirror": ["@scalar/use-codemirror@0.11.92", "", { "dependencies": { "@codemirror/autocomplete": "^6.18.3", "@codemirror/commands": "^6.7.1", "@codemirror/lang-css": "^6.3.1", "@codemirror/lang-html": "^6.4.8", "@codemirror/lang-json": "^6.0.0", "@codemirror/lang-xml": "^6.0.0", "@codemirror/lang-yaml": "^6.1.2", "@codemirror/language": "^6.10.7", "@codemirror/lint": "^6.8.4", "@codemirror/state": "^6.5.0", "@codemirror/view": "^6.35.3", "@lezer/common": "^1.2.3", "@lezer/highlight": "^1.2.1", "@lezer/lr": "^1.4.2", "@replit/codemirror-css-color-picker": "^6.3.0", "@scalar/components": "0.13.47", "codemirror": "^6.0.0", "style-mod": "^4.1.2", "vue": "^3.5.12" } }, "sha512-WDd50xGLV+q1T36cKzmhqYP+TyHe4MOW0tIiu09ed9aMXGUk6kQgnf0J3rYPsGeNj9IkVG3znZ7oYT3QplLGVA=="],
|
||||
"@scalar/use-codemirror": ["@scalar/use-codemirror@0.11.82", "", { "dependencies": { "@codemirror/autocomplete": "^6.18.3", "@codemirror/commands": "^6.7.1", "@codemirror/lang-css": "^6.3.1", "@codemirror/lang-html": "^6.4.8", "@codemirror/lang-json": "^6.0.0", "@codemirror/lang-xml": "^6.0.0", "@codemirror/lang-yaml": "^6.1.2", "@codemirror/language": "^6.10.7", "@codemirror/lint": "^6.8.4", "@codemirror/state": "^6.5.0", "@codemirror/view": "^6.35.3", "@lezer/common": "^1.2.3", "@lezer/highlight": "^1.2.1", "@lezer/lr": "^1.4.2", "@replit/codemirror-css-color-picker": "^6.3.0", "@scalar/components": "0.13.37", "codemirror": "^6.0.0", "style-mod": "^4.1.2", "vue": "^3.5.12" } }, "sha512-zFECln7aWKRf6iJO9oovByD59EsrOMenNLfLhneH6L+K1CrBoHFVr4czSDlom1wlr3HPg3xwpZrukoAteHYILQ=="],
|
||||
|
||||
"@scalar/use-hooks": ["@scalar/use-hooks@0.1.40", "", { "dependencies": { "@scalar/themes": "0.9.86", "@scalar/use-toasts": "0.7.9", "@vueuse/core": "^10.10.0", "vue": "^3.5.12", "zod": "^3.23.8" } }, "sha512-z8qtgIcW9Z3PCrP2cbKG+D2EVhpNgl1N0ucGtDg5SMl/fvCyXNfqB9j+u3ygxkouatfQ9zRZuhxreNMkW9/H5g=="],
|
||||
"@scalar/use-hooks": ["@scalar/use-hooks@0.1.33", "", { "dependencies": { "@scalar/themes": "0.9.79", "@scalar/use-toasts": "0.7.9", "@vueuse/core": "^10.10.0", "vue": "^3.5.12", "zod": "^3.23.8" } }, "sha512-ENm0bWwRdAWWF/S6TbE+fFx0vP2mgEpG5APqQBomm0a41/6L2HJ/TN+9ajAvrJXGi0ULWuxihNS4Jue6tpEssA=="],
|
||||
|
||||
"@scalar/use-toasts": ["@scalar/use-toasts@0.7.9", "", { "dependencies": { "nanoid": "^5.0.9", "vue": "^3.5.12", "vue-sonner": "^1.0.3" } }, "sha512-EcUDJY8VozLS9sfoQKvvipStQJ9RuH/nKOzf0BBr+mZDmumi1WFZ1iIJnHVXIN3iSLcSAr5ej6rOqa6jIv4bCQ=="],
|
||||
|
||||
@@ -2320,7 +2320,7 @@
|
||||
|
||||
"mz": ["mz@2.7.0", "", { "dependencies": { "any-promise": "^1.0.0", "object-assign": "^4.0.1", "thenify-all": "^1.0.0" } }, "sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q=="],
|
||||
|
||||
"nanoid": ["nanoid@5.1.5", "", { "bin": { "nanoid": "bin/nanoid.js" } }, "sha512-Ir/+ZpE9fDsNH0hQ3C68uyThDXzYcim2EqcZ8zn8Chtt1iylPT9xXJB0kPCnqzgcEGikO9RxSrh63MsmVCU7Fw=="],
|
||||
"nanoid": ["nanoid@5.1.2", "", { "bin": { "nanoid": "bin/nanoid.js" } }, "sha512-b+CiXQCNMUGe0Ri64S9SXFcP9hogjAJ2Rd6GdVxhPLRm7mhGaM7VgOvCAJ1ZshfHbqVDI3uqTI5C8/GaKuLI7g=="],
|
||||
|
||||
"negotiator": ["negotiator@1.0.0", "", {}, "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg=="],
|
||||
|
||||
@@ -2812,7 +2812,7 @@
|
||||
|
||||
"type": ["type@2.7.3", "", {}, "sha512-8j+1QmAbPvLZow5Qpi6NCaN8FB60p/6x8/vfNqOk/hC+HuvFZhL4+WfekuhQLiqFZXOgQdrs3B+XxEmCc6b3FQ=="],
|
||||
|
||||
"type-fest": ["type-fest@4.40.0", "", {}, "sha512-ABHZ2/tS2JkvH1PEjxFDTUWC8dB5OsIGZP4IFLhR293GqT5Y5qB1WwL2kMPYhQW9DVgVD8Hd7I8gjwPIf5GFkw=="],
|
||||
"type-fest": ["type-fest@0.13.1", "", {}, "sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg=="],
|
||||
|
||||
"type-is": ["type-is@2.0.0", "", { "dependencies": { "content-type": "^1.0.5", "media-typer": "^1.1.0", "mime-types": "^3.0.0" } }, "sha512-gd0sGezQYCbWSbkZr75mln4YBidWUN60+devscpLF5mtRDUpiaTvKpBNrdaCvel1NdR2k6vclXybU5fBd2i+nw=="],
|
||||
|
||||
@@ -3714,23 +3714,21 @@
|
||||
|
||||
"@rollup/pluginutils/picomatch": ["picomatch@4.0.2", "", {}, "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg=="],
|
||||
|
||||
"@scalar/api-client/@scalar/openapi-parser": ["@scalar/openapi-parser@0.10.14", "", { "dependencies": { "ajv": "^8.17.1", "ajv-draft-04": "^1.0.0", "ajv-formats": "^3.0.1", "jsonpointer": "^5.0.1", "leven": "^4.0.0", "yaml": "^2.4.5" } }, "sha512-VXr979NMx6wZ+kpFKor2eyCJZOjyMwcBRc6c4Gc92ZMOC7ZNYqjwbw+Ubh2ELJyP5cWAjOFSrNwtylema0pw5w=="],
|
||||
|
||||
"@scalar/api-client/@scalar/openapi-types": ["@scalar/openapi-types@0.2.0", "", { "dependencies": { "zod": "^3.23.8" } }, "sha512-waiKk12cRCqyUCWTOX0K1WEVX46+hVUK+zRPzAahDJ7G0TApvbNkuy5wx7aoUyEk++HHde0XuQnshXnt8jsddA=="],
|
||||
|
||||
"@scalar/api-client/pretty-ms": ["pretty-ms@8.0.0", "", { "dependencies": { "parse-ms": "^3.0.0" } }, "sha512-ASJqOugUF1bbzI35STMBUpZqdfYKlJugy6JBziGi2EE+AL5JPJGSzvpeVXojxrr0ViUYoToUjb5kjSEGf7Y83Q=="],
|
||||
|
||||
"@scalar/import/@scalar/openapi-parser": ["@scalar/openapi-parser@0.10.14", "", { "dependencies": { "ajv": "^8.17.1", "ajv-draft-04": "^1.0.0", "ajv-formats": "^3.0.1", "jsonpointer": "^5.0.1", "leven": "^4.0.0", "yaml": "^2.4.5" } }, "sha512-VXr979NMx6wZ+kpFKor2eyCJZOjyMwcBRc6c4Gc92ZMOC7ZNYqjwbw+Ubh2ELJyP5cWAjOFSrNwtylema0pw5w=="],
|
||||
"@scalar/api-client/zod": ["zod@3.23.8", "", {}, "sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g=="],
|
||||
|
||||
"@scalar/oas-utils/@scalar/openapi-types": ["@scalar/openapi-types@0.2.0", "", { "dependencies": { "zod": "^3.23.8" } }, "sha512-waiKk12cRCqyUCWTOX0K1WEVX46+hVUK+zRPzAahDJ7G0TApvbNkuy5wx7aoUyEk++HHde0XuQnshXnt8jsddA=="],
|
||||
"@scalar/code-highlight/remark-gfm": ["remark-gfm@4.0.0", "", { "dependencies": { "@types/mdast": "^4.0.0", "mdast-util-gfm": "^3.0.0", "micromark-extension-gfm": "^3.0.0", "remark-parse": "^11.0.0", "remark-stringify": "^11.0.0", "unified": "^11.0.0" } }, "sha512-U92vJgBPkbw4Zfu/IiW2oTZLSL3Zpv+uI7My2eq8JxKgqraFdU8YUGicEJCEgSbeaG+QDFqIcwwfMTOEelPxuA=="],
|
||||
|
||||
"@scalar/oas-utils/flatted": ["flatted@3.3.1", "", {}, "sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw=="],
|
||||
|
||||
"@scalar/oas-utils/zod": ["zod@3.23.8", "", {}, "sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g=="],
|
||||
|
||||
"@scalar/object-utils/flatted": ["flatted@3.3.1", "", {}, "sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw=="],
|
||||
|
||||
"@scalar/postman-to-openapi/@scalar/openapi-types": ["@scalar/openapi-types@0.2.0", "", { "dependencies": { "zod": "^3.23.8" } }, "sha512-waiKk12cRCqyUCWTOX0K1WEVX46+hVUK+zRPzAahDJ7G0TApvbNkuy5wx7aoUyEk++HHde0XuQnshXnt8jsddA=="],
|
||||
"@scalar/types/zod": ["zod@3.23.8", "", {}, "sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g=="],
|
||||
|
||||
"@scalar/types/@scalar/openapi-types": ["@scalar/openapi-types@0.2.0", "", { "dependencies": { "zod": "^3.23.8" } }, "sha512-waiKk12cRCqyUCWTOX0K1WEVX46+hVUK+zRPzAahDJ7G0TApvbNkuy5wx7aoUyEk++HHde0XuQnshXnt8jsddA=="],
|
||||
|
||||
"@scalar/use-toasts/nanoid": ["nanoid@5.1.2", "", { "bin": { "nanoid": "bin/nanoid.js" } }, "sha512-b+CiXQCNMUGe0Ri64S9SXFcP9hogjAJ2Rd6GdVxhPLRm7mhGaM7VgOvCAJ1ZshfHbqVDI3uqTI5C8/GaKuLI7g=="],
|
||||
"@scalar/use-hooks/zod": ["zod@3.23.8", "", {}, "sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g=="],
|
||||
|
||||
"@shikijs/core/hast-util-to-html": ["hast-util-to-html@9.0.5", "", { "dependencies": { "@types/hast": "^3.0.0", "@types/unist": "^3.0.0", "ccount": "^2.0.0", "comma-separated-tokens": "^2.0.0", "hast-util-whitespace": "^3.0.0", "html-void-elements": "^3.0.0", "mdast-util-to-hast": "^13.0.0", "property-information": "^7.0.0", "space-separated-tokens": "^2.0.0", "stringify-entities": "^4.0.0", "zwitch": "^2.0.4" } }, "sha512-OguPdidb+fbHQSU4Q4ZiLKnzWo8Wwsf5bZfbvu7//a9oTYoqD/fWpe96NuHkoS9h0ccGOTe0C4NGXdtS0iObOw=="],
|
||||
|
||||
@@ -4082,8 +4080,6 @@
|
||||
|
||||
"mdast-util-gfm-task-list-item/mdast-util-to-markdown": ["mdast-util-to-markdown@2.1.0", "", { "dependencies": { "@types/mdast": "^4.0.0", "@types/unist": "^3.0.0", "longest-streak": "^3.0.0", "mdast-util-phrasing": "^4.0.0", "mdast-util-to-string": "^4.0.0", "micromark-util-decode-string": "^2.0.0", "unist-util-visit": "^5.0.0", "zwitch": "^2.0.0" } }, "sha512-SR2VnIEdVNCJbP6y7kVTJgPLifdr8WEU440fQec7qHoHOUz/oJ2jmNRqdDQ3rbiStOXb2mCDGTuwsK5OPUgYlQ=="],
|
||||
|
||||
"meow/type-fest": ["type-fest@0.13.1", "", {}, "sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg=="],
|
||||
|
||||
"micro/arg": ["arg@4.1.0", "", {}, "sha512-ZWc51jO3qegGkVh8Hwpv636EkbesNV5ZNQPCtRa+0qytRYPEs9IYT9qITY9buezqUH5uqyzlWLcufrzU2rffdg=="],
|
||||
|
||||
"micro/content-type": ["content-type@1.0.4", "", {}, "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA=="],
|
||||
|
||||
@@ -10,18 +10,22 @@ export type DropdownButtonProps<E extends HTMLElement = HTMLElement> = Omit<
|
||||
'ref'
|
||||
>;
|
||||
|
||||
/**
|
||||
* Button with a dropdown.
|
||||
*/
|
||||
export function Dropdown<E extends HTMLElement>(props: {
|
||||
export type DropdownProps<E extends HTMLElement = HTMLElement> = {
|
||||
/** Content of the button */
|
||||
button: (buttonProps: DropdownButtonProps<E>) => React.ReactNode;
|
||||
/** Content of the dropdown */
|
||||
children: React.ReactNode;
|
||||
/** Custom styles */
|
||||
className?: ClassValue;
|
||||
}) {
|
||||
const { button, children, className } = props;
|
||||
/** Whether to use fixed positioning (for fixed navbars) */
|
||||
useFixedPosition?: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
* Button with a dropdown.
|
||||
*/
|
||||
export function Dropdown<E extends HTMLElement = HTMLElement>(props: DropdownProps<E>) {
|
||||
const { button, children, className, useFixedPosition = false } = props;
|
||||
const dropdownId = useId();
|
||||
|
||||
return (
|
||||
@@ -53,7 +57,7 @@ export function Dropdown<E extends HTMLElement>(props: {
|
||||
className
|
||||
)}
|
||||
>
|
||||
<div className="fixed z-50 w-52">
|
||||
<div className={tcls(useFixedPosition ? 'fixed' : 'absolute', 'z-50 w-52')}>
|
||||
<div
|
||||
className={tcls(
|
||||
'mt-2',
|
||||
@@ -92,6 +96,7 @@ export function DropdownChevron() {
|
||||
'ms-1',
|
||||
'transition-all',
|
||||
'group-hover/dropdown:opacity-11',
|
||||
'group-hover/dropdown:rotate-180',
|
||||
'group-focus-within/dropdown:rotate-180'
|
||||
)}
|
||||
/>
|
||||
|
||||
@@ -212,6 +212,7 @@ export function Header(props: { context: GitBookSiteContext; withTopHeader?: boo
|
||||
siteSpace={siteSpace}
|
||||
siteSpaces={siteSpaces}
|
||||
className="w-full grow py-1"
|
||||
useFixedPosition={true}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -3,15 +3,17 @@ import type { SiteSpace } from '@gitbook/api';
|
||||
import { tcls } from '@/lib/tailwind';
|
||||
|
||||
import type { GitBookSiteContext } from '@v2/lib/context';
|
||||
import { Dropdown, DropdownChevron, DropdownMenu } from './Dropdown';
|
||||
import { Dropdown, DropdownChevron, DropdownMenu, type DropdownProps } from './Dropdown';
|
||||
import { SpacesDropdownMenuItem } from './SpacesDropdownMenuItem';
|
||||
|
||||
export function SpacesDropdown(props: {
|
||||
context: GitBookSiteContext;
|
||||
siteSpace: SiteSpace;
|
||||
siteSpaces: SiteSpace[];
|
||||
className?: string;
|
||||
}) {
|
||||
export function SpacesDropdown(
|
||||
props: {
|
||||
context: GitBookSiteContext;
|
||||
siteSpace: SiteSpace;
|
||||
siteSpaces: SiteSpace[];
|
||||
className?: string;
|
||||
} & Partial<DropdownProps>
|
||||
) {
|
||||
const { context, siteSpace, siteSpaces, className } = props;
|
||||
const { linker } = context;
|
||||
|
||||
@@ -67,6 +69,7 @@ export function SpacesDropdown(props: {
|
||||
<DropdownChevron />
|
||||
</div>
|
||||
)}
|
||||
{...props}
|
||||
>
|
||||
<DropdownMenu>
|
||||
{siteSpaces.map((otherSiteSpace, index) => (
|
||||
|
||||
@@ -26,7 +26,6 @@ import {
|
||||
type CacheFunctionOptions,
|
||||
cache,
|
||||
cacheResponse,
|
||||
getResponseCacheTags,
|
||||
noCacheFetchOptions,
|
||||
parseCacheResponse,
|
||||
} from './cache';
|
||||
@@ -371,17 +370,6 @@ interface GetRevisionOptions {
|
||||
* These options don't impact the cache key and it means revisions can be shared between different fetches with different metadata options.
|
||||
*/
|
||||
metadata: boolean;
|
||||
|
||||
/**
|
||||
* Whether to fetch the revision as a computed revision.
|
||||
* @default true
|
||||
*/
|
||||
computed?: boolean;
|
||||
|
||||
/**
|
||||
* Additional tags to add to the cache entry.
|
||||
*/
|
||||
tags?: string[];
|
||||
}
|
||||
|
||||
const getAPIContextId = async () => {
|
||||
@@ -394,14 +382,8 @@ const getAPIContextId = async () => {
|
||||
*/
|
||||
export const getRevision = cache({
|
||||
name: 'api.getRevision.v2',
|
||||
tag: (spaceId, revisionId, fetchOptions) =>
|
||||
// Temporary hack to make it work with OpenAPI on v1
|
||||
fetchOptions.tags?.[0] ??
|
||||
getCacheTag({
|
||||
tag: 'revision',
|
||||
space: spaceId,
|
||||
revision: revisionId,
|
||||
}),
|
||||
tag: (spaceId, revisionId) =>
|
||||
getCacheTag({ tag: 'revision', space: spaceId, revision: revisionId }),
|
||||
tagImmutable: true,
|
||||
getKeySuffix: getAPIContextId,
|
||||
get: async (
|
||||
@@ -423,20 +405,9 @@ export const getRevision = cache({
|
||||
}
|
||||
);
|
||||
|
||||
return cacheResponse(response, {
|
||||
...(fetchOptions.metadata ? cacheTtl_7days : cacheTtl_1day),
|
||||
data: {
|
||||
...response.data,
|
||||
tags: getResponseCacheTags(response),
|
||||
},
|
||||
});
|
||||
},
|
||||
getKeyArgs: ([spaceId, revisionId, fetchOptions]) => {
|
||||
if (fetchOptions.computed === true) {
|
||||
return [spaceId, revisionId, { computed: true }];
|
||||
}
|
||||
return [spaceId, revisionId];
|
||||
return cacheResponse(response, fetchOptions.metadata ? cacheTtl_7days : cacheTtl_1day);
|
||||
},
|
||||
getKeyArgs: (args) => [args[0], args[1]],
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -444,14 +415,8 @@ export const getRevision = cache({
|
||||
*/
|
||||
export const getRevisionPages = cache({
|
||||
name: 'api.getRevisionPages.v4',
|
||||
tag: (spaceId, revisionId, fetchOptions) =>
|
||||
// Temporary hack to make it work with OpenAPI on v1
|
||||
fetchOptions.tags?.[0] ??
|
||||
getCacheTag({
|
||||
tag: 'revision',
|
||||
space: spaceId,
|
||||
revision: revisionId,
|
||||
}),
|
||||
tag: (spaceId, revisionId) =>
|
||||
getCacheTag({ tag: 'revision', space: spaceId, revision: revisionId }),
|
||||
tagImmutable: true,
|
||||
getKeySuffix: getAPIContextId,
|
||||
get: async (
|
||||
@@ -475,15 +440,10 @@ export const getRevisionPages = cache({
|
||||
|
||||
return cacheResponse(response, {
|
||||
...(fetchOptions.metadata ? cacheTtl_7days : cacheTtl_1day),
|
||||
data: { ...response.data, tags: getResponseCacheTags(response) },
|
||||
data: response.data.pages,
|
||||
});
|
||||
},
|
||||
getKeyArgs: ([spaceId, revisionId, fetchOptions]) => {
|
||||
if (fetchOptions.computed === true) {
|
||||
return [spaceId, revisionId, { computed: true }];
|
||||
}
|
||||
return [spaceId, revisionId];
|
||||
},
|
||||
getKeyArgs: (args) => [args[0], args[1]],
|
||||
});
|
||||
|
||||
/**
|
||||
|
||||
+3
-10
@@ -13,14 +13,6 @@ export const noCacheFetchOptions: Partial<RequestInit> = {
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Return the cache tags from the response.
|
||||
*/
|
||||
export function getResponseCacheTags(response: Response): string[] {
|
||||
const cacheTagHeader = response.headers.get('x-gitbook-cache-tag');
|
||||
return !cacheTagHeader ? [] : cacheTagHeader.split(',');
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse an HTTP response into a cache entry.
|
||||
*/
|
||||
@@ -34,7 +26,8 @@ export function parseCacheResponse(response: Response): {
|
||||
const cacheControlHeader = response.headers.get('cache-control');
|
||||
const cacheControl = cacheControlHeader ? parseCacheControl(cacheControlHeader) : null;
|
||||
|
||||
const tags = getResponseCacheTags(response);
|
||||
const cacheTagHeader = response.headers.get('x-gitbook-cache-tag');
|
||||
const tags = !cacheTagHeader ? [] : cacheTagHeader.split(',');
|
||||
|
||||
const entry = {
|
||||
ttl: 60 * 60 * 24,
|
||||
@@ -54,7 +47,7 @@ export function parseCacheResponse(response: Response): {
|
||||
export function cacheResponse<Result, DefaultData = Result>(
|
||||
response: Response & { data: Result },
|
||||
defaultEntry: Partial<CacheResult<DefaultData>> = {}
|
||||
): CacheResult<DefaultData extends undefined ? Result : DefaultData> {
|
||||
): CacheResult<DefaultData extends Result ? Result : DefaultData> {
|
||||
const parsed = parseCacheResponse(response);
|
||||
|
||||
return {
|
||||
|
||||
@@ -8,7 +8,6 @@ import type { GitBookDataFetcher } from '@v2/lib/data/types';
|
||||
import { createImageResizer } from '@v2/lib/images';
|
||||
import { createLinker } from '@v2/lib/links';
|
||||
|
||||
import { RevisionPageType } from '@gitbook/api';
|
||||
import { DataFetcherError, wrapDataFetcherError } from '@v2/lib/data';
|
||||
import { headers } from 'next/headers';
|
||||
import {
|
||||
@@ -135,29 +134,9 @@ async function getDataFetcherV1(): Promise<GitBookDataFetcher> {
|
||||
|
||||
getRevision(params) {
|
||||
return wrapDataFetcherError(async () => {
|
||||
const { tags, ...revision } = await getRevision(params.spaceId, params.revisionId, {
|
||||
return getRevision(params.spaceId, params.revisionId, {
|
||||
metadata: params.metadata,
|
||||
computed: false,
|
||||
});
|
||||
|
||||
if (
|
||||
Object.values(revision.pages).some(
|
||||
(page) => page.type === RevisionPageType.Computed
|
||||
)
|
||||
) {
|
||||
const { tags: _tags, ...revision } = await getRevision(
|
||||
params.spaceId,
|
||||
params.revisionId,
|
||||
{
|
||||
metadata: params.metadata,
|
||||
computed: true,
|
||||
tags,
|
||||
}
|
||||
);
|
||||
return revision;
|
||||
}
|
||||
|
||||
return revision;
|
||||
});
|
||||
},
|
||||
|
||||
@@ -204,22 +183,9 @@ async function getDataFetcherV1(): Promise<GitBookDataFetcher> {
|
||||
|
||||
getRevisionPages(params) {
|
||||
return wrapDataFetcherError(async () => {
|
||||
const { pages, tags } = await getRevisionPages(params.spaceId, params.revisionId, {
|
||||
return getRevisionPages(params.spaceId, params.revisionId, {
|
||||
metadata: params.metadata,
|
||||
computed: false,
|
||||
});
|
||||
|
||||
if (pages.some((page) => page.type === RevisionPageType.Computed)) {
|
||||
const { pages } = await getRevisionPages(params.spaceId, params.revisionId, {
|
||||
metadata: params.metadata,
|
||||
computed: true,
|
||||
tags,
|
||||
});
|
||||
|
||||
return pages;
|
||||
}
|
||||
|
||||
return pages;
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
"sideEffects": false,
|
||||
"dependencies": {
|
||||
"@gitbook/openapi-parser": "workspace:*",
|
||||
"@scalar/api-client-react": "^1.2.19",
|
||||
"@scalar/oas-utils": "^0.2.130",
|
||||
"@scalar/api-client-react": "^1.2.5",
|
||||
"@scalar/oas-utils": "^0.2.120",
|
||||
"clsx": "^2.1.1",
|
||||
"flatted": "^3.2.9",
|
||||
"json-xml-parse": "^1.3.0",
|
||||
|
||||
@@ -35,86 +35,6 @@ describe('getSchemaAlternatives', () => {
|
||||
]);
|
||||
});
|
||||
|
||||
it('merges string enum', () => {
|
||||
expect(
|
||||
getSchemaAlternatives({
|
||||
oneOf: [
|
||||
{
|
||||
oneOf: [
|
||||
{
|
||||
type: 'string',
|
||||
enum: ['a', 'b'],
|
||||
},
|
||||
{
|
||||
type: 'string',
|
||||
enum: ['c', 'd'],
|
||||
nullable: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
})
|
||||
).toEqual([
|
||||
{
|
||||
type: 'string',
|
||||
enum: ['a', 'b', 'c', 'd'],
|
||||
nullable: true,
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it('merges objects with allOf', () => {
|
||||
expect(
|
||||
getSchemaAlternatives({
|
||||
allOf: [
|
||||
{
|
||||
type: 'object',
|
||||
properties: {
|
||||
name: {
|
||||
type: 'string',
|
||||
},
|
||||
map: {
|
||||
type: 'string',
|
||||
},
|
||||
description: {
|
||||
type: 'string',
|
||||
},
|
||||
},
|
||||
required: ['name'],
|
||||
},
|
||||
{
|
||||
type: 'object',
|
||||
properties: {
|
||||
externalId: {
|
||||
type: 'string',
|
||||
},
|
||||
},
|
||||
required: ['map', 'externalId'],
|
||||
},
|
||||
],
|
||||
})
|
||||
).toEqual([
|
||||
{
|
||||
type: 'object',
|
||||
properties: {
|
||||
name: {
|
||||
type: 'string',
|
||||
},
|
||||
map: {
|
||||
type: 'string',
|
||||
},
|
||||
description: {
|
||||
type: 'string',
|
||||
},
|
||||
externalId: {
|
||||
type: 'string',
|
||||
},
|
||||
},
|
||||
required: ['name', 'map', 'externalId'],
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it('should not flatten oneOf and allOf', () => {
|
||||
expect(
|
||||
getSchemaAlternatives({
|
||||
|
||||
@@ -450,91 +450,7 @@ export function getSchemaAlternatives(
|
||||
}
|
||||
|
||||
const [type, schemas] = alternatives;
|
||||
return mergeAlternatives(
|
||||
type,
|
||||
flattenAlternatives(type, schemas, new Set(ancestors).add(schema))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge alternatives of the same type into a single schema.
|
||||
* - Merge string enums
|
||||
*/
|
||||
function mergeAlternatives(
|
||||
alternativeType: AlternativeType,
|
||||
schemasOrRefs: OpenAPIV3.SchemaObject[]
|
||||
): OpenAPIV3.SchemaObject[] | null {
|
||||
switch (alternativeType) {
|
||||
case 'oneOf': {
|
||||
return schemasOrRefs.reduce<OpenAPIV3.SchemaObject[]>((acc, schemaOrRef) => {
|
||||
const latest = acc.at(-1);
|
||||
|
||||
if (
|
||||
latest &&
|
||||
latest.type === 'string' &&
|
||||
latest.enum &&
|
||||
schemaOrRef.type === 'string' &&
|
||||
schemaOrRef.enum
|
||||
) {
|
||||
latest.enum = Array.from(new Set([...latest.enum, ...schemaOrRef.enum]));
|
||||
latest.nullable = latest.nullable || schemaOrRef.nullable;
|
||||
return acc;
|
||||
}
|
||||
|
||||
acc.push(schemaOrRef);
|
||||
return acc;
|
||||
}, []);
|
||||
}
|
||||
case 'allOf': {
|
||||
return schemasOrRefs.reduce<OpenAPIV3.SchemaObject[]>((acc, schemaOrRef) => {
|
||||
const latest = acc.at(-1);
|
||||
|
||||
if (
|
||||
latest &&
|
||||
latest.type === 'string' &&
|
||||
latest.enum &&
|
||||
schemaOrRef.type === 'string' &&
|
||||
schemaOrRef.enum
|
||||
) {
|
||||
const keys = Object.keys(schemaOrRef);
|
||||
if (keys.every((key) => ['type', 'enum', 'nullable'].includes(key))) {
|
||||
latest.enum = Array.from(new Set([...latest.enum, ...schemaOrRef.enum]));
|
||||
latest.nullable = latest.nullable || schemaOrRef.nullable;
|
||||
return acc;
|
||||
}
|
||||
}
|
||||
|
||||
if (latest && latest.type === 'object' && schemaOrRef.type === 'object') {
|
||||
const keys = Object.keys(schemaOrRef);
|
||||
if (
|
||||
keys.every((key) =>
|
||||
['type', 'properties', 'required', 'nullable'].includes(key)
|
||||
)
|
||||
) {
|
||||
latest.properties = {
|
||||
...latest.properties,
|
||||
...schemaOrRef.properties,
|
||||
};
|
||||
latest.required = Array.from(
|
||||
new Set([
|
||||
...(Array.isArray(latest.required) ? latest.required : []),
|
||||
...(Array.isArray(schemaOrRef.required)
|
||||
? schemaOrRef.required
|
||||
: []),
|
||||
])
|
||||
);
|
||||
latest.nullable = latest.nullable || schemaOrRef.nullable;
|
||||
return acc;
|
||||
}
|
||||
}
|
||||
|
||||
acc.push(schemaOrRef);
|
||||
return acc;
|
||||
}, []);
|
||||
}
|
||||
default:
|
||||
return schemasOrRefs;
|
||||
}
|
||||
return flattenAlternatives(type, schemas, new Set(ancestors).add(schema));
|
||||
}
|
||||
|
||||
function flattenAlternatives(
|
||||
|
||||
@@ -59,7 +59,10 @@ function ScalarModal(props: {
|
||||
}) {
|
||||
const { method, path, specUrl, controllerRef } = props;
|
||||
return (
|
||||
<ApiClientModalProvider configuration={{ url: specUrl }} initialRequest={{ method, path }}>
|
||||
<ApiClientModalProvider
|
||||
configuration={{ spec: { url: specUrl } }}
|
||||
initialRequest={{ method, path }}
|
||||
>
|
||||
<ScalarModalController method={method} path={path} controllerRef={controllerRef} />
|
||||
</ApiClientModalProvider>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user