Skip to content

Commit

Permalink
Merge pull request #673 from matwojcik/cats-rename
Browse files Browse the repository at this point in the history
Move sttp.tapir.cats -> sttp.tapir.integ.cats to resolve cats conflict after importing sttp._
  • Loading branch information
adamw authored Jul 21, 2020
2 parents 3264b4a + d9e80eb commit 411024a
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 21 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
5 changes: 0 additions & 5 deletions integrations/cats/src/main/scala/sttp/tapir/cats/syntax.scala

This file was deleted.

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
@@ -1,12 +1,12 @@
package sttp.tapir.cats
package sttp.tapir.integ.cats

import cats.~>
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
@@ -0,0 +1,5 @@
package sttp.tapir.integ.cats

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 411024a

Please sign in to comment.