JsonRpcProtocol

automorph.protocol.JsonRpcProtocol
See theJsonRpcProtocol companion object

JSON-RPC protocol plugin.

Provides the following JSON-RPC methods for service discovery:

  • rpc.discover - API schema in OpenRPC format
  • api.discover - API schema in OpenAPI format

Type parameters

Codec

message codec plugin type

Context

RPC message context type

Node

message node type

Value parameters

decodeMessage

converts a message format node to JSON-RPC message

encodeMessage

converts a JSON-RPC message to message format node

encodeOpenApi

converts an OpenAPI schema to message format node

encodeOpenRpc

converts an OpenRPC description to message format node

encodeStrings

converts a list of strings to message format node

mapError

maps a JSON-RPC error to a corresponding exception

mapException

maps an exception to a corresponding JSON-RPC error

mapOpenApi

transforms generated OpenAPI schema

mapOpenRpc

transforms generated OpenRPC schema

messageCodec

message codec plugin

namedArguments

if true, pass arguments by name, if false pass arguments by position

Attributes

Constructor

Creates a JSON-RPC protocol plugin.

See also
Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
trait RpcProtocol[Node, Codec, Context]
class Object
trait Matchable
class Any
Show all

Members list

Type members

Inherited types

type Metadata = Option[Id]

JSON-RPC message metadata.

JSON-RPC message metadata.

Attributes

Inherited from:
JsonRpcCore (hidden)

Value members

Inherited methods

override def apiSchemas: Seq[ApiSchema[Node]]

Attributes

Definition Classes
Inherited from:
JsonRpcCore (hidden)

Creates a copy of this protocol with specified message contex type.

Creates a copy of this protocol with specified message contex type.

Type parameters

NewContext

RPC message context type

Attributes

Returns

JSON-RPC protocol

Inherited from:
JsonRpcCore (hidden)

Attributes

Definition Classes
Some.apply[String](JsonRpcCore.this.messageCodec.text(JsonRpcCore.this.encodeMessage.apply(requestMessage)))) Try.apply[Array[Byte]](JsonRpcCore.this.messageCodec.serialize(JsonRpcCore.this.encodeMessage.apply(requestMessage))).recoverWith[Array[Byte]](((x$1:Throwable)=>(x$1:@unchecked)match{ caseerror=> Failure.apply[Nothing](JsonRpcException.apply[Any]("Malformedrequest",ErrorType.ParseError.code,None,error)) })).map[Request[Node,Option[Id],Context]](((messageBody:Array[Byte])=>{ valmessage:Message[Option[Either[BigDecimal,String]]]=protocol.Message.apply[Option[Either[BigDecimal,String]]](id,messageBody,requestMessage.properties,messageText) valrequestArguments:Seq[Right[Node,Tuple2[String,Node]]]=arguments.map[Right[Node,Tuple2[String,Node]]](((value:Tuple2[String,Node])=>Right.apply[Node,Tuple2[String,Node]](value))).toSeq protocol.Request.apply[Node,Option[Id],Context](message,function,requestArguments,responseRequired,requestId,requestContext) })) }">JsonRpcCore
Inherited from:
Some.apply[String](JsonRpcCore.this.messageCodec.text(JsonRpcCore.this.encodeMessage.apply(requestMessage)))) Try.apply[Array[Byte]](JsonRpcCore.this.messageCodec.serialize(JsonRpcCore.this.encodeMessage.apply(requestMessage))).recoverWith[Array[Byte]](((x$1:Throwable)=>(x$1:@unchecked)match{ caseerror=> Failure.apply[Nothing](JsonRpcException.apply[Any]("Malformedrequest",ErrorType.ParseError.code,None,error)) })).map[Request[Node,Option[Id],Context]](((messageBody:Array[Byte])=>{ valmessage:Message[Option[Either[BigDecimal,String]]]=protocol.Message.apply[Option[Either[BigDecimal,String]]](id,messageBody,requestMessage.properties,messageText) valrequestArguments:Seq[Right[Node,Tuple2[String,Node]]]=arguments.map[Right[Node,Tuple2[String,Node]]](((value:Tuple2[String,Node])=>Right.apply[Node,Tuple2[String,Node]](value))).toSeq protocol.Request.apply[Node,Option[Id],Context](message,function,requestArguments,responseRequired,requestId,requestContext) })) }">JsonRpcCore (hidden)

Attributes

Definition Classes
Response.apply[Node](id,Some.apply[Node](resultValue),None).message)) valmessageText:Function0[Some[String]]=(()=>Some.apply[String](JsonRpcCore.this.messageCodec.text(JsonRpcCore.this.encodeMessage.apply(responseMessage)))) Try.apply[Array[Byte]](JsonRpcCore.this.messageCodec.serialize(JsonRpcCore.this.encodeMessage.apply(responseMessage))).recoverWith[Array[Byte]](((x$1:Throwable)=>(x$1:@unchecked)match{ caseerror=> Failure.apply[Nothing](JsonRpcException.apply[Any]("Malformedresponse",ErrorType.ParseError.code,None,`error₂`)) })).map[Response[Node,Option[Id]]](((messageBody:Array[Byte])=>{ val`message₃`:Message[Option[Id]]=protocol.Message.apply[Option[Id]](Option.apply[Id](id),messageBody,responseMessage.properties,messageText) protocol.Response.apply[Node,Option[Id]](result,`message₃`) })) }">JsonRpcCore
Inherited from:
Response.apply[Node](id,Some.apply[Node](resultValue),None).message)) valmessageText:Function0[Some[String]]=(()=>Some.apply[String](JsonRpcCore.this.messageCodec.text(JsonRpcCore.this.encodeMessage.apply(responseMessage)))) Try.apply[Array[Byte]](JsonRpcCore.this.messageCodec.serialize(JsonRpcCore.this.encodeMessage.apply(responseMessage))).recoverWith[Array[Byte]](((x$1:Throwable)=>(x$1:@unchecked)match{ caseerror=> Failure.apply[Nothing](JsonRpcException.apply[Any]("Malformedresponse",ErrorType.ParseError.code,None,`error₂`)) })).map[Response[Node,Option[Id]]](((messageBody:Array[Byte])=>{ val`message₃`:Message[Option[Id]]=protocol.Message.apply[Option[Id]](Option.apply[Id](id),messageBody,responseMessage.properties,messageText) protocol.Response.apply[Node,Option[Id]](result,`message₃`) })) }">JsonRpcCore (hidden)
def mapError(errorToException: (String, Int) => Throwable): JsonRpcProtocol[Node, Codec, Context]

Creates a copy of this protocol with specified JSON-RPC error to exception mapping.

Creates a copy of this protocol with specified JSON-RPC error to exception mapping.

Value parameters

errorToException

maps a JSON-RPC error to a corresponding exception

Attributes

Returns

JSON-RPC protocol

Inherited from:
JsonRpcCore (hidden)

Creates a copy of this protocol with specified exception to JSON-RPC error mapping.

Creates a copy of this protocol with specified exception to JSON-RPC error mapping.

Value parameters

exceptionToError

maps an exception classs to a corresponding JSON-RPC error type

Attributes

Returns

JSON-RPC protocol

Inherited from:
JsonRpcCore (hidden)
def mapOpenApi(mapOpenApi: OpenApi => OpenApi): JsonRpcProtocol[Node, Codec, Context]

Creates a copy of this protocol with given OpenAPI description transformation.

Creates a copy of this protocol with given OpenAPI description transformation.

Value parameters

mapOpenApi

transforms generated OpenAPI schema or removes the service discovery method if the result is None

Attributes

Returns

JSON-RPC protocol

Inherited from:
JsonRpcCore (hidden)
def mapOpenRpc(mapOpenRpc: OpenRpc => OpenRpc): JsonRpcProtocol[Node, Codec, Context]

Creates a copy of this protocol with given OpenRPC description transformation.

Creates a copy of this protocol with given OpenRPC description transformation.

Value parameters

mapOpenRpc

transforms generated OpenRPC schema

Attributes

Returns

JSON-RPC protocol

Inherited from:
JsonRpcCore (hidden)
def namedArguments(namedArguments: Boolean): JsonRpcProtocol[Node, Codec, Context]

Creates a copy of this protocol with specified named arguments setting.

Creates a copy of this protocol with specified named arguments setting.

Value parameters

namedArguments

if true, pass arguments by name, if false pass arguments by position

Attributes

Returns

JSON-RPC protocol

See also
Inherited from:
JsonRpcCore (hidden)

Attributes

Definition Classes
{ valmessageText:Function0[Some[String]]=(()=>Some.apply[String](JsonRpcCore.this.messageCodec.text(JsonRpcCore.this.encodeMessage.apply(requestMessage)))) valmessage:Message[Option[Either[BigDecimal,String]]]=protocol.Message.apply[Option[Either[BigDecimal,String]]](requestMessage.id,requestBody,requestMessage.properties,messageText) Try.apply[Request[Node]](Request.apply[Node](requestMessage)).fold[Either[ParseError[Option[Id]],Request[Node,Option[Id],Context]]](((`error₂`:Throwable)=>Left.apply[ParseError[Option[Id]],Nothing](ParseError.apply[Option[Id]](`error₂`,message))),((request:Request[Node])=>{ valrequestArguments:Seq[Left[Node,Tuple2[String,Node]]|Right[Node,Tuple2[String,Node]]]=request.params.fold[Seq[Left[Node,Tuple2[String,Node]]|Right[Node,Tuple2[String,Node]]]](((_$1:List[Node])=>_$1.map[Left[Node,Tuple2[String,Node]]](((value:Node)=>Left.apply[Node,Tuple2[String,Node]](value)))),((_$2:Map[String,Node])=>_$2.map[Right[Node,Tuple2[String,Node]]](((`value₂`:Tuple2[String,Node])=>Right.apply[Node,Tuple2[String,Node]](`value₂`))).toSeq)) Right.apply[Nothing,Request[Node,Option[Id],Context]](protocol.Request.apply[Node,Option[Id],Context](message,request.method,requestArguments,request.id.isDefined,requestId,requestContext)) })) }))">JsonRpcCore
Inherited from:
{ valmessageText:Function0[Some[String]]=(()=>Some.apply[String](JsonRpcCore.this.messageCodec.text(JsonRpcCore.this.encodeMessage.apply(requestMessage)))) valmessage:Message[Option[Either[BigDecimal,String]]]=protocol.Message.apply[Option[Either[BigDecimal,String]]](requestMessage.id,requestBody,requestMessage.properties,messageText) Try.apply[Request[Node]](Request.apply[Node](requestMessage)).fold[Either[ParseError[Option[Id]],Request[Node,Option[Id],Context]]](((`error₂`:Throwable)=>Left.apply[ParseError[Option[Id]],Nothing](ParseError.apply[Option[Id]](`error₂`,message))),((request:Request[Node])=>{ valrequestArguments:Seq[Left[Node,Tuple2[String,Node]]|Right[Node,Tuple2[String,Node]]]=request.params.fold[Seq[Left[Node,Tuple2[String,Node]]|Right[Node,Tuple2[String,Node]]]](((_$1:List[Node])=>_$1.map[Left[Node,Tuple2[String,Node]]](((value:Node)=>Left.apply[Node,Tuple2[String,Node]](value)))),((_$2:Map[String,Node])=>_$2.map[Right[Node,Tuple2[String,Node]]](((`value₂`:Tuple2[String,Node])=>Right.apply[Node,Tuple2[String,Node]](`value₂`))).toSeq)) Right.apply[Nothing,Request[Node,Option[Id],Context]](protocol.Request.apply[Node,Option[Id],Context](message,request.method,requestArguments,request.id.isDefined,requestId,requestContext)) })) }))">JsonRpcCore (hidden)

