Revision 0.8.0

This commit is contained in:
sinclair
2024-12-24 23:36:40 +09:00
parent c2dea48cbe
commit 6d32479372
22 changed files with 38 additions and 36 deletions

View File

@@ -1,17 +1,17 @@
<div align='center'>
<h1>TypeBox Remix</h1>
<h1>TypeBox Adapter</h1>
<p>Integrate Valibot and Zod with TypeBox</p>
<img src="typebox-remix.png" />
<img src="https://raw.githubusercontent.com/sinclairzx81/typebox-adapter/refs/heads/main/typebox-adapter.png" />
<br />
<br />
[![npm version](https://badge.fury.io/js/%40sinclair%2Ftypebox-remix.svg)](https://badge.fury.io/js/%40sinclair%2Ftypebox-remix)
[![Downloads](https://img.shields.io/npm/dm/%40sinclair%2Ftypebox-remix.svg)](https://www.npmjs.com/package/%40sinclair%2Ftypebox-remix)
[![Build](https://github.com/sinclairzx81/typebox-remix/actions/workflows/build.yml/badge.svg)](https://github.com/sinclairzx81/typebox-remix/actions/workflows/build.yml)
[![npm version](https://badge.fury.io/js/%40sinclair%2Ftypebox-adapter.svg)](https://badge.fury.io/js/%40sinclair%2Ftypebox-adapter)
[![Downloads](https://img.shields.io/npm/dm/%40sinclair%2Ftypebox-adapter.svg)](https://www.npmjs.com/package/%40sinclair%2Ftypebox-adapter)
[![Build](https://github.com/sinclairzx81/typebox-adapter/actions/workflows/build.yml/badge.svg)](https://github.com/sinclairzx81/typebox-adapter/actions/workflows/build.yml)
[![License](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
</div>
@@ -19,15 +19,15 @@
## Install
```bash
$ npm install @sinclair/typebox-remix --save
$ npm install @sinclair/typebox-adapter --save
```
## Example
TypeBox Remix converts Valibot and Zod Types into TypeBox compatible schematics
TypeBox Adapter converts Valibot and Zod Types into TypeBox compatible schematics
```typescript
import { Box } from '@sinclair/typebox-remix'
import { Box } from '@sinclair/typebox-adapter'
import * as v from 'valibot'
import * as z from 'zod'
@@ -55,9 +55,7 @@ const Z = Box(z.object({ // const Z: TObject<{
## Overview
TypeBox Remix is a library that makes Zod and Valibot compatible with TypeBox. It works by structurally remapping the types provided by these libraries into Json Schema schematics, enabling them to integrate with the TypeBox infrastructure and making them compatible with Ajv.
This library can be used to integrate Valibot and Zod into server infrastructures that standardize on the Json Schema specification. By transforming these libraries to Json Schema, they can benefit from accelerated type checking and achieve better interoperability with non-JavaScript based systems.
TypeBox Adapter is a library that transforms Zod and Valibot types into TypeBox compatiable schematics. It works by structurally remapping the types provided by these libraries both statically and at runtime, enabling them to integrate with TypeBox infrastructure as well as making them compatible with industry standard Json Schema validators like Ajv.
License MIT
@@ -73,14 +71,14 @@ License MIT
## Usage
TypeBox Remix provides a singular Box function to transform Valibot and Zod types into TypeBox schematics. The top-level export is capable of transforming both Valibot and Zod, but you should use the appropriate submodule depending on which library you are using.
TypeBox Adapter provides a singular Box function to transform Valibot and Zod types into TypeBox schematics. The top-level export is capable of transforming both Valibot and Zod, but you should use the appropriate submodule depending on which library you are using.
### Valibot
Use the `/valibot` submodule if you only have Valibot installed.
```typescript
import { Box } from '@sinclair/typebox-remix/valibot' // Transform Valibot Only
import { Box } from '@sinclair/typebox-adapter/valibot' // Transform Valibot Only
import * as v from 'valibot'
@@ -94,7 +92,7 @@ Refer to the Valibot [documentation](https://valibot.dev/) for more information
Use the `/zod` submodule if you only have Zod installed.
```typescript
import { Box } from '@sinclair/typebox-remix/zod' // Transform Zod Only
import { Box } from '@sinclair/typebox-adapter/zod' // Transform Zod Only
import * as z from 'zod'