Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typecheck fix #193

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions apps/webservice/src/app/api/v1/targets/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export const POST = request()
);

export const openapi: Swagger.SwaggerV3 = {
openapi: "3.0.0",
openapi: "3.1.0",
info: {
title: "Ctrlplane API",
version: "1.0.0",
Expand Down Expand Up @@ -134,11 +134,8 @@ export const openapi: Swagger.SwaggerV3 = {
type: "string",
},
value: {
oneOf: [
{ type: "string" },
{ type: "number" },
{ type: "boolean" },
],
type: "string",
enum: ["string", "number", "boolean"],
Comment on lines +137 to +138
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix schema inconsistency between OpenAPI and Zod validation.

There's a mismatch between the OpenAPI schema and Zod validation:

  1. OpenAPI schema defines value as a string enum with values "string", "number", "boolean"
  2. Zod schema (patchBodySchema) accepts actual types: z.union([z.string(), z.number(), z.boolean(), z.null()])
  3. The OpenAPI schema doesn't include "null" in the enum despite Zod accepting it

Apply this diff to align the schemas:

                              value: {
-                               type: "string",
-                               enum: ["string", "number", "boolean"],
+                               oneOf: [
+                                 { type: "string" },
+                                 { type: "number" },
+                                 { type: "boolean" },
+                                 { type: "null" }
+                               ]
                              },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
type: "string",
enum: ["string", "number", "boolean"],
oneOf: [
{ type: "string" },
{ type: "number" },
{ type: "boolean" },
{ type: "null" }
]

},
sensitive: {
type: "boolean",
Expand Down
Loading
Loading