Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • May 13 22:40
    scala-steward closed #683
  • May 13 22:40
    scala-steward commented #683
  • May 13 22:40
    scala-steward opened #684
  • Apr 27 11:50
    hughlunt commented #492
  • Apr 21 08:50
    scala-steward closed #681
  • Apr 21 08:50
    scala-steward commented #681
  • Apr 21 08:50
    scala-steward opened #683
  • Apr 07 14:52
    scala-steward opened #682
  • Apr 07 03:14
    scala-steward closed #677
  • Apr 07 03:14
    scala-steward commented #677
  • Apr 07 03:14
    scala-steward opened #681
  • Apr 05 02:46
    scala-steward closed #675
  • Apr 05 02:46
    scala-steward commented #675
  • Apr 05 02:46
    scala-steward opened #680
  • Apr 04 16:35
    scala-steward closed #660
  • Apr 04 16:35
    scala-steward commented #660
  • Apr 04 16:35
    scala-steward opened #679
  • Apr 04 10:32
    scala-steward opened #678
  • Apr 02 13:05
    scala-steward closed #661
  • Apr 02 13:05
    scala-steward commented #661
Darren Gibson
@zarthross
Should be hitting maven central soon.
Guillaume Balaine
@Igosuki
nice
Tom Poczos
@TomPoczos
Hi, thought I'd ask if I'm going in a wrong direction. Refactoring a class that creates RhoRoutes so that it takes an F[_] instead of IO. Is RhoRoutes suitable for that? I guess it is, although all the example code / documentation uses IO. The reason I'm asking for is I have a route that returns different status codes based on some intermediate results and it works fine with IO but I can't get it to be of the required F[Result[...]] type with F[_]:ConcurrentEffect, instead it just defaults to Any As far as Intellij's shw implicits feature goes I can't see any difference. My ConcurrentEffect is being picked up instead of ioEffect which seems to be fine.
Guillaume Balaine
@Igosuki
@TomPoczos I have en entire App written with F
Yes with the latest Scala 2.12 and Http4s simply returning Ok or BadRequest won’t work anymore
Tom Poczos
@TomPoczos
@Igosuki thanks for the reply. Are you saying that it's a bug? Do you know of any workarounds or should I just give up on the idea to parametrize on F[_] instead of IO for now?
I mean, all over the documentation Ok & etc. are returned. Then again, all the documentation also appears to be using IO which works for me too
Christopher Davenport
@ChristopherDavenport
Have you tried F[+_]
Tom Poczos
@TomPoczos
@ChristopherDavenport doesn't work, just tried it. Anyway, I'm stuck with divergent implicits (confused myself a bit there, thought there's another error also occurring when trying to do this, but can't reproduce it any more), and for that at least I'm told there is an explanation at http4s/rho#292 ...not of much help since I can't get either of the proposed workarounds working. But at least I know it shouldn't be this way :)
Tom Poczos
@TomPoczos
@ChristopherDavenport thanks for your suggestion, together with some other changes (wrong cats import) it solved my issue
Darren Gibson
@zarthross
Rho 0.20.0 based on Http4s 0.21.0 has been released. (Should be rolling out to maven central now)
Eric Meisel
@etspaceman

Hello there. Is it possible to get this feature backported to the 0.19.x releases series? We are stuck using the 0.20.x Http4s series right now, and we're trying to build some functionality that depends on the content-type headers:

http4s/rho#359

Happy to open a PR against a branch if one is opened for me.

Eric Meisel
@etspaceman
I was able to open a PR against my own fork here to give an example: etspaceman/rho#1
If someone could help me out with a branch in the origin upstream, that would be helpful
Eric Meisel
@etspaceman

@zarthross is this something you can help me out with? We're using Rho internally but this is kind of a roadblock for us. We want to have a route support multiple content-types (e.g. json and proto), and we want to use the content-type header to control that. The Swagger document will unfortunately not work properly for this use case without that backport.

We are using 0.19.x because our team is still supporting Scala 2.11 at this time (and that cannot be changed until other vendor changes are completed).

Fredy Captuayo
@fredycaptuayo_gitlab

Hello, I updated ther dependencies in my project,
cats-core = 2.1.1
cats-effect = 2.1.2
rho-swagger = 0.20.0
http4s-blaze-server = 0.21.0

now, I have a problem in start the project, the error is

Could not find an instance of Applicative for [x]F[x]
[error]       server <- BlazeServerBuilder[F]
[error]              ^

Any suggestions to solve this error?, The code is this


import cats.effect.{ConcurrentEffect, ContextShift, ExitCode, IO, IOApp, Resource, Timer}
import co.yyyy.xxxxAPI
import org.http4s.server.Server
import org.http4s.server.blaze.BlazeServerBuilder

object Main extends IOApp {
  def run(args: List[String]): IO[ExitCode] =
    AppServer.create.use(_ => IO.never).as(ExitCode.Success)
}

object AppServerSwagger {
  def create[F[+_]: ConcurrentEffect: ContextShift: Timer]: Resource[F, Server[F]] =
    for {
      server <- BlazeServerBuilder[F]
        .withHttpApp(xxxxAPI[F].httpApi)
        .bindLocal(8085)
        .resource
    } yield server
}

Any error message

