Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Oct 14 17:07
    scala-steward opened #355
  • Oct 12 18:01
    scala-steward opened #354
  • Oct 09 23:47

    zarthross on master

    Add model of Swagger "Tag Objec… Make it possible to add tag des… Merge pull request #352 from Ra… (compare)

  • Oct 09 23:47
    zarthross closed #352
  • Oct 09 23:47

    zarthross on master

    Add StringParser.map and String… show StringParser.map and rmap … Merge pull request #350 from Ra… (compare)

  • Oct 09 23:47
    zarthross closed #350
  • Oct 09 23:47

    zarthross on master

    Update scala-collection-compat … Merge pull request #351 from sc… (compare)

  • Oct 09 23:47
    zarthross closed #351
  • Oct 09 09:20
    erdeszt opened #353
  • Oct 08 15:24
    RafalSumislawski commented #257
  • Oct 08 15:21
    RafalSumislawski commented #350
  • Oct 08 15:14
    RafalSumislawski commented #350
  • Oct 08 15:11
    RafalSumislawski synchronize #350
  • Oct 08 13:23
    RafalSumislawski commented #350
  • Oct 08 13:22
    RafalSumislawski commented #350
  • Oct 08 10:23
    RafalSumislawski commented #350
  • Oct 08 08:47
    RafalSumislawski opened #352
  • Oct 04 02:10

    zarthross on master

    Update version.sbt (compare)

  • Oct 01 22:48
    scala-steward opened #351
  • Oct 01 19:48
    RafalSumislawski opened #350
