Skip to content

Commit

Permalink
feat: support recursive schemas
Browse files Browse the repository at this point in the history
  • Loading branch information
brettz9 committed Jun 21, 2024
1 parent 4ea19c6 commit 4a4daad
Show file tree
Hide file tree
Showing 7 changed files with 854 additions and 199 deletions.
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,18 @@ Properties:
- `transforms` - Map of name to `.transform()` functions
- `preprocesses` - Map of name to `z.preprocess()` functions

## Use of JSON References

JSON references are used to represent local references. If you wish to use
JSON references for remote references, you may do so, but you will need
to use a library like [`json-refs`](https://github.com/whitlockjc/json-refs)
(with `resolveRefs`) to first resolve such references and then supply the object
to `dezerialize`.

Like JSON Schema, the `$defs` property may be a reasonable top-level property to
have reserved as storage for local, non-cyclic references, but again, you should
use another library to first resolve them.

## Roadmap

- custom error messages are not included
Expand All @@ -100,4 +112,3 @@ Properties:
- pipeline and catch types are unwrapped
- `instanceof`, `implement` (function), `custom`, `catchall` are not supported
- native enums are turned into enums
- recursive schemas not currently supported
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"prepare": "husky install",
"check-style": "prettier --check src",
"lint": "eslint src/**",
"test": "vitest --coverage --silent=false",
"test": "vitest --coverage --silent=false --reporter=basic",
"build": "rm -rf dist && pnpm tsc --module esnext --moduleResolution bundler --outDir dist/esm && pnpm tsc",
"prepublish": "pnpm run build"
},
Expand Down
Loading

0 comments on commit 4a4daad

Please sign in to comment.