-
Notifications
You must be signed in to change notification settings - Fork 422
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2255 from softwaremill/derived-enumeration-macro-…
…missing-class-fqn The derivedEnumeration macro should reference fully qualified class names
- Loading branch information
Showing
2 changed files
with
20 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
core/src/test/scala/sttp/tapir/namespacing/SchemaMacroNamespaceTest.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package sttp.tapir.namespacing | ||
|
||
import org.scalatest.flatspec.AnyFlatSpec | ||
import org.scalatest.matchers.should.Matchers | ||
|
||
class SchemaMacroNamespaceTest extends AnyFlatSpec with Matchers { | ||
|
||
// #2254: the macro should reference fully qualified class names | ||
it should "compile macro-generated code using derivedEnumeration in a package other than sttp.tapir" in { | ||
sealed trait MyProduct | ||
object MyProduct { | ||
def fromString(m: String): Option[MyProduct] = ??? | ||
} | ||
case object V1 extends MyProduct | ||
|
||
import sttp.tapir.Codec | ||
Codec.derivedEnumeration[String, MyProduct](MyProduct.fromString, _.toString) | ||
} | ||
} |