Skip to content
Closed
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Inspired by Coursera Autoschema but uses `Scala Macros` instead of `Java Reflect
- `BigDecimal`
- `String`
- Date Time
- `org.joda.time.DateTime`
- `java.util.Date`
- `java.sql.Timestamp`
- `java.time.Instant`
Expand Down
10 changes: 8 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ lazy val commonSettings = Seq(

releaseCrossBuild := true,

libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.1" % Test
libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest" % "3.0.1" % Test,
"joda-time" % "joda-time" % "2.10.1"
)
)


Expand Down Expand Up @@ -89,7 +92,10 @@ lazy val `play-json` = { project in file("play-json") }.dependsOn(core, api).set

name := "scala-jsonschema-play-json",

libraryDependencies += "com.typesafe.play" %% "play-json" % "2.6.3"
libraryDependencies ++= Seq(
"com.typesafe.play" %% "play-json" % "2.6.3",
"com.typesafe.play" %% "play-json-joda" % "2.6.3",
)
)

lazy val `spray-json` = { project in file("spray-json") }.dependsOn(core, api).settings(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package com.github.andyglow.jsonschema
import java.net.{URI, URL}
import java.util.UUID

import org.joda.time.DateTime

import scala.reflect.macros.blackbox

object SchemaMacro {
Expand Down Expand Up @@ -44,6 +46,7 @@ object SchemaMacro {
case x if x =:= typeOf[URI] => q"`string`[$x](Some(`string`.Format.`uri`), None)"

// date, date-time
case x if x =:= typeOf[org.joda.time.DateTime] => q"`string`[$x](Some(`string`.Format.`date-time`), None)"
case x if x =:= typeOf[java.util.Date] => q"`string`[$x](Some(`string`.Format.`date-time`), None)"
case x if x =:= typeOf[java.sql.Timestamp] => q"`string`[$x](Some(`string`.Format.`date-time`), None)"
case x if x =:= typeOf[java.time.Instant] => q"`string`[$x](Some(`string`.Format.`date-time`), None)"
Expand All @@ -53,6 +56,7 @@ object SchemaMacro {
case x if x =:= typeOf[java.sql.Time] => q"`string`[$x](Some(`string`.Format.`time`), None)"
case x if x =:= typeOf[java.time.LocalTime] => q"`string`[$x](Some(`string`.Format.`time`), None)"


case x if x <:< typeOf[Map[String, _]] => SM.gen(x, stack)

case x if x <:< typeOf[Map[Int, _]] => IM.gen(x, stack)
Expand Down