softwaremill / softwaremill/tapir

Tapir Schema for Tuples is an SProduct instead of an array

Open
#2,604 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Scala
Stars
1.5k
Forks
468
Avg merge
5h 37m
Merged PRs (30d)
34

Description

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]

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start from the implicit Schema[(Int, Int)] entry point shown in the issue and trace how TupleN schemas currently become SProduct values. Compare the desired representation with the circe Encoder example, then determine the intended tuple-array behavior and add regression coverage for the resulting schema.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.