Skip to content

Commit

Permalink
Updated for latest API changes
Browse files Browse the repository at this point in the history
  • Loading branch information
propensive committed Aug 2, 2023
1 parent 81fb908 commit b5bea6e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/core/schema.scala
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@ object JsonRecord:
def access(value: Json): Ipv6 throws IpAddressError = Ipv6.parse(value.as[Text])

given uri[UrlType: GenericUrl]: JsonValueAccessor["uri", UrlType] =
value => makeUrl[UrlType](value.as[String])
value => GenericUrl[UrlType](value.as[Text])

given uriReference: JsonValueAccessor["uri-reference", Text] = _.as[Text]

given iri[UrlType: GenericUrl]: JsonValueAccessor["iri", UrlType] =
value => makeUrl[UrlType](value.as[String])
value => GenericUrl[UrlType](value.as[Text])

given iriReference: JsonValueAccessor["iri-reference", Text] = _.as[Text]
given uuid: JsonValueAccessor["uuid", Text] = _.as[Text]
Expand Down Expand Up @@ -202,12 +202,12 @@ object JsonSchema:
def arrayFields =
items.mm(_.map: (key, value) =>
key -> value.as[Property].field(requiredFields.contains(key))
).or(throw Mistake("missing items"))
).or(throw Mistake(msg"Some items were missing"))

def objectFields =
properties.mm(_.map: (key, value) =>
key -> value.as[Property].field(requiredFields.contains(key))
).or(throw Mistake("missing properties"))
).or(throw Mistake(msg"Some properties were missing"))

def field(required: Boolean): RecordField = `type` match
case "array" =>
Expand Down

0 comments on commit b5bea6e

Please sign in to comment.