Attributes

Definition Classes
{ valmessageText:Function0[Some[String]]=(()=>Some.apply[String](JsonRpcCore.this.messageCodec.text(JsonRpcCore.this.encodeMessage.apply(responseMessage)))) valmessage:Message[Option[Either[BigDecimal,String]]]=protocol.Message.apply[Option[Either[BigDecimal,String]]](responseMessage.id,responseBody,responseMessage.properties,messageText) Try.apply[Response[Node]](Response.apply[Node](responseMessage)).fold[Either[ParseError[Option[Either[BigDecimal,String]]],Response[Node,Option[Either[BigDecimal,String]]]]](((`error₂`:Throwable)=>Left.apply[ParseError[Option[Id]],Nothing](ParseError.apply[Option[Id]](JsonRpcException.apply[Any]("Malformedresponse",ErrorType.ParseError.code,None,`error₂`),message))),((response:Response[Node])=>response.error.fold[Either[ParseError[Option[Either[BigDecimal,String]]],Response[Node,Option[Either[BigDecimal,String]]]]](response.resultmatch{ caseNone=> Left.apply[ParseError[Option[Either[BigDecimal,String]]],Nothing](ParseError.apply[Option[Either[BigDecimal,String]]](InvalidResponse.apply("Invalidresult",None.orNull[Null](refl[Null])),message)) caseSome(result)=> Right.apply[Nothing,Response[Node,Option[Either[BigDecimal,String]]]](protocol.Response.apply[Node,Option[Either[BigDecimal,String]]](Success.apply[Node](result),message)) })(((`error₃`:ResponseError[Node])=>Right.apply[Nothing,Response[Node,Option[Id]]](protocol.Response.apply[Node,Option[Id]](Failure.apply[Nothing](JsonRpcCore.this.mapError.apply(`error₃`.message,`error₃`.code)),message)))))) }))">JsonRpcCore
Inherited from:
{ valmessageText:Function0[Some[String]]=(()=>Some.apply[String](JsonRpcCore.this.messageCodec.text(JsonRpcCore.this.encodeMessage.apply(responseMessage)))) valmessage:Message[Option[Either[BigDecimal,String]]]=protocol.Message.apply[Option[Either[BigDecimal,String]]](responseMessage.id,responseBody,responseMessage.properties,messageText) Try.apply[Response[Node]](Response.apply[Node](responseMessage)).fold[Either[ParseError[Option[Either[BigDecimal,String]]],Response[Node,Option[Either[BigDecimal,String]]]]](((`error₂`:Throwable)=>Left.apply[ParseError[Option[Id]],Nothing](ParseError.apply[Option[Id]](JsonRpcException.apply[Any]("Malformedresponse",ErrorType.ParseError.code,None,`error₂`),message))),((response:Response[Node])=>response.error.fold[Either[ParseError[Option[Either[BigDecimal,String]]],Response[Node,Option[Either[BigDecimal,String]]]]](response.resultmatch{ caseNone=> Left.apply[ParseError[Option[Either[BigDecimal,String]]],Nothing](ParseError.apply[Option[Either[BigDecimal,String]]](InvalidResponse.apply("Invalidresult",None.orNull[Null](refl[Null])),message)) caseSome(result)=> Right.apply[Nothing,Response[Node,Option[Either[BigDecimal,String]]]](protocol.Response.apply[Node,Option[Either[BigDecimal,String]]](Success.apply[Node](result),message)) })(((`error₃`:ResponseError[Node])=>Right.apply[Nothing,Response[Node,Option[Id]]](protocol.Response.apply[Node,Option[Id]](Failure.apply[Nothing](JsonRpcCore.this.mapError.apply(`error₃`.message,`error₃`.code)),message)))))) }))">JsonRpcCore (hidden)

Attributes

Inherited from:
Product

Attributes

Inherited from:
Product

Inherited fields

val name: String

Attributes

Inherited from:
JsonRpcCore (hidden)