Skip to content

Instantly share code, notes, and snippets.

View martindelobel's full-sized avatar

Martin Delobel martindelobel

View GitHub Profile
root
|-- BusinessUnit: array (nullable = true)
| |-- element: struct (containsNull = true)
| | |-- UnitID: struct (nullable = true)
| | | |-- _Name: string (nullable = true)
| | | |-- _TypeCode: string (nullable = true)
| | | |-- _VALUE: string (nullable = true)
|-- Channel: struct (nullable = true)
| |-- ChannelID: struct (nullable = true)
| | |-- _Description: string (nullable = true)
@martindelobel
martindelobel / RetailTransactionValidator.scala
Created June 30, 2023 14:52
Example of ZIO Prelude Validator for a Retail Transaction
object RetailTransactionValidator extends PoslogValidator {
implicit val fieldLog: FieldLog = FieldLog(nameOf(RetailTransaction))
def validate(retailTransaction: Option[UntypedRetailTransaction])(implicit
transactionId: String): Validation[ValidationError, RetailTransaction] =
retailTransaction match {
case None => Validation.fail(EMPTY_FIELD)
case Some(urt) =>
for {