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

com.netflix.spinnaker.keel.test.jackson.kt Maven / Gradle / Ivy

There is a newer version: 1.4.1
Show newest version
package com.netflix.spinnaker.keel.test

import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.databind.jsontype.NamedType
import com.fasterxml.jackson.dataformat.yaml.YAMLMapper
import com.netflix.spinnaker.keel.artifacts.DebianArtifact
import com.netflix.spinnaker.keel.artifacts.DockerArtifact
import com.netflix.spinnaker.keel.serialization.configuredObjectMapper
import com.netflix.spinnaker.keel.serialization.configuredYamlMapper

fun configuredTestObjectMapper(): ObjectMapper = configuredObjectMapper()
  .registerArtifactSubtypes()

fun configuredTestYamlMapper(): YAMLMapper = configuredYamlMapper()
  .registerArtifactSubtypes() as YAMLMapper

private fun ObjectMapper.registerArtifactSubtypes() =
  this.apply {
    registerSubtypes(
      NamedType(DebianArtifact::class.java, "deb"),
      NamedType(DockerArtifact::class.java, "docker")
    )
  }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy