File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 3
3
validateWithTypeBox ,
4
4
} from '@hello.nrfcloud.com/proto'
5
5
import type { MiddlewareObj } from '@middy/core'
6
- import type { Static , TSchema } from '@sinclair/typebox'
6
+ import type { Static , StaticDecode , TSchema } from '@sinclair/typebox'
7
7
import type { ValueError } from '@sinclair/typebox/compiler'
8
+ import { Value } from '@sinclair/typebox/value'
8
9
import type {
9
10
APIGatewayProxyEventV2 ,
10
11
APIGatewayProxyStructuredResultV2 ,
@@ -64,11 +65,18 @@ export const validateInput = <Schema extends TSchema>(
64
65
}
65
66
console . debug ( `[validateInput]` , `Input is valid` , schema . title )
66
67
req . context . validInput = maybeValidInput . value
68
+ req . context . decodedInput = Value . Decode ( schema , maybeValidInput . value )
67
69
return undefined
68
70
} ,
69
71
}
70
72
}
71
73
72
74
export type ValidInput < Schema extends TSchema > = {
75
+ /**
76
+ * @deprecated Use `decodedInput` instead
77
+ *
78
+ * This will be removed in the next major version.
79
+ */
73
80
validInput : Static < Schema >
81
+ decodedInput : StaticDecode < Schema >
74
82
}
You can’t perform that action at this time.
0 commit comments