Skip to content

Commit

Permalink
Release v1.8.4
Browse files Browse the repository at this point in the history
  • Loading branch information
darkfrog26 committed Dec 19, 2022
1 parent 7c9b244 commit d1db9ff
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ The focus of this project is minimalism and flexibility. To that end, the featur
### Setup

For SBT simply include:
`libraryDependencies += "org.typelevel" %%% "fabric-core" % "1.8.3"`
`libraryDependencies += "org.typelevel" %%% "fabric-core" % "1.8.4"`

For parsing support include:
`libraryDependencies += "org.typelevel" %%% "fabric-io" % "1.8.3"`
`libraryDependencies += "org.typelevel" %%% "fabric-io" % "1.8.4"`

### Create

Expand Down
6 changes: 6 additions & 0 deletions core/shared/src/main/scala/fabric/define/DefType.scala
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ object DefType {
obj(
"type" -> "boolean"
)
case Enum(values) =>
obj(
"type" -> "enum",
"values" -> values
)
case Null =>
obj(
"type" -> "null"
Expand All @@ -117,6 +122,7 @@ object DefType {
case "decimal" => Dec
}
case "boolean" => Bool
case "enum" => Enum(o.value("values").asVector.toList)
case "null" => Null
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ object FabricGenerator {
case DefType.Int => "Long"
case DefType.Dec => "BigDecimal"
case DefType.Bool => "Boolean"
case DefType.Enum(_) => throw new RuntimeException("Unsupported")
case DefType.Null =>
throw new RuntimeException(
"Null type found in definition! Not supported for code generation!"
Expand Down
3 changes: 2 additions & 1 deletion core/shared/src/main/scala/fabric/rw/RW.scala
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ object RW extends CompileRW {

override def read(t: T): Json = str(asString(t))

override val definition: DefType = DefType.Enum(list.map(t => Str(asString(t))))
override val definition: DefType =
DefType.Enum(list.map(t => Str(asString(t))))
}

def string[T](asString: T => String, fromString: String => T): RW[T] =
Expand Down

0 comments on commit d1db9ff

Please sign in to comment.