Skip to content
Open
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
17 changes: 17 additions & 0 deletions docs/patterns/openapi.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,23 @@ openapi({
zod: z.toJSONSchema
}
})

// Zod Mapping Invalid types, dates & more
openapi({
mapJsonSchema: {
zod: (schema: z.ZodType) => z.toJSONSchema(schema, {
io: 'output',
unrepresentable: 'any',
override: (ctx) => {
const def = ctx.zodSchema._zod.def
if (def.type === 'date') {
ctx.jsonSchema.type = 'string'
ctx.jsonSchema.format = 'date-time'
}
},
})
},
Comment on lines +188 to +200
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Fix indentation to use spaces instead of hard tabs.

The code block contains hard tabs which are flagged by markdownlint. For consistency with the rest of the documentation, use spaces for indentation.

Based on static analysis hints.

Apply consistent spacing throughout the code block (the exact diff would depend on viewing the raw file, but ensure all lines use spaces, not tabs).

🧰 Tools
🪛 markdownlint-cli2 (0.18.1)

188-188: Hard tabs
Column: 1

(MD010, no-hard-tabs)

🤖 Prompt for AI Agents
In docs/patterns/openapi.md around lines 188 to 200, the code block uses hard
tab characters for indentation which violates markdownlint and repository style;
replace all hard tabs with spaces to match the project's indentation convention
(use the same number of spaces per indent level used elsewhere in the file,
e.g., 2 or 4 spaces), ensuring every line in the shown block and any nested
lines use spaces only and no \t characters.

})
```

```typescript [Zod 3]
Expand Down