diff --git a/Src/java/cql-to-elm-cli/build.gradle.kts b/Src/java/cql-to-elm-cli/build.gradle.kts index 5e62d536e..f951376fb 100644 --- a/Src/java/cql-to-elm-cli/build.gradle.kts +++ b/Src/java/cql-to-elm-cli/build.gradle.kts @@ -9,6 +9,7 @@ application { dependencies { implementation(project(":cql-to-elm")) + implementation(project(":cql-to-elm-jackson")) implementation(project(":quick")) implementation(project(":qdm")) implementation(project(":model-jaxb")) diff --git a/Src/java/cql-to-elm-cli/src/main/java/org/cqframework/cql/cql2elm/cli/Main.java b/Src/java/cql-to-elm-cli/src/main/java/org/cqframework/cql/cql2elm/cli/Main.java index b64dc495e..13dfd626a 100644 --- a/Src/java/cql-to-elm-cli/src/main/java/org/cqframework/cql/cql2elm/cli/Main.java +++ b/Src/java/cql-to-elm-cli/src/main/java/org/cqframework/cql/cql2elm/cli/Main.java @@ -265,7 +265,7 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IO options.has(validateUnits), options.has(disableDefaultModelInfoLoad), signatureLevel, - options.has(compatibilityLevel) ? options.valueOf(compatibilityLevel) : null)); + options.has(compatibilityLevel) ? options.valueOf(compatibilityLevel) : "1.5")); } } } diff --git a/Src/java/cql-to-elm-jackson/build.gradle.kts b/Src/java/cql-to-elm-jackson/build.gradle.kts new file mode 100644 index 000000000..642ae3b20 --- /dev/null +++ b/Src/java/cql-to-elm-jackson/build.gradle.kts @@ -0,0 +1,8 @@ +plugins { + id("cql.library-conventions") +} + +dependencies { + implementation(project(":cql-to-elm")) + implementation("com.fasterxml.jackson.module:jackson-module-jakarta-xmlbind-annotations:${project.findProperty("jackson.version")}") +} \ No newline at end of file diff --git a/Src/java/cql-to-elm/src/main/java/org/cqframework/cql/cql2elm/CqlTranslatorOptionsMapper.kt b/Src/java/cql-to-elm-jackson/src/main/java/org/cqframework/cql/cq2elm/CqlTranslatorOptionsMapper.kt similarity index 87% rename from Src/java/cql-to-elm/src/main/java/org/cqframework/cql/cql2elm/CqlTranslatorOptionsMapper.kt rename to Src/java/cql-to-elm-jackson/src/main/java/org/cqframework/cql/cq2elm/CqlTranslatorOptionsMapper.kt index aee5a8da4..9b37e069a 100644 --- a/Src/java/cql-to-elm/src/main/java/org/cqframework/cql/cql2elm/CqlTranslatorOptionsMapper.kt +++ b/Src/java/cql-to-elm-jackson/src/main/java/org/cqframework/cql/cq2elm/CqlTranslatorOptionsMapper.kt @@ -1,13 +1,18 @@ @file:Suppress("WildcardImport") -package org.cqframework.cql.cql2elm +package org.cqframework.cql.cq2elm import com.fasterxml.jackson.databind.ObjectMapper import java.io.* import java.util.* +import org.cqframework.cql.cql2elm.CqlTranslatorOptions object CqlTranslatorOptionsMapper { - private val om: ObjectMapper = ObjectMapper() + private val om: ObjectMapper = + ObjectMapper() + .setMixIns( + mapOf(CqlTranslatorOptions::class.java to CqlTranslatorOptionsMixin::class.java) + ) @JvmStatic fun fromFile(fileName: String?): CqlTranslatorOptions { diff --git a/Src/java/cql-to-elm-jackson/src/main/java/org/cqframework/cql/cq2elm/CqlTranslatorOptionsMixin.kt b/Src/java/cql-to-elm-jackson/src/main/java/org/cqframework/cql/cq2elm/CqlTranslatorOptionsMixin.kt new file mode 100644 index 000000000..57a0b4102 --- /dev/null +++ b/Src/java/cql-to-elm-jackson/src/main/java/org/cqframework/cql/cq2elm/CqlTranslatorOptionsMixin.kt @@ -0,0 +1,8 @@ +package org.cqframework.cql.cq2elm + +import com.fasterxml.jackson.annotation.JsonUnwrapped +import org.cqframework.cql.cql2elm.CqlCompilerOptions + +abstract class CqlTranslatorOptionsMixin { + @get:JsonUnwrapped @set:JsonUnwrapped abstract var cqlCompilerOptions: CqlCompilerOptions? +} diff --git a/Src/java/cql-to-elm/src/test/java/org/cqframework/cql/cql2elm/OptionsTests.java b/Src/java/cql-to-elm-jackson/src/test/java/org/cqframework/cql/cql2elm/OptionsTests.java similarity index 94% rename from Src/java/cql-to-elm/src/test/java/org/cqframework/cql/cql2elm/OptionsTests.java rename to Src/java/cql-to-elm-jackson/src/test/java/org/cqframework/cql/cql2elm/OptionsTests.java index 299c2aa7b..b5a4fb4c9 100644 --- a/Src/java/cql-to-elm/src/test/java/org/cqframework/cql/cql2elm/OptionsTests.java +++ b/Src/java/cql-to-elm-jackson/src/test/java/org/cqframework/cql/cql2elm/OptionsTests.java @@ -6,6 +6,7 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.io.StringWriter; +import org.cqframework.cql.cq2elm.CqlTranslatorOptionsMapper; import org.junit.jupiter.api.Test; class OptionsTests { diff --git a/Src/java/cql-to-elm/src/test/resources/org/cqframework/cql/cql2elm/options.json b/Src/java/cql-to-elm-jackson/src/test/resources/org/cqframework/cql/cql2elm/options.json similarity index 100% rename from Src/java/cql-to-elm/src/test/resources/org/cqframework/cql/cql2elm/options.json rename to Src/java/cql-to-elm-jackson/src/test/resources/org/cqframework/cql/cql2elm/options.json diff --git a/Src/java/cql-to-elm/build.gradle.kts b/Src/java/cql-to-elm/build.gradle.kts index ee6cb8b55..3b96454e8 100644 --- a/Src/java/cql-to-elm/build.gradle.kts +++ b/Src/java/cql-to-elm/build.gradle.kts @@ -6,12 +6,6 @@ dependencies { api(project(":cql")) api(project(":model")) api(project(":elm")) - - // TODO: This dependencies are required due the the fact that the CqlTranslatorOptionsMapper lives - // in the cql-to-elm project. Ideally, we"d factor out all serialization dependencies into common - // libraries such that we could swap out jackson for something else. In the meantime, these are - // "implementation" dependencies so that they are not exported downstream. - implementation("com.fasterxml.jackson.module:jackson-module-jakarta-xmlbind-annotations:${project.findProperty("jackson.version")}") testImplementation(project(":elm-jackson")) testImplementation(project(":model-jackson")) testImplementation(project(":quick")) diff --git a/Src/java/cql-to-elm/src/main/java/org/cqframework/cql/cql2elm/CqlTranslatorOptions.kt b/Src/java/cql-to-elm/src/main/java/org/cqframework/cql/cql2elm/CqlTranslatorOptions.kt index dad1950d1..6a4712926 100644 --- a/Src/java/cql-to-elm/src/main/java/org/cqframework/cql/cql2elm/CqlTranslatorOptions.kt +++ b/Src/java/cql-to-elm/src/main/java/org/cqframework/cql/cql2elm/CqlTranslatorOptions.kt @@ -1,6 +1,5 @@ package org.cqframework.cql.cql2elm -import com.fasterxml.jackson.annotation.JsonUnwrapped import java.util.* class CqlTranslatorOptions { @@ -10,7 +9,7 @@ class CqlTranslatorOptions { COFFEE } - @JsonUnwrapped var cqlCompilerOptions: CqlCompilerOptions? = null + var cqlCompilerOptions: CqlCompilerOptions? = null var formats: Set? = null fun withCqlCompilerOptions(cqlCompilerOptions: CqlCompilerOptions?): CqlTranslatorOptions { diff --git a/Src/java/settings.gradle.kts b/Src/java/settings.gradle.kts index 173801a6a..9831138d8 100644 --- a/Src/java/settings.gradle.kts +++ b/Src/java/settings.gradle.kts @@ -27,10 +27,10 @@ include( "quick", "cql-to-elm", "cql-to-elm-cli", + "cql-to-elm-jackson", "elm-fhir", "ucum", "tools:cql-formatter", "tools:cql-parsetree", "tools:xsd-to-modelinfo" ) -include("ucum")