tapir icon indicating copy to clipboard operation
tapir copied to clipboard

Tapir Schema for Tuples is an SProduct instead of an array

Open kamilkloch opened this issue 3 years ago • 1 comments

Currently a Schema for Tuple2 renders like a case class, with product members _1 and _2:

implicitly[Schema[(Int, Int)]]
Schema(
    SProduct(
      List(
        SProductField(FieldName(_1,_1),Schema(SInteger(),None,false,None,None,Some(int32),None,false,false,All(List()),AttributeMap(Map()))),
        SProductField(FieldName(_2,_2),Schema(SInteger(),None,false,None,None,Some(int32),None,false,false,All(List()),AttributeMap(Map())))
      )
    ),
    Some(SName(scala.Tuple2,List(Int, Int))),
    false,None,None,None,None,false,false,All(List()),AttributeMap(Map())
  )

Arguably, a Schema for TupleN as an array is a better choice, as done by circe:

println(implicitly[io.circe.Encoder[(Int, Int)]].apply(1 -> 2).noSpaces)
[1,2]

kamilkloch avatar Nov 30 '22 11:11 kamilkloch