cornerman / covenant Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
I am experimenting if we can use protobuf for serialization with covenant. I have created implicit chameleon Serde for argument as well as return types. But looks like that is not enough. I get the following error
could not find implicit value for parameter deserializer: chameleon.Deserializer[_sloth_SequenceFeeder_feed,java.nio.ByteBuffer]
Error does not tell me for which type a deserializer is missing. I am assuming that only argument and return types of the are required.
We are using circe for serialization. It's working fine but we are getting response header as Content-Type: text/plain
We want response header to be 'content-type-application/json'. We tried setting header with responseWithHeaders() method. But akka http is giving error - Explicitly set HTTP header 'Content-Type: application/json' is ignored, explicit 'Content-Type' header is not allowed. Set 'HttpResponse.entity.contentType' instead.
But we don't have handle of response entity.
Any way to solve this?
I am trying to implement a simple request call.
object CovenantBackend {
type Event = String
type State = String
case class ApiError(msg: String)
object Dsl extends ApiDsl[Event, ApiError, State] {
override def applyEventsToState(state: State, events: Seq[Event]): State = state + "" + events.mkString(",")
override def unhandledException(t: Throwable): ApiError = ApiError(t.getMessage)
}
object ApiImpl extends Api[Dsl.ApiFunction] {
import Dsl._
override def getTrue: ApiFunction[Boolean] = Action(true)
}
}
but I get this error:
overloaded method value apply with alternatives:
[error] [T](f: => scala.concurrent.Future[covenantBackend.CovenantBackend.Dsl.ApiData.Action[T]])(implicit ec: scala.concurrent.ExecutionContext)covenantBackend.CovenantBackend.Dsl.ApiFunction[T] <and>
[error] [T](f: covenantBackend.CovenantBackend.State => scala.concurrent.Future[covenantBackend.CovenantBackend.Dsl.ApiData.Action[T]])(implicit ec: scala.concurrent.ExecutionContext)covenantBackend.CovenantBackend.Dsl.ApiFunction[T]
[error] cannot be applied to (Boolean)
[error] override def getTrue: ApiFunction[Boolean] = Action(true)
I created a small repo where we can
sbt "runMain streaming.StreamingServer"
sbt "runMain streaming.JvmStreamingApp"
.Even after I disconnect the client (ctrl-C), I see that server keeps producing the values and stream is not closed.
Is it expected? Should the server not close the Monix stream automatically once client is gone?
Someone could tell me, please, What is wrong with this code?
https://gist.github.com/elyphas/a252ef08231648df85c10d30007f3905
The error is this:
could not find implicit value for parameter serializer:
chameleon.Serializer[Either[String,List[spatutorial.shared.GralDataPedido]],java.nio.ByteBuffer]
[error]
val router = Router[ByteBuffer, Dsl.ApiFunction].route[Api[Dsl.ApiFunction]](ApiImpl)
Hi @cornerman, thanks a lot for this nice library. If you got around to doing a release that is available on Maven Central, I'd really appreciate it.
I can't find how to disable the logger, covenant show me a lot of data in the client and in the server related to results
I am trying to update some libraries:
I need to update this because errors happens with another library:
//val scribe = dep("com.outr" %%% "scribe" % "2.7.13")
val scribe = dep("com.outr" %%% "scribe" % "3.0.4")
and this because some compatibility with outwatch
:
val scalajs = new {
val dom = dep("org.scala-js" %%% "scalajs-dom" % "2.0.0")
}
but I am getting some errors when I do it.
[error] /home/elyphas/Prjs/mycelium/mycelium/js/src/main/scala/core/JsMessageBuilder.scala:40:33: type mismatch;
[error] found : Function1[org.scalajs.dom.UIEvent,promise.type] (in scala)
[error] required: Function1[org.scalajs.dom.ProgressEvent,_] (in scala.scalajs.js)
[error] reader.onload = (_:UIEvent) => {
[error] ^
this seems because jump from 1.0.0
to 2.0.0
on scalajs-dom
.
Any idea, please
JVMClient is working as expected, but JSClient is giving us CORS error.
I guess adding Access-Control-Allow-Origin: * header in client request should fix it but could not find a way in the API to do so.
I have an error:
WSCovenant.scala:28:40: could not find implicit value for parameter deserializer: chameleon.Deserializer[Either[String,List[GralDataPedido]],java.nio.ByteBuffer]
[error] val api = client.sendWithDefault.wire[Api[Future]]
WebService.scala:59:84: could not find implicit value for parameter serializer: chameleon.Serializer[Either[String,List[GralDataPedido]],java.nio.ByteBuffer]
[error] val router = Router[ ByteBuffer, Dsl.ApiFunction ].route[ Api[ Dsl.ApiFunction ]]( ApiImpl )
When I try to use the java.util.Date
type in my case class
Any idea to solve this?
Thanks in advance!
Maybe grpc-compatible?
https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md
Covenant looks awesome!
Are you also planning to support streaming API like gRPC?
I see that the project has Monix
dependency but unable to wrap my head around how to write the most general streaming API like this:
def fun[T](input: Observable[T]): Observable[T]
I looked at the HttpSpec, but still figuring out if DslApiImpl
allows that in some way.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.