Skip to content

Is there a way to get rid of additional properties without throwing? #588

Answered by sinclairzx81
errmayank asked this question in Q&A
Discussion options

You must be logged in to vote

@errmayank Hi,

TypeBox requires that the data being decoded (or validated) be correct and it does not automatically remove additional properties during validation or decode phases. This is largely by design as the need to remove additional properties is usually the result of a sender sending invalid data (and should usually be fixed at the sender, not the receiver).

It is possible to write logic to remove any additional properties prior to calling decode, but the extra processing of a value would need to be handled in user code (outside of TypeBox)

Hope this helps
S

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@errmayank
Comment options

Answer selected by errmayank
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants