Skip to content

Commit

Permalink
#1552 fixed unit test failure
Browse files Browse the repository at this point in the history
  • Loading branch information
rriclet authored and To-om committed Nov 6, 2020
1 parent acfb2db commit 4251532
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions dto/src/main/scala/org/thp/thehive/dto/v0/CustomFieldValue.scala
Original file line number Diff line number Diff line change
Expand Up @@ -70,21 +70,20 @@ object InputCustomFieldValue {
case (_, FObject(fields)) =>
fields
.toSeq
.zipWithIndex
.validatedBy {
case ((name, FString(value)), i) => Good(InputCustomFieldValue(name, Some(value), Some(i)))
case ((name, FNumber(value)), i) => Good(InputCustomFieldValue(name, Some(value), Some(i)))
case ((name, FBoolean(value)), i) => Good(InputCustomFieldValue(name, Some(value), Some(i)))
case ((name, FAny(value :: _)), i) => Good(InputCustomFieldValue(name, Some(value), Some(i)))
case ((name, FNull), i) => Good(InputCustomFieldValue(name, None, Some(i)))
case ((name, obj: FObject), i) =>
case (name, FString(value)) => Good(InputCustomFieldValue(name, Some(value), None))
case (name, FNumber(value)) => Good(InputCustomFieldValue(name, Some(value), None))
case (name, FBoolean(value)) => Good(InputCustomFieldValue(name, Some(value), None))
case (name, FAny(value :: _)) => Good(InputCustomFieldValue(name, Some(value), None))
case (name, FNull) => Good(InputCustomFieldValue(name, None, None))
case (name, obj: FObject) =>
getStringCustomField(name, obj) orElse
getIntegerCustomField(name, obj) orElse
getFloatCustomField(name, obj) orElse
getDateCustomField(name, obj) orElse
getBooleanCustomField(name, obj) getOrElse
Good(InputCustomFieldValue(name, None, None))
case ((name, other), i) =>
case (name, other) =>
Bad(
One(
InvalidFormatAttributeError(name, "CustomFieldValue", Set("field: string", "field: number", "field: boolean", "field: date"), other)
Expand Down

0 comments on commit 4251532

Please sign in to comment.