-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Rename CaseClass1Rep to ValueClassLike * Create ValueEnumLike and EnumLike interfaces * Implement ValueEnumLike and EnumLike interfaces * Minor naming fix * Rename CaseClass1Rep to ValueClassLike also in tests * Resolve conflict in changes.md * Introduce Enumeration to EnumLike implicit macro * Introduce implicit macro Enumeratum to EnumLike converter * Remove scala3 enum support for testing reasons * Fixed scala2 Enumeration support bug * Scala 2.12.18 support drop * Added s3 enum support * Added s3 enumeratum support * Introduced support for enumeratum value-enum. In progress * Added value enum for s3 support. Still bugs in value enumeratum s2 * Added debug comments in KebsValueEnumeratum * Changed debug comments in KebsValueEnumeratum * Draft for value enumeratum debug * Structure types value enums. * Remove redundant wrappers, introduce package files and common tests for s2 and s3 * Scala 2.12.18 support drop * Revert "Scala 2.12.18 support drop" This reverts commit 9790377. * Fixed cyclic reference bug * Introduce package objects in enum and enumeratum tests * Introduce EnumLike and ValueEnumLike in slick and circe support. Tests CirceValueEnumDecoderEncoderTest and SlickMappedValueEnumColumnTypeTests not working, commented them out for now. * Bring back one test for slick and one test for circe that cause errors * Replace EnumOf and ValueEnumOf in favour of EnumLike and ValueEnumLike in all s2 modules * Moved domain files in http4s-stir and in http4s to dedicated domain package * Pekko http unmarshall test debug * Bring back kebsValueEnumUnmarshaller * Solved ambiguity problem. Type safety bug remains * Throw an exception when generic types in pekko-http unmarshaller macros are conflicting * Remove redundant import * Rewrite core and enum module to the state before struct types * Replace struct types with mixed trait * Remove redundant enum macros from core * Fix http4sStirSupport unmarshaller test * Remove implicits prioritisation * Update README with a migration guide * Make conversion from Product to VCL optional * Use FlatCaseClass1 * Rename FlatCaseClass1 to CaseClass1ToValueClass * Update README * Proper package naming convention, works for s2 * Proper packages naming convention for s2 and s3 * Remove minor bug in README * Remove minor bug regarding instance keyword in README * Enum interface refactor and minor stylistic fixes * Remove instances naming bug * Fix naming * removing redundant dependencies and code * doobie enumeratum fix * remove unnecessary import * slick - add enumeratum only for tests * pekko-http - enumeratum in tests only * remove duplication * http4s-stir - enumeratum in tests only * moving model to separate package object * circe - model refactor * removing redundancy in scalacheck module * Bumps pre-Slick 3.5.x * Basic support for Slick 3.5.x (#378) * Basic support for Slick 3.5.x * Buming CI to 3.3.3 * given -> implicit for ValueClassReps * Removing -Xsource:3 temporarily * Slick cleanup * Unused cleanup. --------- Co-authored-by: agrodowski <[email protected]> Co-authored-by: Antoni Grodowski <[email protected]> Co-authored-by: Paweł Kiersznowski <[email protected]> Co-authored-by: pkiersznowski <[email protected]>
- Loading branch information
1 parent
5e8e9b2
commit 1412caa
Showing
291 changed files
with
2,829 additions
and
3,237 deletions.
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
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
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
10 changes: 4 additions & 6 deletions
10
...terators/kebs/matchers/KebsMatchers.scala → ...kebs/akkahttp/matchers/KebsMatchers.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
2 changes: 1 addition & 1 deletion
2
.../pl/iterators/kebs/matchers/package.scala → ...tors/kebs/akkahttp/matchers/package.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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
package pl.iterators.kebs | ||
package pl.iterators.kebs.akkahttp | ||
|
||
package object matchers extends KebsMatchers |
12 changes: 6 additions & 6 deletions
12
...ebs/unmarshallers/KebsUnmarshallers.scala → ...ttp/unmarshallers/KebsUnmarshallers.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
46 changes: 46 additions & 0 deletions
46
...src/main/scala/pl/iterators/kebs/akkahttp/unmarshallers/enums/KebsEnumUnmarshallers.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,46 @@ | ||
package pl.iterators.kebs.akkahttp.unmarshallers.enums | ||
|
||
import akka.http.scaladsl.unmarshalling.PredefinedFromStringUnmarshallers._ | ||
import akka.http.scaladsl.unmarshalling.{FromStringUnmarshaller, Unmarshaller} | ||
import akka.http.scaladsl.util.FastFuture | ||
import pl.iterators.kebs.core.enums.{EnumLike, ValueEnumLike, ValueEnumLikeEntry} | ||
|
||
trait EnumUnmarshallers { | ||
final def enumUnmarshaller[E](`enum`: EnumLike[E]): FromStringUnmarshaller[E] = Unmarshaller { _ =>name => | ||
`enum`.withNameInsensitiveOption(name) match { | ||
case Some(enumEntry) => FastFuture.successful(enumEntry) | ||
case None => | ||
FastFuture.failed(new IllegalArgumentException(s"""Invalid value '$name'. Expected one of: ${`enum`.getNamesToValuesMap.keysIterator | ||
.mkString(", ")}""")) | ||
} | ||
} | ||
|
||
implicit def kebsEnumUnmarshaller[E](implicit ev: EnumLike[E]): FromStringUnmarshaller[E] = | ||
enumUnmarshaller(ev) | ||
} | ||
|
||
trait ValueEnumUnmarshallers { | ||
final def valueEnumUnmarshaller[V, E <: ValueEnumLikeEntry[V]](`enum`: ValueEnumLike[V, E]): Unmarshaller[V, E] = Unmarshaller { _ =>v => | ||
`enum`.withValueOption(v) match { | ||
case Some(enumEntry) => FastFuture.successful(enumEntry) | ||
case None => | ||
FastFuture.failed(new IllegalArgumentException(s"""Invalid value '$v'. Expected one of: ${`enum`.getValuesToEntriesMap.keysIterator | ||
.mkString(", ")}""")) | ||
} | ||
} | ||
|
||
implicit def kebsValueEnumUnmarshaller[V, E <: ValueEnumLikeEntry[V]](implicit ev: ValueEnumLike[V, E]): Unmarshaller[V, E] = | ||
valueEnumUnmarshaller(ev) | ||
|
||
implicit def kebsIntValueEnumFromStringUnmarshaller[E <: ValueEnumLikeEntry[Int]](implicit ev: ValueEnumLike[Int, E]): FromStringUnmarshaller[E] = | ||
intFromStringUnmarshaller andThen valueEnumUnmarshaller(ev) | ||
implicit def kebsLongValueEnumFromStringUnmarshaller[E <: ValueEnumLikeEntry[Long]](implicit ev: ValueEnumLike[Long, E]): FromStringUnmarshaller[E] = | ||
longFromStringUnmarshaller andThen valueEnumUnmarshaller(ev) | ||
implicit def kebsShortValueEnumFromStringUnmarshaller[E <: ValueEnumLikeEntry[Short]]( | ||
implicit ev: ValueEnumLike[Short, E]): FromStringUnmarshaller[E] = | ||
shortFromStringUnmarshaller andThen valueEnumUnmarshaller(ev) | ||
implicit def kebsByteValueEnumFromStringUnmarshaller[E <: ValueEnumLikeEntry[Byte]](implicit ev: ValueEnumLike[Byte, E]): FromStringUnmarshaller[E] = | ||
byteFromStringUnmarshaller andThen valueEnumUnmarshaller(ev) | ||
} | ||
|
||
trait KebsEnumUnmarshallers extends EnumUnmarshallers with ValueEnumUnmarshallers {} |
2 changes: 1 addition & 1 deletion
2
...scala-2/unmarshallers/enums/package.scala → ...kkahttp/unmarshallers/enums/package.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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
package pl.iterators.kebs.unmarshallers | ||
package pl.iterators.kebs.akkahttp.unmarshallers | ||
|
||
package object enums extends KebsEnumUnmarshallers |
2 changes: 1 addition & 1 deletion
2
...terators/kebs/unmarshallers/package.scala → ...kebs/akkahttp/unmarshallers/package.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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
package pl.iterators.kebs | ||
package pl.iterators.kebs.akkahttp | ||
|
||
package object unmarshallers extends KebsUnmarshallers |
48 changes: 0 additions & 48 deletions
48
akka-http/src/main/scala/pl/iterators/kebs/unmarshallers/enums/KebsEnumUnmarshallers.scala
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.