Skip to content

Commit

Permalink
fix(config): fixed bad parsing of YAML configuration files (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
lyogev authored Jan 29, 2018
1 parent 865cc2c commit edd0745
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 17 deletions.
6 changes: 3 additions & 3 deletions src/main/scala/com/yotpo/metorikku/utils/FileUtils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.yotpo.metorikku.utils

import java.io.{File, FileNotFoundException}

import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.databind.{DeserializationFeature, ObjectMapper}
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory
import com.yotpo.metorikku.exceptions.MetorikkuException
import org.apache.commons.io.FilenameUtils
Expand Down Expand Up @@ -41,8 +41,8 @@ object FileUtils {
def getObjectMapperByExtension(fileName: String): Option[ObjectMapper] = {
val extension = FilenameUtils.getExtension(fileName)
extension match {
case "json" => Option(new ObjectMapper())
case "yaml" => Option(new ObjectMapper(new YAMLFactory()))
case "json" => Option(new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false))
case "yaml" | "yml" | _ => Option(new ObjectMapper(new YAMLFactory()).configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false))
}
}
}
7 changes: 0 additions & 7 deletions src/test/scala/com/yotpo/metorikku/test/MetorikkuTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,4 @@ class MetorikkuTest extends FunSuite with BeforeAndAfterAll {
}
assert(thrown.getCause.getMessage.startsWith("cannot resolve '`non_existing_column`'"))
}


test("Test Metorikku should Fail on invalid step type") {
assertThrows[MetorikkuInvalidMetricFileException] {
Metorikku.main(Array("-c", "src/test/scala/com/yotpo/metorikku/test/metorikku-test-config-invalid-step-type.yaml"))
}
}
}

This file was deleted.

0 comments on commit edd0745

Please sign in to comment.