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.

add openapi components

Kiran K217c7b9d819f
diff --git a/apps/web/lib/zod/schemas/analytics.ts b/apps/web/lib/zod/schemas/analytics.ts
index 9bf6312d8b..cba69398f7 100644
--- a/apps/web/lib/zod/schemas/analytics.ts
+++ b/apps/web/lib/zod/schemas/analytics.ts
@@ -73,7 +73,8 @@ export const clickAnalyticsQuerySchema = z.object({
country: z
.enum(COUNTRY_CODES)
.optional()
- .describe("The country to retrieve analytics for."),
+ .describe("The country to retrieve analytics for.")
+ .openapi({ ref: "countryCode" }),
city: z.string().optional().describe("The city to retrieve analytics for."),
device: z
.string()
@@ -143,19 +144,23 @@ export const getClickAnalyticsResponse = {
start: z.string().describe("The starting timestamp of the interval"),
clicks: z.number().describe("The number of clicks in the interval"),
}),
- countries: z.object({
- country: z
- .enum(COUNTRY_CODES)
- .describe("The 2-letter country code: https://d.to/geo"),
- clicks: z.number().describe("The number of clicks from this country"),
- }),
- cities: z.object({
- city: z.string().describe("The name of the city"),
- country: z
- .enum(COUNTRY_CODES)
- .describe("The 2-letter country code of the city: https://d.to/geo"),
- clicks: z.number().describe("The number of clicks from this city"),
- }),
+ countries: z
+ .object({
+ country: z
+ .enum(COUNTRY_CODES)
+ .describe("The 2-letter country code: https://d.to/geo"),
+ clicks: z.number().describe("The number of clicks from this country"),
+ })
+ .openapi({ ref: "clicksByCountry" }),
+ cities: z
+ .object({
+ city: z.string().describe("The name of the city"),
+ country: z
+ .enum(COUNTRY_CODES)
+ .describe("The 2-letter country code of the city: https://d.to/geo"),
+ clicks: z.number().describe("The number of clicks from this city"),
+ })
+ .openapi({ ref: "clicksByCities" }),
devices: z.object({
device: z.string().describe("The name of the device"),
clicks: z.number().describe("The number of clicks from this device"),
diff --git a/apps/web/lib/zod/schemas/links.ts b/apps/web/lib/zod/schemas/links.ts
index 561ba0f3b4..fdfa62149c 100644
--- a/apps/web/lib/zod/schemas/links.ts
+++ b/apps/web/lib/zod/schemas/links.ts
@@ -229,7 +229,8 @@ export const createLinkBodySchema = z.object({
.nullish()
.describe(
"Geo targeting information for the short link in JSON format `{[COUNTRY]: https://example.com }`.",
- ),
+ )
+ .openapi({ ref: "linkGeoTargeting" }),
});
export const updateLinkBodySchema = createLinkBodySchema.partial().optional();