lukeed / lukeed/tschema

Recursive types

Open
#9 3 comments 0 reactions 0 assignees View on GitHub
future
Dominant language
TypeScript
Stars
728
Forks
3
PR merge metrics
No merged PRs in 30d

Description

Rerucsive types are useful and also supported by JSON schema https://json-schema.org/understanding-json-schema/structuring#recursion.

In other parser library APIs, this feature is often called "lazy".

Typebox calls it `.Recursive`.

an example of a recursive structure:

```ts
// Typebox:
const FileSystem = Type.Recursive((Self) =>
Type.Intersect([
Type.Object({
name: Type.String({
minLength: 1,
}),
}),
Type.Union([
Type.Object({
type: Type.Literal('file'),
}),
Type.Object({
type: Type.Literal('directory'),
children: Type.Array(Self),
}),
]),
])
);
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the JSON Schema recursion reference linked in the issue and compare it with the Typebox `.Recursive` example. Determine how recursive or lazy types should fit the existing tschema API; done means the requested recursive structure can be represented and validated consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.