Skip to content

Commit b1a6e53

Browse files
docs: schema types
Signed-off-by: David Dal Busco <david.dalbusco@outlook.com>
1 parent 4c70243 commit b1a6e53

2 files changed

Lines changed: 44 additions & 0 deletions

File tree

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Schema Types
2+
3+
Juno provides a type system built on top of [Zod](https://zod.dev/), extended with a few additional types you'll need when working with serverless functions.
4+
5+
All types are available through `j`.
6+
7+
```typescript
8+
import { j } from "@junobuild/schema";
9+
```
10+
11+
---
12+
13+
## Juno Types
14+
15+
The following are specific types provided by Juno:
16+
17+
### j.principal()
18+
19+
Validates and represents an Internet Computer Principal.
20+
21+
```typescript
22+
j.principal();
23+
```
24+
25+
### j.uint8array()
26+
27+
Validates and represents a `Uint8Array`.
28+
29+
```typescript
30+
j.uint8array();
31+
```
32+
33+
---
34+
35+
## Zod Types
36+
37+
All Zod types are available through `j`. Refer to the [Zod documentation](https://zod.dev/) for the full API reference.
38+
39+
:::note
40+
41+
`union` is not supported. Use `discriminatedUnion` instead.
42+
43+
:::

sidebars.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,7 @@ const sidebars: SidebarsConfig = {
407407
"API reference for writing serverless functions with TypeScript."
408408
},
409409
items: [
410+
"reference/functions/typescript/schema",
410411
"reference/functions/typescript/sdk",
411412
"reference/functions/typescript/utils",
412413
"reference/functions/typescript/ic-cdk",

0 commit comments

Comments
 (0)