docs: update api-reference project for v2 (#7307)

* remove everything v1 and make v2 default

* move main v2 rewrites to book

* move rewrites to book + other fixes
This commit is contained in:
Shahed Nasser
2024-05-16 10:02:35 +03:00
committed by GitHub
parent 9b1998b9b2
commit 22f30f54fd
2148 changed files with 8965 additions and 140283 deletions

View File

@@ -2,12 +2,11 @@ import { NextResponse } from "next/server"
import path from "path"
import OpenAPIParser from "@readme/openapi-parser"
import getPathsOfTag from "@/utils/get-paths-of-tag"
import type { ExpandedDocument, Version } from "@/types/openapi"
import type { ExpandedDocument } from "@/types/openapi"
export async function GET(request: Request) {
const { searchParams } = new URL(request.url)
const area = searchParams.get("area")
const version = (searchParams.get("version") as Version) || "1"
const expand = searchParams.get("expand")
if (area !== "admin" && area !== "store") {
return NextResponse.json(
@@ -21,11 +20,7 @@ export async function GET(request: Request) {
)
}
const baseSpecs = (await OpenAPIParser.parse(
path.join(
process.cwd(),
version === "1" ? "specs" : "specs-v2",
`${area}/openapi.yaml`
)
path.join(process.cwd(), "specs", area, "openapi.yaml")
)) as ExpandedDocument
if (expand) {