Merge branch 'bugfix/molecule_replacement_module_id_validation' into 'develop'
Digital PCT265 defect: Missing moecule.id to moduleName validation for the replacement behavior. ### Summary Data validation bug on notification_count_fios module return. Co-authored-by: Hedden, Kyle Matthew <kyle.hedden@verizonwireless.com> See merge request https://gitlab.verizon.com/BPHV_MIPS/mvm_core_ui/-/merge_requests/1178
This commit is contained in:
commit
de30c5d286
@ -49,9 +49,15 @@ public class ReplaceableMoleculeBehavior: PageMoleculeTransformationBehavior, Pa
|
||||
public func onPageNew(rootMolecules: [MoleculeModelProtocol], _ delegateObject: MVMCoreUIDelegateObject?, changes: inout [MoleculeModelProtocol]) -> [MoleculeModelProtocol]? {
|
||||
self.delegateObject = delegateObject
|
||||
|
||||
let moleculeModels = moleculeIds.compactMap { moleculeId in
|
||||
let moleculeModels: [MoleculeModelProtocol] = moleculeIds.compactMap { moleculeId in
|
||||
do {
|
||||
return try delegateObject?.moleculeDelegate?.getModuleWithName(moleculeId)
|
||||
guard let molecule = try delegateObject?.moleculeDelegate?.getModuleWithName(moleculeId) else {
|
||||
return nil // Valid. Module might not be present yet.
|
||||
}
|
||||
guard molecule.id == moleculeId else {
|
||||
throw MolecularError.validationError("The module name \(moleculeId) must match the molecule id \(molecule.id) it encloses!")
|
||||
}
|
||||
return molecule
|
||||
} catch {
|
||||
let coreError = MVMCoreErrorObject.createErrorObject(for: error, location: String(describing: type(of: self)))!
|
||||
if let error = error as? HumanReadableDecodingErrorProtocol {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user