updated react-openapi

This commit is contained in:
2026-06-17 21:03:08 +05:30
parent cd89eb4c88
commit 0a668cf98d
64 changed files with 2412 additions and 2921 deletions

View File

@@ -0,0 +1,17 @@
import * as yaml from "js-yaml";
import type { OpenApiSpec } from "./types";
export async function loadSpec(url: string): Promise<OpenApiSpec> {
const response = await fetch(url);
if (!response.ok) {
throw new Error(`Failed to fetch spec: ${response.status} ${response.statusText}`);
}
const text = await response.text();
const parsed = yaml.load(text);
if (!parsed || typeof parsed !== "object") {
throw new Error("Spec is empty or not an object");
}
return parsed as OpenApiSpec;
}