-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Undocumented type "*" should be avoided
Backgrounds
- "*" type copies the reference to the value without validation
- Even a function can be assigned
Workarounds
- Use combination of other types such as
"null|boolean|number|string"instead "object"type just copies the reference to the original object without validation
Notes
- If
initPropertiesis created viaJSON.parse(), the risk of using the "*" type is largely mitigated.
Other Mitigation Candidates
- Defining specific types is the best practice, considering the objective of schema definitions.
- Introducing a new type or an option to clone untyped objects via
JSON.parse(JSON.stringify(value))might be effective to mitigate unexpected corruption of the object in validation.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels