Skip to content

Commit 6f1bdda

Browse files
committed
#2420 Fix parsing of analyzers without dataType list
1 parent 099bc74 commit 6f1bdda

File tree

1 file changed

+18
-19
lines changed

1 file changed

+18
-19
lines changed

cortex/dto/src/main/scala/org/thp/cortex/dto/v0/Worker.scala

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,24 @@ case class OutputWorker(
1414

1515
object OutputWorker {
1616
implicit val writes: Writes[OutputWorker] = Json.writes[OutputWorker]
17-
implicit val reads: Reads[OutputWorker] = Reads[OutputWorker](
18-
json =>
19-
for {
20-
id <- (json \ "id").validate[String]
21-
name <- (json \ "name").validate[String]
22-
version <- (json \ "version").validate[String]
23-
description <- (json \ "description").validate[String]
24-
dataTypeList <- (json \ "dataTypeList").validate[Seq[String]]
25-
maxTlp = (json \ "maxTlp").asOpt[Long].getOrElse(3L)
26-
maxPap = (json \ "maxPap").asOpt[Long].getOrElse(3L)
27-
} yield OutputWorker(
28-
id,
29-
name,
30-
version,
31-
description,
32-
dataTypeList,
33-
maxTlp,
34-
maxPap
35-
)
17+
implicit val reads: Reads[OutputWorker] = Reads[OutputWorker](json =>
18+
for {
19+
id <- (json \ "id").validate[String]
20+
name <- (json \ "name").validate[String]
21+
version <- (json \ "version").validate[String]
22+
description <- (json \ "description").validate[String]
23+
dataTypeList <- (json \ "dataTypeList").validateOpt[Seq[String]]
24+
maxTlp = (json \ "maxTlp").asOpt[Long].getOrElse(3L)
25+
maxPap = (json \ "maxPap").asOpt[Long].getOrElse(3L)
26+
} yield OutputWorker(
27+
id,
28+
name,
29+
version,
30+
description,
31+
dataTypeList.getOrElse(Nil),
32+
maxTlp,
33+
maxPap
34+
)
3635
)
3736
}
3837

0 commit comments

Comments
 (0)