File tree 1 file changed +7
-7
lines changed
1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change 2
2
3
3
## How to install?
4
4
5
- ```
5
+ ``` sh
6
6
npm i -D fastify-schema-to-typescript
7
7
```
8
8
@@ -11,7 +11,7 @@ npm i -D fastify-schema-to-typescript
11
11
Running ` npx fastify-schema-to-typescript ` will convert all ` schema.json ` files in ` src ` to ` schema.ts ` .
12
12
You can then import ` schema.ts ` directly
13
13
14
- ```
14
+ ``` ts
15
15
import { Handler , schema } from " ./schema" ;
16
16
17
17
export const options = {
@@ -27,7 +27,7 @@ export const handler: Handler = async (request, reply) => {}
27
27
28
28
More options are available
29
29
30
- ```
30
+ ``` sh
31
31
npx fastify-schema-to-typescript -h
32
32
33
33
Usage: fastify-schema-to-typescript [options]
@@ -62,7 +62,7 @@ Running `npx fastify-schema-to-typescript` will convert `schema.yaml` to `schema
62
62
63
63
app.ts
64
64
65
- ```
65
+ ```ts
66
66
import fastify from 'fastify';
67
67
import { healthcheck } from './api'
68
68
@@ -78,13 +78,13 @@ run();
78
78
79
79
api/index.ts
80
80
81
- ```
81
+ ``` ts
82
82
export * from ' ./healthcheck' ;
83
83
```
84
84
85
85
api/healtheck/schema.yaml
86
86
87
- ```
87
+ ``` yml
88
88
headers :
89
89
type : object
90
90
properties :
@@ -108,7 +108,7 @@ params:
108
108
109
109
api/healtheck/index.ts
110
110
111
- ```
111
+ ` ` ` ts
112
112
import { FastifyPluginAsync } from 'fastify';
113
113
import { RouteGeneric, schema } from './schema';
114
114
You can’t perform that action at this time.
0 commit comments