@orpc/valibot 0.0.0 → 0.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -45
- package/package.json +5 -5
package/README.md
CHANGED
@@ -8,8 +8,8 @@
|
|
8
8
|
<a href="https://codecov.io/gh/unnoq/orpc">
|
9
9
|
<img alt="codecov" src="https://codecov.io/gh/unnoq/orpc/branch/main/graph/badge.svg">
|
10
10
|
</a>
|
11
|
-
<a href="https://www.npmjs.com/package/@orpc/
|
12
|
-
<img alt="weekly downloads" src="https://img.shields.io/npm/dw/%40orpc%
|
11
|
+
<a href="https://www.npmjs.com/package/@orpc/valibot">
|
12
|
+
<img alt="weekly downloads" src="https://img.shields.io/npm/dw/%40orpc%2Fvalibot?logo=npm" />
|
13
13
|
</a>
|
14
14
|
<a href="https://github.com/unnoq/orpc/blob/main/LICENSE">
|
15
15
|
<img alt="MIT License" src="https://img.shields.io/github/license/unnoq/orpc?logo=open-source-initiative" />
|
@@ -60,38 +60,23 @@ You can find the full documentation [here](https://orpc.unnoq.com).
|
|
60
60
|
- [@orpc/vue-colada](https://www.npmjs.com/package/@orpc/vue-colada): Integration with [Pinia Colada](https://pinia-colada.esm.dev/).
|
61
61
|
- [@orpc/openapi](https://www.npmjs.com/package/@orpc/openapi): Generate OpenAPI specs and handle OpenAPI requests.
|
62
62
|
- [@orpc/zod](https://www.npmjs.com/package/@orpc/zod): More schemas that [Zod](https://zod.dev/) doesn't support yet.
|
63
|
+
- [@orpc/valibot](https://www.npmjs.com/package/@orpc/valibot): OpenAPI spec generation from [Valibot](https://valibot.dev/).
|
64
|
+
- [@orpc/arktype](https://www.npmjs.com/package/@orpc/arktype): OpenAPI spec generation from [ArkType](https://arktype.io/).
|
63
65
|
|
64
|
-
## `@orpc/
|
66
|
+
## `@orpc/valibot`
|
65
67
|
|
66
|
-
|
67
|
-
|
68
|
-
### More Schemas
|
69
|
-
|
70
|
-
- `oz.url`: Zod schema for [URL](https://developer.mozilla.org/en-US/docs/Web/API/URL) instance.
|
71
|
-
- `oz.blob`: Zod schema for [Blob](https://developer.mozilla.org/en-US/docs/Web/API/Blob) instance.
|
72
|
-
- `oz.file`: Zod schema for [File](https://developer.mozilla.org/en-US/docs/Web/API/File) instance.
|
73
|
-
- `oz.regexp`: Zod schema for [RegExp](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp) instance.
|
74
|
-
|
75
|
-
```ts
|
76
|
-
import { oz } from '@orpc/zod'
|
77
|
-
import { z } from 'zod'
|
78
|
-
|
79
|
-
const Example = z.object({
|
80
|
-
url: oz.url(),
|
81
|
-
blob: oz.blob(),
|
82
|
-
file: oz.file().type('image/png'),
|
83
|
-
regexp: oz.regexp(),
|
84
|
-
})
|
85
|
-
```
|
68
|
+
Provides `ValibotToJsonSchemaConverter` for generating OpenAPI specs from [Valibot](https://valibot.dev/).
|
86
69
|
|
87
70
|
### Generate OpenAPI Spec
|
88
71
|
|
89
72
|
```ts
|
90
73
|
import { OpenAPIGenerator } from '@orpc/openapi'
|
91
|
-
import {
|
74
|
+
import { experimental_ValibotToJsonSchemaConverter as ValibotToJsonSchemaConverter } from '@orpc/valibot'
|
92
75
|
|
93
76
|
const openAPIGenerator = new OpenAPIGenerator({
|
94
|
-
schemaConverters: [
|
77
|
+
schemaConverters: [
|
78
|
+
new ValibotToJsonSchemaConverter()
|
79
|
+
],
|
95
80
|
})
|
96
81
|
|
97
82
|
const specFromContract = await openAPIGenerator.generate(contract, {
|
@@ -109,26 +94,6 @@ const specFromRouter = await openAPIGenerator.generate(router, {
|
|
109
94
|
})
|
110
95
|
```
|
111
96
|
|
112
|
-
### Extending the Specification
|
113
|
-
|
114
|
-
```ts
|
115
|
-
import { oz } from '@orpc/zod'
|
116
|
-
import { z } from 'zod'
|
117
|
-
|
118
|
-
const InputSchema = oz.openapi(
|
119
|
-
z.object({
|
120
|
-
name: z.string(),
|
121
|
-
}),
|
122
|
-
{
|
123
|
-
examples: [
|
124
|
-
{ name: 'Earth' },
|
125
|
-
{ name: 'Mars' },
|
126
|
-
],
|
127
|
-
// additional options...
|
128
|
-
}
|
129
|
-
)
|
130
|
-
```
|
131
|
-
|
132
97
|
## License
|
133
98
|
|
134
99
|
Distributed under the MIT License. See [LICENSE](https://github.com/unnoq/orpc/blob/main/LICENSE) for more information.
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@orpc/valibot",
|
3
3
|
"type": "module",
|
4
|
-
"version": "0.
|
4
|
+
"version": "0.50.0",
|
5
5
|
"license": "MIT",
|
6
6
|
"homepage": "https://orpc.unnoq.com",
|
7
7
|
"repository": {
|
@@ -25,13 +25,13 @@
|
|
25
25
|
],
|
26
26
|
"peerDependencies": {
|
27
27
|
"valibot": "*",
|
28
|
-
"@orpc/contract": "0.
|
29
|
-
"@orpc/server": "0.
|
28
|
+
"@orpc/contract": "0.50.0",
|
29
|
+
"@orpc/server": "0.50.0"
|
30
30
|
},
|
31
31
|
"dependencies": {
|
32
32
|
"@valibot/to-json-schema": "1.0.0-rc.0",
|
33
|
-
"@orpc/openapi": "0.
|
34
|
-
"@orpc/shared": "0.
|
33
|
+
"@orpc/openapi": "0.50.0",
|
34
|
+
"@orpc/shared": "0.50.0"
|
35
35
|
},
|
36
36
|
"scripts": {
|
37
37
|
"build": "unbuild",
|