Skip to content

Commit 4114d16

Browse files
committed
Make table in doc readable on smaller screens
1 parent 302f835 commit 4114d16

File tree

1 file changed

+44
-16
lines changed
  • packages/convex-helpers/server

1 file changed

+44
-16
lines changed

packages/convex-helpers/server/zod.ts

Lines changed: 44 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -847,14 +847,28 @@ type ConvexValidatorFromZod<Z extends z.ZodTypeAny> =
847847
* Convex values for the corresponding Convex type.
848848
* (see the limits of Convex data types on https://docs.convex.dev/database/types).
849849
*
850-
* #### Comparison with `zodOutputToConvex`
851-
* | **zodToConvex** | {@link zodOutputToConvex} |
852-
* | ------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------- |
853-
* | For when the Zod validator runs _after_ the Convex validator | For when the Zod validator runs _before_ the Convex validator |
854-
* | Convex types use the input types of Zod transformations | Convex types use the return types of Zod transformations |
855-
* | The Convex validator can be less strict (some inputs might be accepted by Convex then rejected by Zod) | The Convex validator can be less strict (i.e. the type in Convex can be less precise than the type in the Zod output) |
856-
* | When using Zod schemas for function definitions: used for _arguments_ | When using Zod schemas for function definitions: used for _return values_ |
857-
* | When validating contents of the database with a Zod schema: used to validate data _after reading_ | When validating contents of the database with a Zod schema: used to validate data _before writing_ |
850+
* ```
851+
* ┌───────────────────────────────────────────────┬───────────────────────────────────────────────┐
852+
* │ **zodToConvex** │ zodOutputToConvex │
853+
* ├───────────────────────────────────────────────┼───────────────────────────────────────────────┤
854+
* │ For when the Zod validator runs _after_ │ For when the Zod validator runs _before_ │
855+
* │ the Convex validator │ the Convex validator │
856+
* ├───────────────────────────────────────────────┼───────────────────────────────────────────────┤
857+
* │ Convex types use the _input types_ │ Convex types use the _return types_ │
858+
* │ of Zod transformations │ of Zod transformations │
859+
* ├───────────────────────────────────────────────┼───────────────────────────────────────────────┤
860+
* │ The Convex validator can be less strict │ The Convex validator can be less strict │
861+
* │ (some inputs might be accepted by Convex │ (i.e. the type in Convex can be less precise │
862+
* │ then rejected by Zod) │ than the type in the Zod output) │
863+
* ├───────────────────────────────────────────────┼───────────────────────────────────────────────┤
864+
* │ When using Zod schemas for function │ When using Zod schemas for function │
865+
* │ definitions: used for _arguments_ │ definitions: used for _return values_ │
866+
* ├───────────────────────────────────────────────┼───────────────────────────────────────────────┤
867+
* │ When validating contents of the database │ When validating contents of the database │
868+
* │ with a Zod schema: used to validate data │ with a Zod schema: used to validate data │
869+
* │ _after reading_ │ _before writing_ │
870+
* └───────────────────────────────────────────────┴───────────────────────────────────────────────┘
871+
* ```
858872
*
859873
* @param zod Zod validator can be a Zod object, or a Zod type like `z.string()`
860874
* @returns Convex Validator (e.g. `v.string()` from "convex/values")
@@ -1199,14 +1213,28 @@ export type ConvexValidatorFromZodOutput<Z extends z.ZodTypeAny> =
11991213
* https://stack.convex.dev/typescript-zod-function-validation#can-i-use-zod-to-define-my-database-types-too
12001214
* for more details.
12011215
*
1202-
* #### Comparison with `zodOutputToConvex`
1203-
* | {@link zodToConvex} | **zodOutputToConvex** |
1204-
* | ------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------- |
1205-
* | For when the Zod validator runs _after_ the Convex validator | For when the Zod validator runs _before_ the Convex validator |
1206-
* | Convex types use the input types of Zod transformations | Convex types use the return types of Zod transformations |
1207-
* | The Convex validator can be less strict (some inputs might be accepted by Convex then rejected by Zod) | The Convex validator can be less strict (i.e. the type in Convex can be less precise than the type in the Zod output) |
1208-
* | When using Zod schemas for function definitions: used for _arguments_ | When using Zod schemas for function definitions: used for _return values_ |
1209-
* | When validating contents of the database with a Zod schema: used to validate data _after reading_ | When validating contents of the database with a Zod schema: used to validate data _before writing_ |
1216+
* ```
1217+
* ┌───────────────────────────────────────────────┬───────────────────────────────────────────────┐
1218+
* │ zodToConvex │ **zodOutputToConvex** │
1219+
* ├───────────────────────────────────────────────┼───────────────────────────────────────────────┤
1220+
* │ For when the Zod validator runs _after_ │ For when the Zod validator runs _before_ │
1221+
* │ the Convex validator │ the Convex validator │
1222+
* ├───────────────────────────────────────────────┼───────────────────────────────────────────────┤
1223+
* │ Convex types use the _input types_ │ Convex types use the _return types_ │
1224+
* │ of Zod transformations │ of Zod transformations │
1225+
* ├───────────────────────────────────────────────┼───────────────────────────────────────────────┤
1226+
* │ The Convex validator can be less strict │ The Convex validator can be less strict │
1227+
* │ (some inputs might be accepted by Convex │ (i.e. the type in Convex can be less precise │
1228+
* │ then rejected by Zod) │ than the type in the Zod output) │
1229+
* ├───────────────────────────────────────────────┼───────────────────────────────────────────────┤
1230+
* │ When using Zod schemas for function │ When using Zod schemas for function │
1231+
* │ definitions: used for _arguments_ │ definitions: used for _return values_ │
1232+
* ├───────────────────────────────────────────────┼───────────────────────────────────────────────┤
1233+
* │ When validating contents of the database │ When validating contents of the database │
1234+
* │ with a Zod schema: used to validate data │ with a Zod schema: used to validate data │
1235+
* │ _after reading_ │ _before writing_ │
1236+
* └───────────────────────────────────────────────┴───────────────────────────────────────────────┘
1237+
* ```
12101238
*
12111239
* @param z The zod validaotr
12121240
* @returns Convex Validator (e.g. `v.string()` from "convex/values")

0 commit comments

Comments
 (0)