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 33 validateWithTypeBox ,
44} from '@hello.nrfcloud.com/proto'
55import type { MiddlewareObj } from '@middy/core'
6- import type { Static , TSchema } from '@sinclair/typebox'
6+ import type { Static , StaticDecode , TSchema } from '@sinclair/typebox'
77import type { ValueError } from '@sinclair/typebox/compiler'
8+ import { Value } from '@sinclair/typebox/value'
89import type {
910 APIGatewayProxyEventV2 ,
1011 APIGatewayProxyStructuredResultV2 ,
@@ -64,11 +65,18 @@ export const validateInput = <Schema extends TSchema>(
6465 }
6566 console . debug ( `[validateInput]` , `Input is valid` , schema . title )
6667 req . context . validInput = maybeValidInput . value
68+ req . context . decodedInput = Value . Decode ( schema , maybeValidInput . value )
6769 return undefined
6870 } ,
6971 }
7072}
7173
7274export type ValidInput < Schema extends TSchema > = {
75+ /**
76+ * @deprecated Use `decodedInput` instead
77+ *
78+ * This will be removed in the next major version.
79+ */
7380 validInput : Static < Schema >
81+ decodedInput : StaticDecode < Schema >
7482}
You can’t perform that action at this time.
0 commit comments