Override FastifyTypeProviderDefault
- Dominant language
- No language data
- Stars
- 68
- Forks
- 8
- Avg merge
- 11h 2m
- Merged PRs (30d)
- 2
Description
I would like to define a single route as a constant variable like this
```
const createTaskRoute: RouteOptions = {
url: '/task',
method: 'POST',
schema: {
body: {
type: 'object',
properties: {
title: {type: 'string'},
},
required: ['title'],
},
} as const,
handler: async (request) => {
// request.body is unknown
},
};
```
and register it somewhere else in a plugin like this:
```
function TaskRouter(app: FastifyInstance) {
app.route(createTaskRoute);
}
```
The issue is that the request body is of type unknown, despite using `@fastify/type-provider-json-schema-to-ts`. Is there any possiblity to have json-schema-to-ts support in the handler, without using the app as a FastifyInstance to override the `FastifyTypeProviderDefault`?
Contributor guide
Assessment
This issue has not been assessed yet.