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
initProperties is created via JSON.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.
Undocumented type "*" should be avoided
Backgrounds
Workarounds
"null|boolean|number|string"instead"object"type just copies the reference to the original object without validationNotes
initPropertiesis created viaJSON.parse(), the risk of using the "*" type is largely mitigated.Other Mitigation Candidates
JSON.parse(JSON.stringify(value))might be effective to mitigate unexpected corruption of the object in validation.