arrow-endpoint icon indicating copy to clipboard operation
arrow-endpoint copied to clipboard

Move tests to correct folder

Open lenguyenthanh opened this issue 2 years ago • 9 comments

I think we moved this test file into a wrong folder, so it stops running ( that why we thought it passes). But it is actually still failed.

lenguyenthanh avatar Mar 23 '22 16:03 lenguyenthanh

Damn, that's too bad :( Good we have a failing test now, hopefully we can fix it easily.

nomisRev avatar Mar 24 '22 09:03 nomisRev

Relevant:

  • https://youtrack.jetbrains.com/issue/KT-50764
  • https://github.com/Kotlin/kotlinx.serialization/issues/610
  • https://github.com/Kotlin/kotlinx.serialization/issues/1705#issuecomment-1001786343

nomisRev avatar Mar 24 '22 09:03 nomisRev

Moving to Kotlin 1.6.0 fixes the issue for me. I'm also going to attempt to use the workaround, since this is internal anyway.

nomisRev avatar Mar 24 '22 09:03 nomisRev

@lenguyenthanh this is the fix following the tickets on the trackers.

@Serializable(with = ReferencedSerializer::class)
public open class Referenced<out A> internal constructor() {
  public data class Ref(public val value: Reference) : Referenced<Nothing>()
  public data class Other<A>(val value: A) : Referenced<A>()

  public fun <B> map(f: (A) -> B): Referenced<B> =
    when (this) {
      is Other -> Other(f(value))
      is Ref -> this
      else -> TODO("Impossible.")
    }
}

Test locally, and in downstream project and it fixes the issue for me. I can add/push this fix on your branch later if you like so we can see this test pass.

nomisRev avatar Mar 24 '22 10:03 nomisRev

Great thanks @nomisRev ! I will try it local and push it to this branch.

lenguyenthanh avatar Mar 24 '22 10:03 lenguyenthanh

It worked locally, and open-api module is also working now for the first time 🎉

lenguyenthanh avatar Mar 24 '22 10:03 lenguyenthanh

According to YouTrack this should be fixed in Kotlin 1.6.20, which is currently in M1. So perhaps we should wait a bit to merge this PR. Hopefully in the next week we can introduce alpha releases like in Arrow, and maybe Kotlin 1.6.20 will be released by then.

Off-topic

@lenguyenthanh Are you depending on the SNAPSHOT? I also found they have an incorrect name.

"io.arrow-kt:ktor-server:0.1.2-SNAPSHOT"
"io.arrow-kt:openapi-docs:0.1.2-SNAPSHOT"

instead of

"io.arrow-kt:arrow-endpoint-ktor-server:0.1.2-SNAPSHOT"
"io.arrow-kt:arrow-endpoint-openapi-docs:0.1.2-SNAPSHOT"

nomisRev avatar Mar 24 '22 10:03 nomisRev

Thanks for reporting and helping looking into this @lenguyenthanh ❤️

nomisRev avatar Mar 24 '22 10:03 nomisRev

Yeah, I agree with your approach, no need to rush to merge this PR.

I'm still using my Jitpack version. But I will try to use the snapshot version soon. Thanks for the head up, @nomisRev !

lenguyenthanh avatar Mar 24 '22 10:03 lenguyenthanh