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:
@@ -1,5 +1,5 @@
|
||||
import type { ExecutableData } from '@/application/collections/';
|
||||
import type { ExecutableValidator, ExecutableValidatorFactory } from '@/application/Parser/Executable/Validation/ExecutableValidator';
|
||||
import type { TypeValidator } from '@/application/Parser/Common/TypeValidator';
|
||||
import { StubWithObservableMethodCalls } from './StubWithObservableMethodCalls';
|
||||
|
||||
export const createExecutableValidatorFactoryStub
|
||||
@@ -23,10 +23,10 @@ export class ExecutableValidatorStub
|
||||
return this;
|
||||
}
|
||||
|
||||
public assertDefined(data: ExecutableData): this {
|
||||
public assertType(assert: (validator: TypeValidator) => void): this {
|
||||
this.registerMethodCall({
|
||||
methodName: 'assertDefined',
|
||||
args: [data],
|
||||
methodName: 'assertType',
|
||||
args: [assert],
|
||||
});
|
||||
return this;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user