Digital PCT265 defect CXTDT-531317 - Throw error during decode when pageType is empty.

This commit is contained in:
Hedden, Kyle Matthew 2024-04-25 15:51:35 -04:00
parent 35088ae446
commit e06788ca66

View File

@ -79,6 +79,9 @@ import Foundation
} else { } else {
pageType = try typeContainer.decode(String.self, forKey: .pageType) pageType = try typeContainer.decode(String.self, forKey: .pageType)
} }
if pageType.isEmpty {
throw ModelRegistry.Error.decoderOther(message: "pageType cannot be an empty string!")
}
screenHeading = try typeContainer.decodeIfPresent(String.self, forKey: .screenHeading) screenHeading = try typeContainer.decodeIfPresent(String.self, forKey: .screenHeading)
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
formRules = try typeContainer.decodeIfPresent([FormGroupRule].self, forKey: .formRules) formRules = try typeContainer.decodeIfPresent([FormGroupRule].self, forKey: .formRules)