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.

rename schemas

Steven Tey3fc5c0fcad2b
diff --git a/apps/web/lib/openapi/index.ts b/apps/web/lib/openapi/index.ts
index 23506ae40d..7b9d0c1cec 100644
--- a/apps/web/lib/openapi/index.ts
+++ b/apps/web/lib/openapi/index.ts
@@ -1,8 +1,8 @@
import { ZodOpenApiObject } from "zod-openapi";
import { LinkSchema } from "@/lib/zod/schemas/links";
-import { projectSchema } from "@/lib/zod/schemas/projects";
-import { tagSchema } from "@/lib/zod/schemas/tags";
+import { ProjectSchema } from "@/lib/zod/schemas/projects";
+import { TagSchema } from "@/lib/zod/schemas/tags";
import { API_DOMAIN } from "@dub/utils";
import { analyticsPaths } from "./analytics";
import { linksPaths } from "./links";
@@ -43,8 +43,8 @@ export const openApiObject: ZodOpenApiObject = {
components: {
schemas: {
LinkSchema,
- projectSchema,
- tagSchema,
+ ProjectSchema,
+ TagSchema,
},
securitySchemes: {
bearerToken: {
diff --git a/apps/web/lib/openapi/projects/get-project-info.ts b/apps/web/lib/openapi/projects/get-project-info.ts
index 6c75fd2ad0..4b3b3cfb17 100644
--- a/apps/web/lib/openapi/projects/get-project-info.ts
+++ b/apps/web/lib/openapi/projects/get-project-info.ts
@@ -2,7 +2,7 @@ import { ZodOpenApiOperationObject } from "zod-openapi";
import { openApiErrorResponses } from "@/lib/openapi/responses";
import z from "@/lib/zod";
-import { projectSchema } from "@/lib/zod/schemas/projects";
+import { ProjectSchema } from "@/lib/zod/schemas/projects";
export const getProjectInfo: ZodOpenApiOperationObject = {
operationId: "getProject",
@@ -22,7 +22,7 @@ export const getProjectInfo: ZodOpenApiOperationObject = {
description: "The retrieved project",
content: {
"application/json": {
- schema: projectSchema,
+ schema: ProjectSchema,
},
},
},
diff --git a/apps/web/lib/openapi/projects/get-projects.ts b/apps/web/lib/openapi/projects/get-projects.ts
index 2e3e51c02c..9eeeaa7ccc 100644
--- a/apps/web/lib/openapi/projects/get-projects.ts
+++ b/apps/web/lib/openapi/projects/get-projects.ts
@@ -2,7 +2,7 @@ import { ZodOpenApiOperationObject } from "zod-openapi";
import { openApiErrorResponses } from "@/lib/openapi/responses";
import z from "@/lib/zod";
-import { projectSchema } from "@/lib/zod/schemas/projects";
+import { ProjectSchema } from "@/lib/zod/schemas/projects";
export const getProjects: ZodOpenApiOperationObject = {
operationId: "getProjects",
@@ -13,7 +13,7 @@ export const getProjects: ZodOpenApiOperationObject = {
description: "A list of projects",
content: {
"application/json": {
- schema: z.array(projectSchema),
+ schema: z.array(ProjectSchema),
},
},
},
diff --git a/apps/web/lib/openapi/tags/create-tag.ts b/apps/web/lib/openapi/tags/create-tag.ts
index ea2454735e..6c7b8d49ad 100644
--- a/apps/web/lib/openapi/tags/create-tag.ts
+++ b/apps/web/lib/openapi/tags/create-tag.ts
@@ -2,7 +2,7 @@ import { ZodOpenApiOperationObject } from "zod-openapi";
import { openApiErrorResponses } from "@/lib/openapi/responses";
import z from "@/lib/zod";
-import { createTagBodySchema, tagSchema } from "@/lib/zod/schemas/tags";
+import { createTagBodySchema, TagSchema } from "@/lib/zod/schemas/tags";
export const createTag: ZodOpenApiOperationObject = {
operationId: "createTag",
@@ -29,7 +29,7 @@ export const createTag: ZodOpenApiOperationObject = {
description: "The created tag",
content: {
"application/json": {
- schema: tagSchema,
+ schema: TagSchema,
},
},
},
diff --git a/apps/web/lib/openapi/tags/get-tags.ts b/apps/web/lib/openapi/tags/get-tags.ts
index 6d66f153f7..62abf797f9 100644
--- a/apps/web/lib/openapi/tags/get-tags.ts
+++ b/apps/web/lib/openapi/tags/get-tags.ts
@@ -2,7 +2,7 @@ import { ZodOpenApiOperationObject } from "zod-openapi";
import { openApiErrorResponses } from "@/lib/openapi/responses";
import z from "@/lib/zod";
-import { tagSchema } from "@/lib/zod/schemas/tags";
+import { TagSchema } from "@/lib/zod/schemas/tags";
export const getTags: ZodOpenApiOperationObject = {
operationId: "getTags",
@@ -22,7 +22,7 @@ export const getTags: ZodOpenApiOperationObject = {
description: "A list of tags",
content: {
"application/json": {
- schema: z.array(tagSchema),
+ schema: z.array(TagSchema),
},
},
},
diff --git a/apps/web/lib/zod/schemas/links.ts b/apps/web/lib/zod/schemas/links.ts
index 306ef2f700..8726758a7f 100644
--- a/apps/web/lib/zod/schemas/links.ts
+++ b/apps/web/lib/zod/schemas/links.ts
@@ -1,6 +1,6 @@
import z from "@/lib/zod";
import { booleanQuerySchema } from ".";
-import { tagSchema } from "./tags";
+import { TagSchema } from "./tags";
const LinksQuerySchema = {
projectSlug: z
@@ -286,8 +286,7 @@ export const LinkSchema = z
.boolean()
.default(false)
.describe("Whether the short link's stats are publicly accessible."),
- tags: tagSchema
- .array()
+ tags: TagSchema.array()
.nullable()
.describe("The tags assigned to the short link."),
comments: z
diff --git a/apps/web/lib/zod/schemas/projects.ts b/apps/web/lib/zod/schemas/projects.ts
index 49a76f69ba..c972090602 100644
--- a/apps/web/lib/zod/schemas/projects.ts
+++ b/apps/web/lib/zod/schemas/projects.ts
@@ -1,7 +1,7 @@
import z from "@/lib/zod";
import { planSchema, roleSchema } from ".";
-export const projectSchema = z
+export const ProjectSchema = z
.object({
id: z.string().describe("The unique ID of the project."),
name: z.string().describe("The name of the project."),
diff --git a/apps/web/lib/zod/schemas/tags.ts b/apps/web/lib/zod/schemas/tags.ts
index f9d7cd3623..edaa067484 100644
--- a/apps/web/lib/zod/schemas/tags.ts
+++ b/apps/web/lib/zod/schemas/tags.ts
@@ -25,7 +25,7 @@ export const updateTagBodySchema = z.object({
color: tagColorSchema.optional(),
});
-export const tagSchema = z
+export const TagSchema = z
.object({
id: z.string().describe("The unique ID of the tag."),
name: z.string().describe("The name of the tag."),