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.

fix LinkErrorSchema

Steven Tey53b3fc547f2b
diff --git a/apps/web/lib/openapi/index.ts b/apps/web/lib/openapi/index.ts
index 056a1de364..84eeb6f4e9 100644
--- a/apps/web/lib/openapi/index.ts
+++ b/apps/web/lib/openapi/index.ts
@@ -1,6 +1,6 @@
import { openApiErrorResponses } from "@/lib/openapi/responses";
import { DomainSchema } from "@/lib/zod/schemas/domains";
-import { LinkSchema } from "@/lib/zod/schemas/links";
+import { LinkErrorSchema, LinkSchema } from "@/lib/zod/schemas/links";
import { TagSchema } from "@/lib/zod/schemas/tags";
import { WorkspaceSchema } from "@/lib/zod/schemas/workspaces";
import { createDocument } from "zod-openapi";
@@ -60,6 +60,7 @@ export const document = createDocument({
TagSchema,
DomainSchema,
webhookEventSchema,
+ LinkErrorSchema,
},
securitySchemes: {
token: {
diff --git a/apps/web/lib/zod/schemas/links.ts b/apps/web/lib/zod/schemas/links.ts
index 7f0ba26558..551b3bc918 100644
--- a/apps/web/lib/zod/schemas/links.ts
+++ b/apps/web/lib/zod/schemas/links.ts
@@ -597,6 +597,14 @@ export const LinkSchema = z
})
.openapi({ title: "Link" });
+export const LinkErrorSchema = z
+ .object({
+ link: z.any().describe("The link that caused the error."),
+ error: z.string().describe("The error message."),
+ code: ErrorCode.describe("The error code."),
+ })
+ .openapi({ title: "LinkError" });
+
export const getLinkInfoQuerySchema = domainKeySchema.partial().merge(
z.object({
linkId: z
@@ -611,15 +619,6 @@ export const getLinkInfoQuerySchema = domainKeySchema.partial().merge(
.openapi({ example: "123456" }),
}),
);
-
-export const LinkErrorSchema = z.object({
- link: createLinkBodySchema
- .partial()
- .describe("The link that caused the error."),
- error: z.string().describe("The error message."),
- code: ErrorCode.describe("The error code."),
-});
-
export const getLinksQuerySchemaExtended = getLinksQuerySchemaBase.merge(
z.object({
// Only Dub UI uses the following query parameters