You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[error] not found: value Validator
[error] error after rewriting to sttp.tapir.Codec.derivedEnumeration[String, domain.enums.MyProduct].apply
[error] possible cause: maybe a wrong Dynamic method signature?
[error] Codec.derivedEnumeration[String, MyProduct](MyProduct.fromString, _.toString)
[error] ^
[error] missing argument list for method fromString in object MyProduct
[error] Unapplied methods are only converted to functions when a function type is expected.
[error] You can make this conversion explicit by writing fromString _ or fromString(_) instead of fromString.
[error] Codec.derivedEnumeration[String, MyProduct](MyProduct.fromString, _.toString)
[error] ^
[error] two errors found
[error] (Compile / compileIncremental) Compilation failed
Everything works fine when I add this import:
import sttp.tapir.Validator
but it stands out as an unused import.
Any workaround?
Thank you!
The text was updated successfully, but these errors were encountered:
Indeed, the macro was missing the fully qualified class name.
The sttp.tapir.ztapir._ import does replace the wildcard sttp.tapir._ (which brings into scope endpoint and input/output builders), but you still need to import the data types such as Codec
Tapir version: 1.0.0
Scala version: 2.13.8
Hi !
I am implementing an http server using tapir and runnning it as a zio http server.
Using the following Codec:
implicit def plainCodecForMyProduct: PlainCodec[MyProduct] = Codec.derivedEnumeration[String, MyProduct](MyProduct.fromString, _.toString)
(Where MyProduct is a trait, implemented by some case objects)
In the documentation it says to import sttp.tapir._ but I am already importing sttp.tapir.ztapir._
When importing only what's needed from plain tapir:
import sttp.tapir.Codec.PlainCodec
import sttp.tapir.Codec
I get the following error:
[error] not found: value Validator
[error] error after rewriting to sttp.tapir.Codec.derivedEnumeration[String, domain.enums.MyProduct].apply
[error] possible cause: maybe a wrong Dynamic method signature?
[error] Codec.derivedEnumeration[String, MyProduct](MyProduct.fromString, _.toString)
[error] ^
[error] missing argument list for method fromString in object MyProduct
[error] Unapplied methods are only converted to functions when a function type is expected.
[error] You can make this conversion explicit by writing
fromString _
orfromString(_)
instead offromString
.[error] Codec.derivedEnumeration[String, MyProduct](MyProduct.fromString, _.toString)
[error] ^
[error] two errors found
[error] (Compile / compileIncremental) Compilation failed
Everything works fine when I add this import:
import sttp.tapir.Validator
but it stands out as an unused import.
Any workaround?
Thank you!
The text was updated successfully, but these errors were encountered: