Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Revert "set security requirement to optional for all paths"

Steven Teycfc40835cfd9
diff --git a/apps/web/app/api/route.ts b/apps/web/app/api/route.ts
index d0b9285181..168f2b8a00 100644
--- a/apps/web/app/api/route.ts
+++ b/apps/web/app/api/route.ts
@@ -5,39 +5,5 @@ import { createDocument } from "zod-openapi";
export const runtime = "edge";
export function GET() {
- const document = createDocument(openApiObject);
-
- if (!document || !document.paths) {
- throw new Error("Failed to create OpenAPI spec.");
- }
-
- // Set security requirement to optional for all paths
- // This is for Speakeasy auth hook to work
- const paths = Object.keys(document.paths);
-
- for (const path of paths) {
- const pathItem = document.paths[path];
-
- if (pathItem.get) {
- pathItem.get.security = [{ token: [] }, {}];
- }
-
- if (pathItem.post) {
- pathItem.post.security = [{ token: [] }, {}];
- }
-
- if (pathItem.put) {
- pathItem.put.security = [{ token: [] }, {}];
- }
-
- if (pathItem.delete) {
- pathItem.delete.security = [{ token: [] }, {}];
- }
-
- if (pathItem.patch) {
- pathItem.patch.security = [{ token: [] }, {}];
- }
- }
-
- return NextResponse.json(document);
+ return NextResponse.json(createDocument(openApiObject));
}