Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Oct 18 15:46
    codecov[bot] commented #898
  • Oct 18 15:46
    julienrf synchronize #898
  • Oct 18 12:25
    codecov[bot] commented #929
  • Oct 18 12:16
    scala-steward opened #929
  • Oct 15 14:33
    codecov[bot] commented #918
  • Oct 15 14:31
    scala-steward synchronize #926
  • Oct 15 14:30
    scala-steward synchronize #918
  • Oct 15 14:30
    scala-steward synchronize #928
  • Oct 15 12:48
    julienrf commented #893
  • Oct 15 12:48
    julienrf commented #893
  • Oct 15 12:45
    julienrf closed #890
  • Oct 15 12:45
    julienrf commented #890
  • Oct 15 12:44

    julienrf on master

    Ujson: decoding floating infini… (compare)

  • Oct 15 12:44
    julienrf closed #893
  • Oct 15 12:36
    codecov[bot] commented #918
  • Oct 15 12:34
    codecov[bot] commented #928
  • Oct 15 12:27
    codecov[bot] commented #918
  • Oct 15 12:27
    scala-steward synchronize #918
  • Oct 15 12:27
    scala-steward synchronize #926
  • Oct 15 12:27
    scala-steward closed #892
Julien Richard-Foy
@julienrf
Maybe something with “consume” in it?
Not sure about “resource” as well as a name, maybe send, and sendAndConsume?
(I’m not sure when exactly the request is sent, maybe it’s not when we call these methods but later?)
Dominic Egger
@GrafBlutwurst
actually good question. I don't know if it's part of the use or the run
I adjusted it just now on the MR to send and sendAndConsume
mhh I would prefer to convey to a user that sendAndConsumeis potentially unsafe. I added a doc-comment for now
Julien Richard-Foy
@julienrf
We need to know whether use sends the request or run sends the request :)
Dominic Egger
@GrafBlutwurst
lemme do some digging
Dominic Egger
@GrafBlutwurst
So reading this (https://github.com/http4s/http4s/blob/main/blaze-client/src/main/scala/org/http4s/blaze/client/BlazeClient.scala), and if I understand Resource correctly it has to be the effect that results from use which does allocate *> use-argument <* release essentially
with sendAndConsume just being use(effect.pure)that makes sense and is potentially dangerous depending on the type of response
the pure http4s dangerous equivalent would be client.run(req).use(IO.pure).flatMap(resp => res.stream.compile.toList) which will result in a empty stream because the underlying resource is already closed If i think this through correctly
Dominic Egger
@GrafBlutwurst
Good Morning @julienrf . I was wondering what does your regimen look like to get CI pipelines green. I saw my MR has some bin compat issues. But i was also wondering what tests you run etc. I'm probably gonna write a small readme for me because I always forget about bincompat
2 replies
Dominic Egger
@GrafBlutwurst
@julienrf we were wondering when you're planning to release the next http4s version for endpoints? We are planning to upgrade to cats3 and are a bit stuck.
Julien Richard-Foy
@julienrf
Hey, thanks for reminding me, I think nothing is blocking, I will cut it ASAP.
Julien Richard-Foy
@julienrf
I’m realizing something: endpoints4s is still on circe 0.13.0. Is it compatible with cats3?
Julien Richard-Foy
@julienrf
Thank you all for the contributions
Dominic Egger
@GrafBlutwurst
Thank you! I hope circe wasn't an issue
Dominic Egger
@GrafBlutwurst
endpoints4s/endpoints4s#874 regarding this. What do we wanna do about the Akka -> FS2 converters? currently they are ripped out from the dependency codebase since that one was hosted on bintray. I can try a source dependency through sbt
Actually I just noticed the move to Cats3 blew that up spectacularily I think we have to come up with an alternative to do the convertions
Dominic Egger
@GrafBlutwurst
regarding the chunked entities MR i see it has conflicts again, is there anything else that has to be addressed @julienrf ?
Julien Richard-Foy
@julienrf
@GrafBlutwurst I’m really sorry, I forgot that it had to be reviewed.
I will have a look soon.
Dominic Egger
@GrafBlutwurst
no worries. at your leisure, we have the changes internal right now so there's no need to hurry. We just try to upstream as much as we can
Julien Richard-Foy
@julienrf
Thank you for your patience! I just went through the diff and left some comments
Dominic Egger
@GrafBlutwurst
thanks! got a ticket for myself to upstream the changes next week. We also got a working multipart implementation for http4s which we'll hopefully upstream soon. I'll also start working on middleware support for the client algebra in a bit (specifically for us it's for logging and metrics). is that something you'd like to have as well?
Julien Richard-Foy
@julienrf
Oh yes, definitely!
Dominic Egger
@GrafBlutwurst
This is what a middleware looks like right now. I just have one issue onDecodeErrori would like to somehow pass the body it failed to decode (e.g a json that would be good to log) but I can't quite figure out how to make that happen. anyone got an idea?
  /**
   * This type is needed since we expose the http4s response as well as it's decoded body. this means the underlying stream will already have been consumed.
   * To avoid Resource exception we need to duplicate the response with an empty body.
   *
   * @param response
   */
  sealed abstract class EmptyBodyResponse[M[_]](
    val response: Http4sResponse[M]
  )

  object EmptyBodyResponse {

    def apply[M[_]](response: Http4sResponse[M]): EmptyBodyResponse[M] =
      new EmptyBodyResponse(response.withEmptyBody) {}
  }

  trait Middleware[M[_], A, B] {
    def onRequestGenerationSuccess(request: A, httpRequest: Http4sRequest[M]): M[Unit]
    def onRequestGenerationFailure(request: A, throwable: Throwable): M[Unit]
    def onResponseSuccess(
      request: A,
      httpRequest: Http4sRequest[M],
      httpResponse: EmptyBodyResponse[M],
      response: B
    ): M[Unit]
    def onNetworkError(request: A, httpRequest: Http4sRequest[M], throwable: Throwable): M[Unit]
    def onResponseError(
      request: A,
      httpRequest: Http4sRequest[M],
      httpResponse: EmptyBodyResponse[M],
      throwable: Throwable
    ): M[Unit]
    def onDecodeError(
      request: A,
      httpRequest: Http4sRequest[M],
      httpResponse: EmptyBodyResponse[M],
      throwable: Throwable
    ): M[Unit]
  }
1 reply
Dominic Egger
@GrafBlutwurst
@julienrf so I am working on your feedback and we have a problem. Upgrade to Cats3 pretty much killed the code that I inlined for converting between akka and fs2. Do you have a good idea or know a library that does that? In the meantime I'll see if i can rewrite it to cats3
6 replies
Dominic Egger
@GrafBlutwurst
MR feedback addressed, I'm sorry for my terrible grammar :bow:
4 replies
Albert Millert
@amillert

Could You please provide a minimal build.sbt configuration for recreating examples from the documentation/examples directory? It seems like I'm not able to find the right version for xhr-client despite using the version specified in the release notes on gh.

val endpoints = Seq(
  "org.endpoints4s" %% "algebra"             % "1.5.0",
  "org.endpoints4s" %% "openapi"             % "3.1.0",
  "org.endpoints4s" %% "json-schema-generic" % "1.5.0",
  "org.endpoints4s" %% "json-schema-circe"   % "1.5.0",
  "org.endpoints4s" %% "akka-http-server"    % "5.1.0",
  "org.endpoints4s" %% "scalaj-client"       % "3.1.0",
  "org.endpoints4s" %% "xhr-client"          % "3.1.0"
)

I'm trying to find the right configuration with the CrossProject (JSPlatform, JVMPlatform) but I'm not sure if it's the right direction...

I'd really appreciate some help!

Julien Richard-Foy
@julienrf
Hello @amillert, which error do you see?
You should use triple-percent, not double-percent: "org.endpoints4s" %%% "algebra" % "1.5.0"
(on all the dependencies)
Albert Millert
@amillert
Hey @julienrf, thanks a lot for the quick reply. The error I'm getting is:
Oct 04, 2021 7:53:48 AM org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint notify
INFO: Unsupported notification method: $/setTrace
2021.10.04 07:53:48 INFO  [warn] 
2021.10.04 07:53:48 INFO  [warn]     Note: Unresolved dependencies path:
2021.10.04 07:53:48 INFO  [error] sbt.librarymanagement.ResolveException: Error downloading org.endpoints4s:xhr-client_2.13:3.1.0
2021.10.04 07:53:48 INFO  [error]   Not found
2021.10.04 07:53:48 INFO  [error]   Not found
2021.10.04 07:53:48 INFO  [error]   not found: /home/devmood/.ivy2/localorg.endpoints4s/xhr-client_2.13/3.1.0/ivys/ivy.xml
2021.10.04 07:53:48 INFO  [error]   not found: https://repo1.maven.org/maven2/org/endpoints4s/xhr-client_2.13/3.1.0/xhr-client_2.13-3.1.0.pom
2021.10.04 07:53:48 INFO  [error]     at lmcoursier.CoursierDependencyResolution.unresolvedWarningOrThrow(CoursierDependencyResolution.scala:258)
2021.10.04 07:53:48 INFO  [error]     at lmcoursier.CoursierDependencyResolution.$anonfun$update$38(CoursierDependencyResolution.scala:227)
2021.10.04 07:53:48 INFO  [error]     at scala.util.Either$LeftProjection.map(Either.scala:573)
2021.10.04 07:53:48 INFO  [error]     at lmcoursier.CoursierDependencyResolution.update(CoursierDependencyResolution.scala:227)
2021.10.04 07:53:48 INFO  [error]     at sbt.librarymanagement.DependencyResolution.update(DependencyResolution.scala:60)
2021.10.04 07:53:48 INFO  [error]     at sbt.internal.LibraryManagement$.resolve$1(LibraryManagement.scala:59)
2021.10.04 07:53:48 INFO  [error]     at sbt.internal.LibraryManagement$.$anonfun$cachedUpdate$12(LibraryManagement.scala:133)
2021.10.04 07:53:48 INFO  [error]     at sbt.util.Tracked$.$anonfun$lastOutput$1(Tracked.scala:73)
2021.10.04 07:53:48 INFO  [error]     at sbt.internal.LibraryManagement$.$anonfun$cachedUpdate$20(LibraryManagement.scala:146)
2021.10.04 07:53:48 INFO  [error]     at scala.util.control.Exception$Catch.apply(Exception.scala:228)
2021.10.04 07:53:48 INFO  [error]     at sbt.internal.LibraryManagement$.$anonfun$cachedUpdate$11(LibraryManagement.scala:146)
2021.10.04 07:53:48 INFO  [error]     at sbt.internal.LibraryManagement$.$anonfun$cachedUpdate$11$adapted(LibraryManagement.scala:127)
2021.10.04 07:53:48 INFO  [error]     at sbt.util.Tracked$.$anonfun$inputChangedW$1(Tracked.scala:219)
2021.10.04 07:53:48 INFO  [error]     at sbt.internal.LibraryManagement$.cachedUpdate(LibraryManagement.scala:160)
2021.10.04 07:53:48 INFO  [error]     at sbt.Classpaths$.$anonfun$updateTask0$1(Defaults.scala:3670)
2021.10.04 07:53:48 INFO  [error]     at scala.Function1.$anonfun$compose$1(Function1.scala:49)
2021.10.04 07:53:48 INFO  [error]     at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62)
2021.10.04 07:53:48 INFO  [error]     at sbt.std.Transform$$anon$4.work(Transform.scala:68)
2021.10.04 07:53:48 INFO  [error]     at sbt.Execute.$anonfun$submit$2(Execute.scala:282)
2021.10.04 07:53:48 INFO  [error]     at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:23)
2021.10.04 07:53:48 INFO  [error]     at sbt.Execute.work(Execute.scala:291)
2021.10.04 07:53:48 INFO  [error]     at sbt.Execute.$anonfun$submit$1(Execute.scala:282)
2021.10.04 07:53:48 INFO  [error]     at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
2021.10.04 07:53:48 INFO  [error]     at sbt.CompletionService$$anon$2.call(CompletionService.scala:64)
2021.10.04 07:53:48 INFO  [error]     at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
2021.10.04 07:53:48 INFO  [error]     at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
2021.10.04 07:53:48 INFO  [error]     at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
2021.10.04 07:53:48 INFO  [error]     at java.base/java.util.concurrent
Julien Richard-Foy
@julienrf
Do you still get the error after switching to %%%?
Albert Millert
@amillert
Honestly, I'm not allowed to use triple-percent in my Dependencies.scala file: value %%% is not a member of String.
Julien Richard-Foy
@julienrf
Albert Millert
@amillert
All right. Thanks a lot for Your help! Will check it later today.
Albert Millert
@amillert

