Skip to content

Commit

Permalink
Adding ElmProject decoders (#295)
Browse files Browse the repository at this point in the history
  • Loading branch information
michelchan authored Sep 20, 2024
1 parent 9e85cb5 commit 3b51b5d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
27 changes: 24 additions & 3 deletions morphir/src/org/finos/morphir/lang/elm/project.scala
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,30 @@ object ElmProject:
enum Kind:
case Package, Application

// type ElmApplication = ElmProject.ElmApplication
// object ElmApplication:
// final case class PackageDependency(packageName:ElmPackageName, version:ElmPackageVersion)
private def defaultApp: ElmApplication = ElmApplication(
List.empty,
SemVerString("v0.0.1"),
ElmApplicationDependencies.default,
ElmApplicationDependencies.default
)

private def defaultPackage: ElmPackage = ElmPackage(
ElmPackageName("author/name"),
None,
ElmPackageVersion.default,
"",
List.empty,
Map.empty,
Map.empty
)

given Surface[ElmApplication] = generic.deriveSurface
given ConfEncoder[ElmApplication] = generic.deriveEncoder
given appDecoder: ConfDecoder[ElmApplication] = generic.deriveDecoder(defaultApp)

given Surface[ElmPackage] = generic.deriveSurface
given ConfEncoder[ElmPackage] = generic.deriveEncoder
given packageDecoder: ConfDecoder[ElmPackage] = generic.deriveDecoder(defaultPackage)

final case class ElmApplicationDependencies(
direct: Map[ElmPackageName, ElmPackageVersion],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ object ElmProjectSpec extends MorphirSpecDefault {
)

private def elmProjectSuite =
// import ElmApplication.given

suite("ElmProjectSpec")(
test("should be able to read an application elm.json file") {
val workspaceFilePath = os.resource / "org" / "finos" / "morphir" / "lang" / "elm" / "application" / "elm.json"
Expand Down

0 comments on commit 3b51b5d

Please sign in to comment.