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.

update /tags params

Kiran Kfb2a6f4181e3
diff --git a/apps/web/lib/openapi/tags/create-tag.ts b/apps/web/lib/openapi/tags/create-tag.ts
index 6c7b8d49ad..df095ec647 100644
--- a/apps/web/lib/openapi/tags/create-tag.ts
+++ b/apps/web/lib/openapi/tags/create-tag.ts
@@ -1,7 +1,7 @@
import { ZodOpenApiOperationObject } from "zod-openapi";
import { openApiErrorResponses } from "@/lib/openapi/responses";
-import z from "@/lib/zod";
+import { projectOrWorkspaceSchema } from "@/lib/zod";
import { createTagBodySchema, TagSchema } from "@/lib/zod/schemas/tags";
export const createTag: ZodOpenApiOperationObject = {
@@ -9,13 +9,7 @@ export const createTag: ZodOpenApiOperationObject = {
summary: "Create a new tag",
description: "Create a new tag for the authenticated project.",
requestParams: {
- query: z.object({
- projectSlug: z
- .string()
- .describe(
- "The slug for the project to create tags for. E.g. for `app.dub.co/acme`, the `projectSlug` is `acme`.",
- ),
- }),
+ query: projectOrWorkspaceSchema,
},
requestBody: {
content: {
diff --git a/apps/web/lib/openapi/tags/get-tags.ts b/apps/web/lib/openapi/tags/get-tags.ts
index 62abf797f9..1a06c6aa57 100644
--- a/apps/web/lib/openapi/tags/get-tags.ts
+++ b/apps/web/lib/openapi/tags/get-tags.ts
@@ -1,7 +1,7 @@
import { ZodOpenApiOperationObject } from "zod-openapi";
import { openApiErrorResponses } from "@/lib/openapi/responses";
-import z from "@/lib/zod";
+import z, { projectOrWorkspaceSchema } from "@/lib/zod";
import { TagSchema } from "@/lib/zod/schemas/tags";
export const getTags: ZodOpenApiOperationObject = {
@@ -9,13 +9,7 @@ export const getTags: ZodOpenApiOperationObject = {
summary: "Retrieve a list of tags",
description: "Retrieve a list of tags for the authenticated project.",
requestParams: {
- query: z.object({
- projectSlug: z
- .string()
- .describe(
- "The slug for the project to retrieve tags for. E.g. for `app.dub.co/acme`, the `projectSlug` is `acme`.",
- ),
- }),
+ query: projectOrWorkspaceSchema,
},
responses: {
"200": {
diff --git a/apps/web/lib/zod/index.ts b/apps/web/lib/zod/index.ts
index 32898654ae..a03744d6b2 100644
--- a/apps/web/lib/zod/index.ts
+++ b/apps/web/lib/zod/index.ts
@@ -9,3 +9,19 @@ export const domainKeySchema = z.object({
domain: z.string().min(1),
key: z.string().min(1),
});
+
+// TODO:
+// Update the `workspaceId` description with where to copy the ID from
+
+export const projectOrWorkspaceSchema = z.object({
+ projectSlug: z
+ .string()
+ .describe(
+ "[DEPRECATED (use workspaceId instead)]: The slug for the project to create tags for.",
+ )
+ .optional()
+ .openapi({ deprecated: true }),
+ workspaceId: z
+ .string()
+ .describe("The ID for the workspace to create tags for."),
+});