Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Nov 29 20:58
    codecov[bot] commented #965
  • Nov 29 20:41
    scala-steward opened #965
  • Nov 29 14:35
    julienrf commented #889
  • Nov 29 14:32
    harpocrates commented #889
  • Nov 28 18:40
    ptrdom commented #964
  • Nov 28 18:28
    ptrdom opened #964
  • Nov 28 11:52
    julienrf closed #958
  • Nov 28 11:48

    julienrf on master

    Scala.js client interpreter bas… (compare)

  • Nov 28 11:48
    julienrf closed #934
  • Nov 28 11:48
    julienrf closed #287
  • Nov 28 11:45
    codecov[bot] commented #934
  • Nov 28 11:34
    codecov[bot] commented #934
  • Nov 28 11:34
    ptrdom synchronize #934
  • Nov 28 10:59
    ptrdom review_requested #934
  • Nov 28 09:31
    codecov[bot] commented #934
  • Nov 28 09:19
    codecov[bot] commented #934
  • Nov 28 09:19
    ptrdom synchronize #934
  • Nov 28 09:07
    codecov[bot] commented #934
  • Nov 28 09:07
    ptrdom synchronize #934
  • Nov 27 19:59
    julienrf synchronize #963
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.
19 replies
Domantas Petrauskas
@ptrdom
Having some issues locally setting up the endpoints4s project. Seems like IntelliJ (2021.2.3) does not want to load TuplerAppend and throws errors while compiling. After a switch to using sbt shell, project code does compile, but IntelliJ still shows errors as if TuplerAppend did not exist. Should I just give up on trying to setup proper development environment with IntelliJ, or do you @julienrf have any tips?
7 replies
Milos Nedeljkovic
@minedeljkovic
@julienrf regarding https://github.com/endpoints4s/endpoints4s/pull/879#discussion_r742882086, I was already thinking about separate primitive (type) for this, but was afraid the change might be to disruptive. Now that I've seen your comment I'm encouraged to experiment with it :)
Dominic Egger
@GrafBlutwurst

@julienrf https://github.com/rivero-ag/endpoints4s/blob/fix-missing-handle-client-error/http4s/server/src/main/scala/endpoints4s/http4s/server/Endpoints.scala#L106 we encountered an issue with our custom MultipartAlgebra for http4s (and I'm lobbying hard that we're upstreaming that soon) where i had to recover on creating the multipart request with handleClientError because it failed where i inserted it now in the Endpoints implementation.

Did we design our algebra wrong or did we just miss an error case there in the implementation? If it's the latter I'll open up an MR based on this

Julien Richard-Foy
@julienrf
@GrafBlutwurst I am tempted to say that there is a design issue, because client errors should not be handled here
But I might totally be wrong
Dominic Egger
@GrafBlutwurst
right. ah well i got it fixed by just handling it on the multipart request. feels a bit redundant tho. not sure i can't really put my finger on it
Julien Richard-Foy
@julienrf
Yeah, that feels a bit redundant. I see that it’s what the JsonEntities implementation also does. So, I think this is correct, even though redundant. This could probably be improved.
Dominic Egger
@GrafBlutwurst
maybe just do it on the request constructors? good question actually