caliban icon indicating copy to clipboard operation
caliban copied to clipboard

Can't sent Upload that are in the case class (some Input) and not at the root level

Open vlazarew opened this issue 3 years ago • 1 comments

Hello

I created mutation with next spec:

case class HtmlInput (url: String, html: Upload, attachments: Seq[Attachment] = Seq.empty) case class Attachment(url: Option[String], file: Upload) , where Upload is caliban.uploads type.

So, UI passed to me correct HtmlInput.

But, when i send this mutation like this image

i have next problem image

I think, that Caliban doesn't recognize any Upload, which located into nested Input. I came to this conclusion, because if i send mutation like this image

or

mutation uploadHTML($html: Upload!, $file1: Upload!, $file2: Upload!) { uploadHtml( url: "test" html: $html attachments: [{ url: "test", file: $file1 }, { url: "test2", file: $file2 }] ) } all works great.

But in last case, i must create Upload variable for every file, instead conside AttachmentInput.

Any idea what can cause this issue and how to fix it?

vlazarew avatar Aug 04 '22 12:08 vlazarew

We have a unit test for this case, so it should be supported, see the code in https://github.com/ghostdogpr/caliban/blob/66bf18582048910082fb73f2077ebd865df70655/interop/tapir/src/test/scala/caliban/interop/tapir/TapirAdapterSpec.scala#L125 and https://github.com/ghostdogpr/caliban/blob/66bf18582048910082fb73f2077ebd865df70655/interop/tapir/src/test/scala/caliban/interop/tapir/TestApi.scala#L35

If not working, can you provide some way to reproduce it easily?

ghostdogpr avatar Aug 04 '22 12:08 ghostdogpr

Thank you,

Can you tell me which version of this functionality appeared?

We're using caliban 1.2.4 and have this behaviour

Maybe i should use newer version?

vlazarew avatar Aug 17 '22 10:08 vlazarew

I think this was fixed in 1.3.0 https://github.com/ghostdogpr/caliban/releases/tag/v1.3.0

frekw avatar Aug 17 '22 11:08 frekw