docs: fix api-reference with proxy (#7952)
This commit is contained in:
1 parent
0d534d4f70
commit
1acbcf612e
17 files changed
+24
-20
No files matched your search
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
import "../../globals.css"
|
import "../../../globals.css"
|
||||||
import Navbar from "@/components/Navbar"
|
import Navbar from "@/components/Navbar"
|
||||||
import Providers from "../../../providers"
|
import Providers from "../../../../providers"
|
||||||
import { WideLayout } from "docs-ui"
|
import { WideLayout } from "docs-ui"
|
||||||
import { Inter, Roboto_Mono } from "next/font/google"
|
import { Inter, Roboto_Mono } from "next/font/google"
|
||||||
import clsx from "clsx"
|
import clsx from "clsx"
|
||||||
File renamed without changes.
+3
-3
@@ -1,7 +1,7 @@
|
|||||||
import AreaProvider from "@/providers/area"
|
import AreaProvider from "@/providers/area"
|
||||||
import AdminContentV2 from "../../_mdx/admin.mdx"
|
import AdminContentV2 from "../../../_mdx/admin.mdx"
|
||||||
import StoreContentV2 from "../../_mdx/store.mdx"
|
import StoreContentV2 from "../../../_mdx/store.mdx"
|
||||||
import ClientLibrariesV2 from "../../_mdx/client-libraries.mdx"
|
import ClientLibrariesV2 from "../../../_mdx/client-libraries.mdx"
|
||||||
import Section from "@/components/Section"
|
import Section from "@/components/Section"
|
||||||
import Tags from "@/components/Tags"
|
import Tags from "@/components/Tags"
|
||||||
import type { Area } from "@/types/openapi"
|
import type { Area } from "@/types/openapi"
|
||||||
File renamed without changes.
+4
-4
@@ -1,12 +1,12 @@
|
|||||||
import OpenAPIParser from "@readme/openapi-parser"
|
import OpenAPIParser from "@readme/openapi-parser"
|
||||||
import algoliasearch from "algoliasearch"
|
import algoliasearch from "algoliasearch"
|
||||||
import type { ExpandedDocument, Operation } from "../../../types/openapi"
|
import type { ExpandedDocument, Operation } from "../../../../types/openapi"
|
||||||
import path from "path"
|
import path from "path"
|
||||||
import getPathsOfTag from "../../../utils/get-paths-of-tag"
|
import getPathsOfTag from "../../../../utils/get-paths-of-tag"
|
||||||
import getSectionId from "../../../utils/get-section-id"
|
import getSectionId from "../../../../utils/get-section-id"
|
||||||
import { NextResponse } from "next/server"
|
import { NextResponse } from "next/server"
|
||||||
import { JSDOM } from "jsdom"
|
import { JSDOM } from "jsdom"
|
||||||
import getUrl from "../../../utils/get-url"
|
import getUrl from "../../../../utils/get-url"
|
||||||
import { capitalize } from "docs-ui"
|
import { capitalize } from "docs-ui"
|
||||||
|
|
||||||
export async function GET() {
|
export async function GET() {
|
||||||
File renamed without changes.
File renamed without changes.
+2
-2
@@ -1,9 +1,9 @@
|
|||||||
import { NextResponse } from "next/server"
|
import { NextResponse } from "next/server"
|
||||||
import { SchemaObject } from "../../../types/openapi"
|
import { SchemaObject } from "../../../../types/openapi"
|
||||||
import path from "path"
|
import path from "path"
|
||||||
import { existsSync, promises as fs } from "fs"
|
import { existsSync, promises as fs } from "fs"
|
||||||
import { parseDocument } from "yaml"
|
import { parseDocument } from "yaml"
|
||||||
import dereference from "../../../utils/dereference"
|
import dereference from "../../../../utils/dereference"
|
||||||
|
|
||||||
export async function GET(request: Request) {
|
export async function GET(request: Request) {
|
||||||
const { searchParams } = new URL(request.url)
|
const { searchParams } = new URL(request.url)
|
||||||
File renamed without changes.
@@ -9,7 +9,11 @@ const DownloadFull = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Button variant="secondary">
|
<Button variant="secondary">
|
||||||
<Link href={`/api/download/${area}`} download target="_blank">
|
<Link
|
||||||
|
href={`${process.env.NEXT_PUBLIC_BASE_PATH}/download/${area}`}
|
||||||
|
download
|
||||||
|
target="_blank"
|
||||||
|
>
|
||||||
Download openapi.yaml
|
Download openapi.yaml
|
||||||
</Link>
|
</Link>
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ const Navbar = () => {
|
|||||||
return (
|
return (
|
||||||
<UiNavbar
|
<UiNavbar
|
||||||
logo={{
|
logo={{
|
||||||
light: basePathUrl("/images/logo-icon.png"),
|
light: "/images/logo-icon.png",
|
||||||
dark: basePathUrl("/images/logo-icon-dark.png"),
|
dark: "/images/logo-icon-dark.png",
|
||||||
}}
|
}}
|
||||||
items={navbarItems}
|
items={navbarItems}
|
||||||
mobileMenuButton={{
|
mobileMenuButton={{
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ const TagPaths = ({ tag, className }: TagPathsProps) => {
|
|||||||
paths: PathsObject
|
paths: PathsObject
|
||||||
}>(
|
}>(
|
||||||
!Object.keys(paths).length
|
!Object.keys(paths).length
|
||||||
? basePathUrl(`/api/tag?tagName=${tagSlugName}&area=${area}`)
|
? basePathUrl(`/tag?tagName=${tagSlugName}&area=${area}`)
|
||||||
: null,
|
: null,
|
||||||
swrFetcher,
|
swrFetcher,
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ const TagSection = ({ tag }: TagSectionProps) => {
|
|||||||
}>(
|
}>(
|
||||||
tag["x-associatedSchema"]
|
tag["x-associatedSchema"]
|
||||||
? basePathUrl(
|
? basePathUrl(
|
||||||
`/api/schema?name=${tag["x-associatedSchema"].$ref}&area=${area}`
|
`/schema?name=${tag["x-associatedSchema"].$ref}&area=${area}`
|
||||||
)
|
)
|
||||||
: null,
|
: null,
|
||||||
swrFetcher,
|
swrFetcher,
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ const Tags = () => {
|
|||||||
|
|
||||||
const { data } = useSWR<ExpandedDocument>(
|
const { data } = useSWR<ExpandedDocument>(
|
||||||
loadData && !baseSpecs
|
loadData && !baseSpecs
|
||||||
? basePathUrl(`/api/base-specs?area=${area}&expand=${expand}`)
|
? basePathUrl(`/base-specs?area=${area}&expand=${expand}`)
|
||||||
: null,
|
: null,
|
||||||
swrFetcher,
|
swrFetcher,
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import bundleAnalyzer from "@next/bundle-analyzer"
|
|||||||
|
|
||||||
/** @type {import('next').NextConfig} */
|
/** @type {import('next').NextConfig} */
|
||||||
const nextConfig = {
|
const nextConfig = {
|
||||||
basePath: process.env.NEXT_PUBLIC_BASE_PATH || "/v2",
|
// basePath: process.env.NEXT_PUBLIC_BASE_PATH || "/v2",
|
||||||
async rewrites() {
|
async rewrites() {
|
||||||
return {
|
return {
|
||||||
fallback: [
|
fallback: [
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ const SearchProvider = ({ children }: SearchProviderProps) => {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
checkInternalPattern: new RegExp(
|
checkInternalPattern: new RegExp(
|
||||||
`^${config.baseUrl}${basePathUrl("/api/(admin|store)")}`
|
`^${config.baseUrl}${basePathUrl(`/(admin|store)`)}`
|
||||||
),
|
),
|
||||||
filterOptions: searchFiltersV2,
|
filterOptions: searchFiltersV2,
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -2,5 +2,5 @@ import { config } from "../config"
|
|||||||
import basePathUrl from "./base-path-url"
|
import basePathUrl from "./base-path-url"
|
||||||
|
|
||||||
export default function getUrl(area: string, tagName?: string): string {
|
export default function getUrl(area: string, tagName?: string): string {
|
||||||
return `${config.baseUrl}${basePathUrl(`/api/${area}#${tagName}`)}`
|
return `${config.baseUrl}${basePathUrl(`/${area}#${tagName}`)}`
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user