Skip to content

Commit 4ae2b51

Browse files
authored
Merge pull request #87 from devgar/patch-2
Removes unused code and file reference on schema code example
2 parents 2f06d55 + 7858b71 commit 4ae2b51

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

docs/concept/schema.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,8 @@ Sometimes you might find yourself reusing the same type multiple times.
114114

115115
Using [reference models](/patterns/reference-models), you can name your model and use it by referencing the name:
116116
```typescript
117-
// auth.model.ts
118117
import { Elysia } from 'elysia'
119118

120-
// index.ts
121-
import { Elysia } from 'elysia'
122-
import { authModel } from './auth.model.ts'
123-
124119
const app = new Elysia()
125120
.model({
126121
sign: t.Object({

docs/patterns/reference-models.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ With reference models, you can named your model and use it by referencing the na
2121

2222
For example:
2323
```typescript
24-
import { Elysia } from 'elysia'
24+
import { Elysia, t } from 'elysia'
2525

2626
const app = new Elysia()
2727
.post('/sign-in', ({ body }) => body, {
@@ -38,7 +38,7 @@ const app = new Elysia()
3838

3939
We can make it cleaner, by declaring the model as a variable.
4040
```typescript
41-
import { Elysia } from 'elysia'
41+
import { Elysia, t } from 'elysia'
4242

4343
// Maybe in a different file eg. models.ts
4444
const SignDTO = t.Object({
@@ -62,7 +62,7 @@ You can make it a bit cleaner by creating a "reference model".
6262
Registering the models with `setModel` allows you to name a model and reference them directly in `schema` with auto-completion.
6363

6464
```typescript
65-
import { Elysia } from 'elysia'
65+
import { Elysia, t } from 'elysia'
6666

6767
const app = new Elysia()
6868
.model({
@@ -82,7 +82,7 @@ Now when we need to quickly access the model's group, we can separate a `setMode
8282

8383
```typescript
8484
// auth.model.ts
85-
import { Elysia } from 'elysia'
85+
import { Elysia, t } from 'elysia'
8686

8787
export const authModel = new Elysia()
8888
.model({
@@ -110,7 +110,7 @@ const app = new Elysia()
110110

111111
```typescript
112112
// auth.model.ts
113-
import { Elysia } from 'elysia'
113+
import { Elysia, t } from 'elysia'
114114

115115
export const authModel = new Elysia()
116116
.model({

0 commit comments

Comments
 (0)