Skip to content

Validator.show for Enumeration is missing the closing parenthesis #5219

@haskiindahouse

Description

@haskiindahouse

Hit this while logging validator descriptions for an enum-backed query parameter. The string Validator.show produces is missing the closing ).

//> using scala 3.8.3
//> using dep com.softwaremill.sttp.tapir::tapir-core::1.11.25

import sttp.tapir.Validator

@main def run(): Unit =
  val v = Validator.enumeration(List("A", "B", "C"))
  println(v.show)

Output:

Some(in(A,B,C

Expected: Some(in(A,B,C)).

Source line:

case Enumeration(possibleValues, _, _) => Some(s"in(${possibleValues.mkString(",")}")

case Enumeration(possibleValues, _, _) => Some(s"in(${possibleValues.mkString(",")}")

The interpolation closes the inner mkString(",") but then the string ends, so the ) for in( never makes it out. The neighbouring all(...) and any(...) cases on lines 317 and 323 do close their parens correctly, so this looks like a one-character typo:

case Enumeration(possibleValues, _, _) => Some(s"in(${possibleValues.mkString(",")})")

Happy to PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions