Skip to content

Commit

Permalink
Rename traits to include Tapir prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
adamw committed Mar 23, 2019
1 parent 7cf1a49 commit afa5ab9
Show file tree
Hide file tree
Showing 14 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import com.softwaremill.sttp.{Request, Uri}
import tapir.Endpoint
import tapir.typelevel.ParamsAsArgs

trait SttpClient {
trait TapirSttpClient {
implicit class RichEndpoint[I, E, O, S](e: Endpoint[I, E, O, S]) {
def toSttpRequest(baseUri: Uri)(implicit paramsAsArgs: ParamsAsArgs[I],
clientOptions: SttpClientOptions): paramsAsArgs.FN[Request[Either[E, O], S]] =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package tapir.client

package object sttp extends SttpClient
package object sttp extends TapirSttpClient
8 changes: 4 additions & 4 deletions doc/mytapir.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ a single-import whenever you want to use tapir. For example:

```scala
object MyTapir extends Tapir
with AkkaHttpServer
with SttpClient
with CirceJson
with OpenAPICirceYaml
with TapirAkkaHttpServer
with TapirSttpClient
with TapirCirceJson
with TapirOpenAPICirceYaml
```

Then, a single `import MyTapir._` and all Tapir data types and extensions methods will be in scope!
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package tapir.docs.openapi
import tapir.Endpoint
import tapir.openapi.{Info, OpenAPI}

trait OpenAPIDocs {
trait TapirOpenAPIDocs {
implicit class RichOpenAPIEndpoint[I, E, O, S](e: Endpoint[I, E, O, S]) {
def toOpenAPI(title: String, version: String)(implicit options: OpenAPIDocsOptions): OpenAPI = toOpenAPI(Info(title, version))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package tapir.docs
import tapir.{Codec, CodecForMany, CodecForOptional, EndpointInput}
import tapir.openapi.{ExampleValue, SecurityScheme}

package object openapi extends OpenAPIDocs {
package object openapi extends TapirOpenAPIDocs {
private[openapi] type SchemeName = String
private[openapi] type SecuritySchemes = Map[EndpointInput.Auth[_], (SchemeName, SecurityScheme)]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import io.circe.{Decoder, Encoder}
import tapir.Codec.JsonCodec
import tapir.SchemaFor

trait JsonCirce {
trait TapirJsonCirce {
implicit def encoderDecoderCodec[T: Encoder: Decoder: SchemaFor]: JsonCodec[T] = new JsonCodec[T] {
override def encode(t: T): String = t.asJson.noSpaces
override def decode(s: String): DecodeResult[T] = io.circe.parser.decode[T](s) match {
Expand Down
2 changes: 1 addition & 1 deletion json/circe/src/main/scala/tapir/json/circe/package.scala
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package tapir.json

package object circe extends JsonCirce
package object circe extends TapirJsonCirce
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import tapir.openapi.circe._
import io.circe.syntax._
import io.circe.yaml.Printer

trait OpenAPICirceYaml {
trait TapirOpenAPICirceYaml {
implicit class RichOpenAPI(openAPI: OpenAPI) {
def toYaml: String = Printer(dropNullKeys = true, preserveOrder = true).pretty(openAPI.asJson)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package tapir.openapi.circe

package object yaml extends OpenAPICirceYaml
package object yaml extends TapirOpenAPICirceYaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import io.circe.syntax._
import io.circe.{Encoder, Json}
import tapir.openapi.OpenAPI.ReferenceOr

package object circe extends Encoders
package object circe extends TapirOpenAPICirceEncoders

trait Encoders {
trait TapirOpenAPICirceEncoders {
// note: these are strict val-s, order matters!

implicit def encoderReferenceOr[T: Encoder]: Encoder[ReferenceOr[T]] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import tapir.internal.{ParamsToSeq, SeqToParams}

import scala.concurrent.{ExecutionContext, Future}

trait AkkaHttpServer {
trait TapirAkkaHttpServer {
implicit class RichAkkaHttpEndpoint[I, E, O](e: Endpoint[I, E, O, AkkaStream]) {
def toDirective[T](implicit paramsToTuple: ParamsToTuple.Aux[I, T], akkaHttpOptions: AkkaHttpServerOptions): Directive[T] =
new EndpointToAkkaServer(akkaHttpOptions).toDirective(e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ package tapir.server
import akka.stream.scaladsl.Source
import akka.util.ByteString

package object akkahttp extends AkkaHttpServer {
package object akkahttp extends TapirAkkaHttpServer {
type AkkaStream = Source[ByteString, Any]
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import tapir.Endpoint
import tapir.internal.{ParamsToSeq, SeqToParams}
import tapir.typelevel.{ParamsAsArgs, ReplaceFirstInFn}

trait Http4sServer {
trait TapirHttp4sServer {
implicit class RichHttp4sHttpEndpoint[I, E, O, F[_]](e: Endpoint[I, E, O, EntityBody[F]]) {
def toRoutes[FN[_]](logic: FN[F[Either[E, O]]])(implicit paramsAsArgs: ParamsAsArgs.Aux[I, FN],
serverOptions: Http4sServerOptions[F],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package tapir.server

package object http4s extends Http4sServer {
package object http4s extends TapirHttp4sServer {
private[http4s] type Error = String
}

0 comments on commit afa5ab9

Please sign in to comment.