Closed
Description
What is the type of issue?
Documentation is confusing
What is the issue?
On Essential -> Schema -> Global Schema,
Its is mentioned that we can define global schema using:
.schema
followed by a life cycle event in camelCase:
Its not clear.
The provided code
.schema({
query: t.Object({
name: t.String()
})
})
.get('/query', ({ query: { name } }) => name)
the code is incorrect, it throws an error:
This expression is not callable.
(IDE help)TypeError: Object is not a function (near '...}).schema({...')
(Runtime)
Defining a guard on top level does the job of validating the request.
.guard({
query: t.Object({
name: t.String()
}),
})
.get('/query', ({ query: { name } }) => name)
If this is the case, We may need to to rephrase some description and update the example. I can send PR for this
If we can use the .schema
, how can we do that?
Where did you find it?
Essential -> Schema -> Global Schema
Metadata
Metadata
Assignees
Labels
No labels