Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ organization := "org.zalando"

scalaVersion := "2.11.8"

libraryDependencies += "org.apache.spark" %% "spark-sql" % "2.0.1" % Provided
libraryDependencies += "org.apache.spark" %% "spark-sql" % "2.4.3" % Provided
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is outdated in the new master. That's my fault for replying so late, sorry again.

libraryDependencies += "com.typesafe.play" %% "play-json" % "2.5.10"
dependencyOverrides ++= Set("com.fasterxml.jackson.core" % "jackson-databind" % "2.6.5")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -469,4 +469,57 @@ class SchemaConverterTest extends FunSuite with Matchers with BeforeAndAfter {
}
}

test("Reference of multiple types should fail with strict typing") {
assertThrows[IllegalArgumentException] {
val schema = SchemaConverter.enableStrictTyping().convertContent(
"""
{
"definitions": {
"address": {
"type": ["object", "array"],
"properties": {
"street_address": { "type": "string" },
"city": { "type": "string" },
"state": { "type": "string" }
}
}
},
"type": "object",
"properties": {
"billing_address": { "$ref": "#/definitions/address" }
}
}
"""
)
}
}

test("Reference of multiple types should default to typing when disable strict typing") {
val schema = SchemaConverter.disableStrictTyping().convertContent(
"""
{
"definitions": {
"address": {
"type": ["object", "array"],
"properties": {
"street_address": { "type": "string" },
"city": { "type": "string" },
"state": { "type": "string" }
}
}
},
"type": "object",
"properties": {
"billing_address": { "$ref": "#/definitions/address" }
}
}
"""
)

val expected = StructType(
Seq(StructField("billing_address", StringType, nullable = false))
)

assert(schema === expected)
}
}