Missing parameter type for expanded function

This is my method I’m using, when running it see that there is a missing param giving this error:

error: missing parameter type for expanded function

The argument types of an anonymous function must be fully known. (SLS 8.5)

Expected type was: Boolean

I have searched and read multiple articles and tried multiple solutions but none of them worked. Not sure what else could be done here.

Note that I can’t use the play.api.libs.json library in this project.

import org.json4s.{DefaultFormats, _}
import org.json4s._

implicit val formats: Formats = DefaultFormats
  def parseData(eventName: String, extSchema: Map[String, Map[String, String]], eventData: Seq[Row], eventKey: String): Boolean = {
    case "MyPageName" =>
      eventKey match {
        case "My_key_name" =>
          var res = false
          eventData.foreach{ kv: Row => {
            val jsonString = kv.getString(0)
            val json: JValue = parse(jsonString)

            val checkStatus = (json \ "bonusPoints" \ "nested_1" \ "nested_2").extractOpt[Boolean].getOrElse(false)

            if (checkStatus) {
              res = true
            }
          }}
          res && extSchema.get("page").exists(pageMap =>
            pageMap.get("contentType").exists(_ == "apiResult")
          )

The body of parseData starts with a case "MyPageName" => this is creating a function, but parseData should return a Boolean.
Maybe you wanted to match something? Like the eventName?

3 Likes

Thanks. This was actually the case.
This what happens when you keep working for along time and loose your focus

2 Likes