Ok I tried to replace %% with %%% almost everywhere. Exceptions mentioned below.

Now about the xhr-client dependency; the correct reference in maven is:

https://repo1.maven.org/maven2/org/endpoints4s/xhr-client_sjs1_2.13/3.1.0/xhr-client_sjs1_2.13-3.1.0.pom

If i specify:

lazy val client =
  crossProject(JSPlatform, JVMPlatform)
    .crossType(CrossType.Pure)
    .settings(
      name := "client",
      libraryDependencies ++= Seq(
        "org.endpoints4s" %%% "xhr-client" % "3.1.0"
        // "org.endpoints4s"  %% "scalaj-client" % "3.1.0"
      )
    )
    .dependsOnLocalCrossProjects("common")

I get error:

not found: https://repo1.maven.org/maven2/org/endpoints4s/xhr-client_2.13/3.1.0/xhr-client_2.13-3.1.0.pom

The %% seems to be needed for both scalaj-client and akka-http-server. Otherwise sjs suffix is appended.

Since I used %%% for xhr-client; to my understanding it should have added suffix sjs.

If I replace xhr-client with xhr-client_sjs1 (I know I ought not to do it. But let's say for the sake of argument...

The error I get this time is:

not found: https://repo1.maven.org/maven2/org/endpoints4s/xhr-client_sjs1_sjs1_2.13/3.1.0/xhr-client_sjs1_sjs1_2.13-3.1.0.pom

The suffix has appeared... Do You have an idea, what should I do instead for the sbt to find the dependency correctly?

Dominic Egger
@GrafBlutwurst
@julienrf saw that you assigned the PR to yourself. did i break something? :see_no_evil:
2 replies
Julien Richard-Foy
@julienrf
@amillert I don’t think you want client to be a cross-project. It should be just a Scala.js project. You should be able to reuse the build definition shown here: https://endpoints4s.github.io/quick-start.html
Dominic Egger
@GrafBlutwurst
@julienrf I was wondering what causes OpenApi generator to inline vs reference a schema? e.g. when we do genericRecord[X] it appears as a reference in the openapi vs when we do field().....xmap(X.apply) it gets inlined and not referenced.
Julien Richard-Foy
@julienrf
It appears as a reference if it is named
genericRecord always name its schemas
Dominic Egger
@GrafBlutwurst
saw the MR feedback, not sure I'll get to it today, but will do ASAP
Dominic Egger
@GrafBlutwurst
@julienrf can you point out to me how the documentation is generated? I am sadly very time constrained but wanna get that PR across the finish line so I'd be glad for a bit of help to avoid having to spend a lot of time to figure it out.
3 replies