All Downloads are FREE. Search and download functionalities are using the official Maven repository.

db.migration.V1_032__StandaloneToRequestResponseDefinition.scala Maven / Gradle / Ivy

There is a newer version: 1.17.0
Show newest version
package db.migration

import io.circe._
import pl.touk.nussknacker.ui.db.migration.ProcessJsonMigration

trait V1_032__StandaloneToRequestResponseDefinition extends ProcessJsonMigration {

  override def updateProcessJson(jsonProcess: Json): Option[Json] =
    V1_032__StandaloneToRequestResponseDefinition.migrateMetadata(jsonProcess)
}

object V1_032__StandaloneToRequestResponseDefinition {

  private[migration] def migrateMetadata(jsonProcess: Json): Option[Json] = {
    jsonProcess.hcursor
      .downField("metaData")
      .downField("typeSpecificData")
      .downField("type")
      .withFocus { typeSpecificDataType =>
        typeSpecificDataType.asString match {
          case Some("StandaloneMetaData") => Json.fromString("RequestResponseMetaData")
          case _                          => typeSpecificDataType
        }
      }
  }.top

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy