<commit_before>package io.vamp.model.serialization

import io.vamp.common.Lookup
import io.vamp.model.artifact._
import org.json4s.JsonAST.JString
import org.json4s._

import scala.collection.mutable.ArrayBuffer
import scala.language.postfixOps

object GatewaySerializationFormat extends io.vamp.common.json.SerializationFormat {

  override def customSerializers = super.customSerializers :+
    new GatewaySerializer() :+
    new GatewayStickySerializer() :+
    new RouteSerializer() :+
    new ExternalRouteTargetSerializer() :+
    new ConditionSerializer() :+
    new RewriteSerializer()

  override def fieldSerializers = super.fieldSerializers :+
    new RouteTargetFieldSerializer()
}

class GatewaySerializer extends ArtifactSerializer[Gateway] with GatewayDecomposer {
  override def serialize(implicit format: Formats): PartialFunction[Any, JValue] = serializeGateway
}

trait GatewayDecomposer extends ReferenceSerialization with RouteDecomposer {

  def serializeGateway(implicit format: Formats): PartialFunction[Any, JValue] = serialize(full = true, port = true)

  def serializeAnonymousGateway(port: Boolean)(implicit format: Formats): PartialFunction[Any, JValue] = serialize(full = true, port)

  private def serialize(full: Boolean, port: Boolean)(implicit format: Formats): PartialFunction[Any, JValue] = {
    case gateway: Gateway ⇒
      val list = new ArrayBuffer[JField]<commit_msg>Revert back full anonymous gateway serialization due to ui errors<commit_after>package io.vamp.model.serialization

import io.vamp.common.Lookup
import io.vamp.model.artifact._
import org.json4s.JsonAST.JString
import org.json4s._

import scala.collection.mutable.ArrayBuffer
import scala.language.postfixOps

object GatewaySerializationFormat extends io.vamp.common.json.SerializationFormat {

  override def customSerializers = super.customSerializers :+
    new GatewaySerializer() :+
    new GatewayStickySerializer() :+
    new RouteSerializer() :+
    new ExternalRouteTargetSerializer() :+
    new ConditionSerializer() :+
    new RewriteSerializer()

  override def fieldSerializers = super.fieldSerializers :+
    new RouteTargetFieldSerializer()
}

class GatewaySerializer extends ArtifactSerializer[Gateway] with GatewayDecomposer {
  override def serialize(implicit format: Formats): PartialFunction[Any, JValue] = serializeGateway
}

trait GatewayDecomposer extends ReferenceSerialization with RouteDecomposer {

  def serializeGateway(implicit format: Formats): PartialFunction[Any, JValue] = serialize(full = true, port = true)

  def serializeAnonymousGateway(port: Boolean)(implicit format: Formats): PartialFunction[Any, JValue] = serialize(full = false, port)

  private def serialize(full: Boolean, port: Boolean)(implicit format: Formats): PartialFunction[Any, JValue] = {
    case gateway: Gateway ⇒
      val list = new ArrayBuffer[JField]
{'fraction_non_alphanumeric': 0.0842911877394636, 'fraction_numerical': 0.0013932427725531174, 'mean_word_length': 5.805687203791469, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4630676', 'n_tokens_mistral': 803, 'n_tokens_neox': 787, 'n_words': 204}