Releases: giiita/refuel
v2.1.0
Add support scala versions
- scala 3.1
- scala 3.2
Fixing minor bugs.
- Resolved the issue of incorrect resolution or inability to compile when multiple implicit variables were found as candidates for resolving type arguments in dependency resolution through implicit parameters.
- With the support for Scala 3.1 version and later, we have discontinued the support for JsonCodec of horizontal tuples with 22 or more elements.
- We have added support for dependency injection of the concrete class itself with type parameters.
class Target[F[_]](implicit context: Context[F]) extends AutoInject
inject[Target[Future]]
Full Changelog: v2.0.1...v2.1.0
v2.0.2
v2.0.0
v2.0.0-RC2
Bugfix
- Fixed a bug that caused DI to fail for classes with culled constructor. This is also true for classes that require an implicit / given parameter.
- Fixed a bug in which dotty could not find the injection target of a class that was not given a Flag.
Scala3 migration
- Scala3 support for the util module.
v2.0.0-RC1 Scala3 migration
Support for Scala3
Major revisions have been made to support Scala3.
For Scala3
- Duplicating and referencing a container is now a Context function.
class Sample extends Injector {
closed { // implicit c => is not needed
...
}
}
For Scala2/3
- Decoration inject
Specify Option or Iterable to get the relevant dependencies with arbitrary limits.
inject[A] // Succeeds if there is one dependency with the highest priority.
inject[Option[A]] // Succeeds if there is no dependency or if one exists
inject[Iterable[A]] // Succeeds even if no or multiple dependencies are found, and gets all applicable ones with the highest priority
- Delete the runtime injection & effective injection
Compile-time runtime injection with @RuntimeRecognizedInjection is no longer available.
Decoration inject instead.
v1.5.3
Discard Entity when inputting Http response to Json Deserializer
Akka's max-open-request may cause an error when connecting many connections at the same time.
EntityBytes will be discarded when StrictTask finishes because they may remain in the buffer even if the process itself finishes successfully.
Others
- Added a constructor for clients of CombineTask
- Add a constructor for client of Lazy[T].
v1.5.2
JsonVal#toString has been fixed.
Output of json encoded strings used to require a mixin of JsonTransform and a call to #encodedStr, but this has been fixed so that you can get the same result with toString.
JsonObject is now a completely unordered Set
Since it was originally LinearSeq based, the Json key pairs were aligned in the order in which they were processed, but since there was no need to guarantee this order, and duplicates could be removed at the type level, it was changed to Set.
This changes the order in which JsObjects are tuple deserialized, so be careful!
val tuple = Json.obj(
"key1" -> "value1",
"key2" -> "value2",
"key3" -> "value3"
).des[(String, String, String)]
// ~ v1.5.1
tuple shouldBe ("value1", "value2", "value3")
// v1.5.2 ~
tuple shouldBe ("value1", "value3", "value2")
However, since it is now an unordered collection, comparisons between JsObjects are now unordered.
val v1 = Json.obj(
"key1" -> "value1",
"key2" -> "value2",
"key3" -> "value3"
)
val v2 = Json.obj(
"key1" -> "value1",
"key3" -> "value3",
"key2" -> "value2"
)
v1 shouldBe v2
Write be variance
We specified variants for Write; there are no variances for Read because refuel-json uses implicit a lot for codec declaration inclusion.
For example, when it comes to Read[+T], referencing the SubType Read[T] from implicit scope may result in duplicate implicit codecs or unintended conversions automatically.
Therefore, an instance of type Cat can be serialized with Write[Animal], but cannot be deserialized to type Animal with Read[Cat].
To deserialize to Animal type, Read[Animal] (Codec[Animal]) is required.
trait Animal
case class Cat() extends Animal
implicit val animalCodec: Codec[Animal] = ???
implicit val catCodec: Codec[Cat] = ???
// serialize
val json = Cat().ser[Animal](animalCodec)
// deserialize
json.des[Animal](catCodec) // not working
json.des[Animal](animalCodec) // working
json.des[Cat](catCodec) // working
v1.5.1
Fix dependency ranking algorithm.
Fix the definition of dependency priority to provide faster macro compilation.
This fix requires migration of the dependency priorities.
Before
@Inject(Default)
After
@Inject[Default]
Dependency priority has been changed from a constant to a characteristic, so that it is no longer necessary to immediately evaluate and rank the priorities during macro expansion, and the ranking is now done based on the relationship between the priority characteristics.
With this fix, benchmarking per injection with explicit priorities can be done in about 1ms instead of 300~500ms, cutting build time by up to 60%!
v1.4.11
Container#shade
The container shading is done by a scope separated only by the partial application injection in the shading, and the search from the container is done including the container from which the shading originated.
The partially applied injection is not propagated to the shading source container, so it is not referenced outside the shade scope.
inject[A] // Load new symbol
shade { implicit c =>
new AImpl().index[A](Overwrite)
inject[A] // used AImpl only in shade scope.
}
inject[A] // Used already loaded
Container#closed
On the other hand, if you declare a closed scope, existing containers will not be involved at all and will be expanded and searched in the cleared Container.