Add object property validation in parser #369
This commit introduces stricter type validation across the application to reject objects with unexpected properties, enhancing the robustness and predictability of data handling. Changes include: - Implement a common utility to validate object types. - Refactor across various parsers and data handlers to utilize the new validations. - Update error messages for better clarity and troubleshooting.
This commit is contained in:
@@ -18,7 +18,7 @@ describe('DocumentationParser', () => {
|
||||
});
|
||||
describe('throws when type is unexpected', () => {
|
||||
// arrange
|
||||
const expectedTypeError = 'docs field (documentation) must be an array of strings';
|
||||
const expectedTypeError = 'docs field (documentation) must be a single string or an array of strings.';
|
||||
const wrongTypedValue = 22 as never;
|
||||
const testCases: ReadonlyArray<{
|
||||
readonly name: string;
|
||||
|
||||
Reference in New Issue
Block a user