for plain routes I would use and method to combine routes, but when I'm using auth middleware, I've to convert them to Http4s HttpRoutes before
I wonder if it's possible.
Darren Gibson
@zarthross
@PawelJ-PL With the way the auth stands in rho right now that doesn't appear to be possible, but I agree it should be. I have 2 WIP prs open now to address authentication, but I haven't been able to decide which approach to take. I'm debating about changing the swagger middleware a little bit though so its easier to combine swagger's in general, so this would become a non-issue either way.
PawelJ-PL
@PawelJ-PL
@zarthross Thank You for clarification. I'll observer both PRs
Guillaume Balaine
@Igosuki
I use separate endpoints for authenticated and non authenticated routes
with Rho
tbh I also think it makes things more explicit
Guillaume Balaine
@Igosuki
Hi guys, I have a quick question. Rho uses the EntityDecoder’s consume MediaType to determine which is the content-type of the post body in the swagger documentation. Except by default a jsonEncoder from http4s will not accept application/* as the content-type, so this makes the swagger doc unusable.
This comes from this code snippet in http4s :
implicit val http4sShowForMediaRange: Show[MediaRange] =
    Show.show(s => s"${s.mainType}/*${MediaRange.extensionsToString(s)}")
We can configure the default content-type in the root swagger doc, but then this is overriden for each operation, where the ‘parameter content-type’ becomes application/* instead of application/json
Darren Gibson
@zarthross
I'm not really understanding the issue... it makes the swagger doc unusable for what? I am not really sure what the issue is since i haven't experienced it. Can you make a little example that reproduces it?
Guillaume Balaine
@Igosuki
Sure
I think it’s because I’m using : EntityDecoder.decodeBy[F, A](MediaType.application.json) { m => as my generic json decoder
and the conte-type set by the swagger doc is application/* so that fails but yeah ok I’ll reproduce
Ross A. Baker
@rossabaker
There are a couple open Sonatype repos with 0.19.0-M8.
I think if the version is changed to -SNAPSHOT until release, this won't happen.
Darren Gibson
@zarthross
@rossabaker I need to work on the release process anyways, so i'll try and take a look again this weekend.
Ross A. Baker
@rossabaker
:+1: The only pain it causes is sonatypeRelease doesn't know what to do on some other repos, but it's not a major issue.
Daniel Incicau
@DanInci
Hey, can you give me an example of how can I define an endpoint with multipart request body?
Daniel Incicau
@DanInci
My endpoint currently looks like this POST / studyRoute / pathVar[StudyID] / emailCsvRoute >>> auth ^ EntityDecoder.multipart but i get "No Type Tag available for org.http4s.multipart.Multipart[F]" error
What am I missing?
Darren Gibson
@zarthross
@DanInci have you tried EntityDecoder.multipart[F] (replace F with whatever Sync type you are using) ?
I've released Rho 0.19.0 based on Http4s 0.20.1.
Daniel Incicau
@DanInci
yes
ebigram
@ebigram
so on the newish side to rho, trying to port over my code from http4s. read whatever I could find on getting circe to play nice with rho libs, but can't recreate auto encoder derivation for even my simplest response types (a List[Map[String,Option[Any]] inside a future)
think I'm missing something basic about the expected response type, or my attempts to resolve implicit ambiguity isn't working
abstract class ClinsparkRoutes[F[+ _] : Effect](swaggerSyntax: SwaggerSyntax[F])(implicit F: Monad[F])
        extends RhoRoutes[F] with CirceInstances {

   import io.circe._
   import io.circe.syntax._
   import io.circe.generic.auto._
ebigram
@ebigram
"Get list of available studies" **
//this works   
GET / "sponsors" / "studies" |>> { () => Ok(studyNames.asJson) }
//this doesn't
    "Get specified dataset for sponsor and study name" **
            GET / "sponsors" / pathVar[String]("sponsor", "name of sponsor") +? param[String]("study") & param[String]("dataset") |>> {
        (sponsorName: String, studyId: String, dataset: String) ⇒ Ok(getTaskFromFuture(getStudiesFromDataset(sponsorName, studyId, dataset)))
the functions in OK(...) just convert from future to task
ebigram
@ebigram
Oh, I think I might have figured it out
Ok() is not quite the same as http4s :P
Daniel Incicau
@DanInci

Hi, I'm having a problem with rho. I have an endpoint that accepts a model that looks like this

case class Value(x: NodeX)

where NodeX is a phantom type over a Float
It looks like rho is unable to create the necessary swagger documentation and spits out this error

INFO  org.http4s.rho.swagger.TypeBuilder -  — Failed to build model for type hfbe.Value 
scala.ScalaReflectionException: type NodeX is not a class

Does anyone know how can i fix this?

Daniel Incicau
@DanInci
The phantom type implementation is actually a shapeless tagged type
Darren Gibson
@zarthross
Hmm, my suggestion would be to use the SwaggerFormats (https://github.com/http4s/rho/blob/master/swagger/src/main/scala/org/http4s/rho/swagger/SwaggerFormats.scala) and manually add the swagger for that type.
Jonas Natten
@jnatten
Hi, I'm trying to upgrade our http4s app from 0.18 to 0.20, which is using rho. However after upgrading Rho to 0.19 i can no longer find the RhoService class. Anything I'm missing?
Darren Gibson
@zarthross
It's named RhoRoutes now to match the http4s conventions
JA
@alcortaj
Hello everyone. I'm on my routes files I'm extending RhoRoutes[IO]. Now I have a file that needs to extend another class and also RhoRoutes but only one class can be extended. If I want to mix more it needs to be traits. Is there a version of RhoRoutes as a trait?
Darren Gibson
@zarthross
@alcortaj There is not a trait version of RhoRoutes at this time.
I don't know that we will ever make RhoRoutes a trait.
Alan Gerber
@akgerber
hello! i have two very similar sets of RhoRoutes in my http4s app, initialized identically, yet only one shows up in the JSON generated: ``` val middleware: RhoMiddleware[IO] = createRhoMiddleware(
apiInfo = Info(title = "Notification Service", version = "5")
)
// Start a server with Rho middleware to generate a Swagger definition
val producer     = KafkaSetup.initializeProducer[EmailKey, EmailRequest](config)
val healthchecks = new Healthchecks(ioSwagger).routes.toRoutes(middleware)
val httpService  = new NotificationHttpService(producer, ioSwagger).routes.toRoutes(middleware)
only httpService's endpoints show up
is parsing multiple sets of routes actually supported? i notice there is only a single set of routes in the demo: https://github.com/http4s/rho/blob/master/examples/src/main/scala/com/http4s/rho/swagger/demo/MyRoutes.scala
Alan Gerber
@akgerber
they will be parsed together if i call .and on the RhoRoutes
This message was deleted
    }.and(
      new Healthchecks[F](swaggerSyntax).routes
    )
}
Darren Gibson
@zarthross
@akgerber The way the system was designed you must combine all Rho routes before you convert to Http4s routes.
What you ended up doing inadvertantly was creating 2 swagger endpoints each with the different set of routes, and one of them took precedence.
meloniasty
@meloniasty

Hi, how can I mix query parameters with json body in rho (I'm using 0.18.4)

"List items" **
    POST / "items" +? paramD[Option[Int]]("limit", "page size") ^jsonOf[IO,Filters] |>> { (limit:Int, filters:Filters) => ... }

Above does not work.