Skip to content

Commit 9bbeaac

Browse files
author
Matthieu Leclercq
committed
Add "missing" case in match of record docs (endpoints4s#566)
These should not happen as long as Docs has the same length as Types. But they are reported as warnings where the macros are expanded
1 parent 9f6caeb commit 9bbeaac

File tree

1 file changed

+6
-0
lines changed
  • json-schema/json-schema-generic/src/main/scala-3/endpoints4s/generic

1 file changed

+6
-0
lines changed

json-schema/json-schema-generic/src/main/scala-3/endpoints4s/generic/JsonSchemas.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,17 @@ trait JsonSchemas extends algebra.JsonSchemas:
137137
case docHead *: docsTail =>
138138
// TODO Remove asInstanceOf, but the compiler crashes if the above line is `case (docHead: Option[docs]) *: docsTail`
139139
(docHead.asInstanceOf[Option[docs]].map(_.text), docsTail)
140+
case EmptyTuple =>
141+
// Should not happen if Docs has the same length as Types and Labels
142+
(None, EmptyTuple)
140143
val (maybeDefaultValue, defaultValuesTail) =
141144
/*inline*/ defaultValues match
142145
case defaultValueHead *: defaultValuesTail =>
143146
// TODO Remove asInstanceOf
144147
(defaultValueHead.asInstanceOf[Option[head]], defaultValuesTail)
148+
case EmptyTuple =>
149+
// Should not happen if Docs has the same length as Types and Labels
150+
(None, EmptyTuple)
145151
val labelHead = constValue[labelHead].asInstanceOf[String] // TODO Remove asInstanceOf
146152
val recordHead: Record[head] =
147153
inline erasedValue[head] match

0 commit comments

Comments
 (0)