Skip to content

Commit

Permalink
Merged all cats integrations in single package
Browse files Browse the repository at this point in the history
  • Loading branch information
matwojcik committed Jul 21, 2020
1 parent 1297897 commit d9e80eb
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 16 deletions.
9 changes: 5 additions & 4 deletions doc/endpoint/integrations.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@

## Cats datatypes integration

The `tapir-cats` module contains schema, validator and codec instances for some [cats](https://typelevel.org/cats/)
datatypes:
The `tapir-cats` module contains additional instances for some [cats](https://typelevel.org/cats/)
datatypes as well as additional syntax:

```scala
"com.softwaremill.sttp.tapir" %% "tapir-cats" % "0.16.5"
```

See the `sttp.tapir.codec.cats.TapirCodecCats` trait or `import sttp.tapir.codec.cats._` to bring the implicit values
into scope.
- `import sttp.tapir.integ.cats.codec._` - brings schema, validator and codec instances
- `import sttp.tapir.integ.cats.syntax._` - brings additional syntax for `tapir` types


## Refined integration

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package sttp.tapir.monad.cats
package sttp.tapir.integ.cats

import cats.~>
import sttp.tapir.monad.MonadError
Expand All @@ -21,3 +21,5 @@ trait MonadErrorSyntax {
}
}
}

object MonadErrorSyntax extends MonadErrorSyntax
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import sttp.tapir.server.ServerEndpoint
trait ServerEndpointSyntax {
implicit class ServerEndpointImapK[I, E, O, S, F[_]](endpoint: ServerEndpoint[I, E, O, S, F]) {

import sttp.tapir.monad.cats.syntax._
import MonadErrorSyntax._

def imapK[G[_]](fk: F ~> G)(gK: G ~> F): ServerEndpoint[I, E, O, S, G] =
endpoint.copy(logic = monadError => i => fk(endpoint.logic(monadError.imapK(gK)(fk))(i)))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package sttp.tapir.codec.cats
package sttp.tapir.integ.cats

import cats.data.{NonEmptyChain, NonEmptyList, NonEmptySet}
import sttp.tapir.{Schema, SchemaType}
import sttp.tapir._

import scala.collection.immutable.SortedSet
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package sttp.tapir.integ.cats

object codec extends TapirCodecCats
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package sttp.tapir.integ.cats

object syntax extends ServerEndpointSyntax
object syntax extends ServerEndpointSyntax with MonadErrorSyntax


This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package sttp.tapir.codec.cats
package sttp.tapir.integ.cats

import cats.data.{NonEmptyChain, NonEmptyList, NonEmptySet}
import org.scalacheck.{Arbitrary, Gen}
Expand All @@ -8,6 +8,7 @@ import org.scalacheck.Arbitrary.arbString
import sttp.tapir.SchemaType.{SArray, SString}
import sttp.tapir.{Codec, CodecFormat, DecodeResult, Schema, Validator}
import sttp.tapir.internal._
import codec._

import scala.collection.immutable.SortedSet

Expand Down

0 comments on commit d9e80eb

Please sign in to comment.