Skip to content

Commit

Permalink
compilation fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ghik committed Apr 22, 2024
1 parent 01d86bc commit 4b82ab1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ private class SchemaComparator(
case s@LocalReference(name) =>
def noSchema: Nothing =
throw new NoSuchElementException(s"could not resolve schema reference ${s.$ref.get}")

normalize(named.getOrElse(name, noSchema), named)
case s => s
}
Expand Down Expand Up @@ -198,7 +199,7 @@ private class SchemaComparator(
types.nonEmpty && !types.contains(SchemaType.Array) && !types.contains(SchemaType.Object)
} && s == Schema( // check if the schema contains only primitive type assertions
`type` = s.`type`,
enum = s.`enum`,
`enum` = s.`enum`,
const = s.`const`,
format = s.format,

Expand Down Expand Up @@ -275,7 +276,7 @@ private class SchemaComparator(

private def discriminatorMapping(schema: Schema): Option[ListMap[String, SchemaLike]] =
schema.discriminator.map { disc =>
val baseMapping = schema.oneOf.collect({ case s@LocalReference(name) => name -> s }).to(ListMap)
val baseMapping = ListMap(schema.oneOf.collect({ case s@LocalReference(name) => name -> s }): _*)
baseMapping ++ disc.mapping.getOrElse(ListMap.empty).map {
case (name, ref) => name -> Schema($ref = Some(ref))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ sealed abstract class SchemaCompatibilityIssue extends Product {
override def toString: String = s"$productPrefix($description)"

protected def pluralize(what: String, coll: Seq[Any]): String =
if (coll.sizeIs == 1) s"$what ${coll.head}"
if (coll.lengthCompare(1) == 0) s"$what ${coll.head}"
else s"${what}s ${coll.mkString(", ")}"

protected def form(coll: Seq[Any], singular: String, plural: String): String =
Expand Down

0 comments on commit 4b82ab1

Please sign in to comment.