Skip to content

Commit 6dbbee5

Browse files
committed
apply coderabbit suggestions
1 parent 1ad3b25 commit 6dbbee5

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

docs/blog/elysia-14.md

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ head:
1010

1111
- - meta
1212
- name: 'description'
13-
content: Support for Standard Validator. Macro with schema, extension, and OpenAPI detail. Lifecycle type soundness. Improve type inference performance by 10%.
13+
content: Support for Standard Schema. Macro with schema, extension, and OpenAPI detail. Lifecycle type soundness. Improves type inference performance by 10%.
1414

1515
- - meta
1616
- property: 'og:description'
17-
content: Support for Standard Validator. Macro with schema, extension, and OpenAPI detail. Lifecycle type soundness. Improve type inference performance by 10%.
17+
content: Support for Standard Schema. Macro with schema, extension, and OpenAPI detail. Lifecycle type soundness. Improves type inference performance by 10%.
1818

1919
- - meta
2020
- property: 'og:image'
@@ -111,12 +111,12 @@ This allows you to have beautiful OpenAPI documentation with your favorite valid
111111
![Zod with OpenAPI support](/blog/elysia-14/openapi-zod.webp)
112112
> Using Zod native OpenAPI schema support with **describe** to add description to the schema
113113
114-
But if your validator does not support JSON Schema, we provide our unique [OpenAPI type gen](/blog/openapi-type-gen.html) to generate OpenAPI schema directly from TypeScript type from your validator.
114+
But if your validator does not support JSON Schema, we provide [OpenAPI type gen](/blog/openapi-type-gen.html) to generate OpenAPI schema directly from TypeScript type from your validator.
115115

116116
This means that Elysia supports OpenAPI generation for all validators that support Standard Schema, even if they don't directly support JSON Schema.
117117

118118
![Valibot with OpenAPI support](/blog/elysia-14/openapi-valibot.webp)
119-
> Valibot doesn't directly support JSON Schema, but we OpenAPI type gen to handle it
119+
> Valibot doesn't directly support JSON Schema, but we use OpenAPI type gen to handle it
120120
121121
Not only will it generate the correct input type, but OpenAPI type gen will also generate all possible output types, including error responses.
122122

@@ -138,26 +138,27 @@ const app = new Elysia()
138138
id: z.coerce.number()
139139
})
140140
})
141-
.post(
142-
'/user/:id',
143-
({ body }) => body,
141+
.post(
142+
'/user/:id',
143+
({ body }) => body,
144144
// ^?
145145

146146

147147

148148

149-
{
150-
body: v.object({
151-
name: v.literal('lilith')
152-
})
153-
})
149+
{
150+
body: v.object({
151+
name: v.literal('lilith')
152+
})
153+
}
154+
)
154155
```
155156
> This example uses both Zod and Valibot to validate the body, allowing you to use existing schemas in your codebase from different validators together.
156157
157158
This works by using each validator to parse a part of the input, then storing each result as a snapshot that merges together to form a single output, ensuring type integrity.
158159

159160
![Using multiple validators to validate part of a body](/blog/elysia-14/standard-schema.webp)
160-
> Using TypeBox, Zod, Valibot, Joi, Yup, ArkType, Effect Schema, TypeMap, and Rescript Schema to validate different parts of the body
161+
> Using TypeBox, Zod, Valibot, Joi, Yup, ArkType, Effect Schema, TypeMap, and ReScript Schema to validate different parts of the body
161162
162163
We tested 8 validators at the same time, validating each part of the input, and it just works flawlessly.
163164

@@ -229,7 +230,7 @@ Not only does this improve the developer experience, but it also improves the re
229230

230231
> Type Soundness covers all lifecycle events and macros, allowing you to have complete documentation of your API. The only exception is an inline lifecycle event due to slowness.
231232
232-
We also managed to improve type inference performance by a factor of ~9-11% and decrease type instantiation by 11.5%, despite the massive increase in type complexity.
233+
We also managed to improve type inference performance by ~9-11% and decrease type instantiation by 11.5%, despite the massive increase in type complexity.
233234

234235
![Type inference](/blog/elysia-14/type-inference.webp)
235236
> Type instantiation is reduced by 11.57% from our internal benchmark
@@ -249,7 +250,7 @@ This allows you to define a new schema in `group` without having to include the
249250

250251
## Notable changes
251252

252-
We have closed around 300 issues on 1.3.9, so we don't really have many bug fixes to make for 1.4, as we have solved most of the problems we know.
253+
We closed around 300 issues in 1.3.9, so so there aren’t many bug fixes in 1.4—we’ve addressed most known issues.
253254

254255
### Improvements
255256

0 commit comments

Comments
 (0)