Skip to content

Commit

Permalink
Remove comment
Browse files Browse the repository at this point in the history
  • Loading branch information
andrii-balitskyi committed Jul 17, 2024
1 parent a1c41ef commit 9c72b3e
Showing 1 changed file with 0 additions and 50 deletions.
50 changes: 0 additions & 50 deletions packages/nextlove/src/generators/lib/zod-openapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -629,56 +629,6 @@ const workerMap = {
}
type WorkerKeys = keyof typeof workerMap

/**
* Parsing a nested `.describe(...)` doesn't work correctly.
* Example of such zod schema:
*
* arrayDesciption: z
.array(
z.object({}).describe(`
---
title: Nested Object Description
---
This is an object.
`)
)
.optional().describe(`
---
title: Array Description
---
This is an array of strings.
`),
* Such schema will be parsed as:
"arrayDesciption": {
"type": "array",
"items": {
"type": "object",
"properties": {},
"description": "\n ---\n title: Nested Object Description\n ---\n This is an object.\n "
},
"description": "This is an array of strings.",
"x-title": "Array Description"
}.
We can see that description body and front matter doesn't get parsed in nested `z.object().describe(...)` inside `z.array()`.
Instead such nested description should look like this:
"arrayDesciption": {
"type": "array",
"items": {
"type": "object",
"properties": {},
"description": "This is an object."
"x-title": "Nested Object Description"
},
"description": "This is an array of strings.",
"x-title": "Array Description"
}.
*/

export function generateSchema(
zodRef: OpenApiZodAny,
useOutput?: boolean
Expand Down

0 comments on commit 9c72b3e

Please sign in to comment.