[error]  found   : cats.effect.Resource[[x]F[x],Nothing]
[error]  required: cats.effect.Resource[F,org.http4s.server.Server[F]]
[error]       config <- Resource.liftF(parser.decodePathF[F, DefaultConfig]("app"))
[error]              ^
Darren Gibson
@zarthross
@fredycaptuayo_gitlab It's because your ConcurrentEffect is defined using a F[+_]... its messing with the compiler inference. I suggest constructing your Rho parts in a separate function and passing it to the create so you can make create take a F[_] instead.
Darren Gibson
@zarthross
@etspaceman I'm open to a PR of the backport, here is a branch you can PR against: https://github.com/http4s/rho/tree/v0.19. I'll keep a lookout for your PR.
Eric Meisel
@etspaceman
Perfect, thanks Darren! I will submit that today
Eric Meisel
@etspaceman
@zarthross I have created the PR of the backport, sorry for the wait
Eric Meisel
@etspaceman
image.png
Hello there. Quick question. Are pathVars not supported like query params in terms of Enums? See above. Both use a StringParser based on an Enumeratum enum, but the path param comes through odd
this is on 0.19.1
implicit def producerTypeStringParser[F[_]]: StringParser[F, ProducerType] =
    new StringParser[F, ProducerType] {
      override def parse(
          s: String
        )(implicit F: Monad[F]
        ): ResultResponse[F, ProducerType] =
        try SuccessResponse(ProducerType.withName(s))
        catch {
          case _: NoSuchElementException =>
            FailureResponse.pure[F] {
              BadRequest.pure(s"Invalid ProducerType format: '$s'")
            }
        }
      override val typeTag: Option[TypeTag[ProducerType]] = Some(
        implicitly[TypeTag[ProducerType]]
      )
    }
This is my StringParser FWIW
Kaspar Fischer
@hbf
Hey folks, I'm doing val myIdsList = paramD[List[Long]]("myIds", "Some ids") which works as expected: it parses ?myIds=1&myIds=2 to a List[Long]. However, how can I use my own StringParser[IO, List[Long]] instead of QueryParsers.multipleParse? I'd like to manually parse ?myIds=1,2 to List[Long].
Kaspar Fischer
@hbf

The above came up during an upgrade from v0.19.0 to v0.20.0 where I noticed that suddenly, our custom StringParser[IO, List[Long]] wasn't picked up and instead, QueryParsers.multipleParse was being used.

What I see is that v0.19.0's multiParse() is defined for Seq[_] while v0.20.0's multiParse() is defined for generic B[_].

I also see that QueryParsers.standardCollector and QueryParsers.multiParse are defined in the same scope. Would it help here if standardCollector had higher priority than multiParse()?

Kaspar Fischer
@hbf
Just in case it helps anyone running into a similar problem. I managed to override the default multiParse by defining the following:
  implicit def http4sMultipleParseOverride[A](
    implicit F: Monad[IO],
    p: StringParser[IO, List[A]],
    cbf: Factory[A, List[A]]
  ): QueryParser[IO, List[A]] =
    standardCollector[List[A]](F, p)
Igor Cândido
@IgorCandido
Is there a way to add example/examples to response models without having to manually defining the response model through withSerializers?
Darren Gibson
@zarthross
Not at this time, but it would be a useful feature. Feel free to add a Issue or PR !
Anton Solovyev
@Rosteelton
Hi all! Is there a way to get field names in snake_case in openapi?
ravichax
@ravichax
Hi All, does anyone have examples of the use of genericHeaderCapture to capture generic headers of the form x-custom-header for a Rho route?
Ben List
@listba
Does the latest version of Rho work with the v1.0.0-M3 release of http4s?
Gavin Bisesi
@Daenyth
:wave: What's the plan for the future of the DSL given that symbol literals are deprecated?
Rafał Sumisławski
@RafalSumislawski
Hi @Daenyth
As an alternative to 'foo we've introduced pv"foo". pv stands for pathVar.
You can see an example here https://github.com/http4s/rho/blob/master/examples/src/main/scala/com/http4s/rho/swagger/demo/MyRoutes.scala#L45
Gavin Bisesi
@Daenyth
:+1:
Yotam Hochman
@Yotamho
Hi, I started to use rho and see that when I create a RhoRoutes, I get a logger from it
is there any convenient way to use a different logger (scalalogging's one) but still using the variable name logger ?
Rafał Sumisławski
@RafalSumislawski

Hi @Yotamho
You cloud copy the source of RhoRoutes, and have your own version with the logger field removed. That's what I would do.

Among other options you can also create a block { } inside your class extending RhoRoutes. And while you cannot create a 'logger' field in the class, you can create a val logger in the block, which will shadow the logger field inherited from RhoRoutes. You would then have to put all your code using the logger inside that block. That would work as long as you don't plan having any public members in that class (you can't put public members in the block). It's a bit hacky :P

Kingsley Hendrickse
@kingsleyh
hi - for a List[Long] as the payload in a POST request - it's generating this yaml - which looks incorrect - any ideas on how to solve this?
 - in: "body"
        name: "body"
        description: "List«Long»"
        required: true
        schema:
          type: "array"
          items:
            title: "Long"
            $ref: "#/definitions/Long"
Gavin Bisesi
@Daenyth
that A+circumflex looks like mojibake
are you sure you're generating utf-8 yaml and viewing the file as utf-8
I think that specific character indicates your yaml file might actually be Latin-1 instead of utf-8
If not that, then the inverse
Or CP1252, which is almost the same as Latin-1
Kingsley Hendrickse
@kingsleyh
the items part seems wrong tho
in the doc it makes a list of empty object