[json-rpc] How about JSON-IDL?

692 views
Skip to first unread message

idleSun

unread,
Apr 29, 2010, 6:13:22 PM4/29/10
to JSON-RPC
I checked the "JSON Schema Service Descriptor" and found it quite
useful but limited to method definition. In general I think it doesn't
provide enough specifics as RPC description because it simply reuses
JSON Schema property definition.
So, I checked a couple of other IDLs including Apache Thrift, Google
Protocol Buffers and WADL. I found that the Thrift IDL is simple and
good enough to describe RPC description. Actually, I tried to use
ThriftIDL directly but its documentation is really poor and its
implementation was not easy to setup.

As a result, I am thinking about creating JSON based IDL that covers
all elements of Thrift and JSON-RPC. Before defining JSON schema for
this IDL, I want to give a simple example:
{
"jsonidl": "0.1",
"MathServiceInterface": {
"version": "0.1",
"context": "msi.geometry.2d",
"types": [
{ "name": "Point",
"members": [
{ "name": "x", "type": "i32" },
{ "name": "y", "type": "i32" }
]
}
],
"errors": [
["CALC_UNKNOWN", -32010, "Unknown error"],
["CALC_DIVBYZERO", -32011, "Division by zero"]
],
"services": [
{ "name": "Coordiate",
"methods": [
{ "name": "moveBy",
"params": [
{ "type": "Point", "name": "position" },
{ "type": "Point", "name": "delta" }
],
"result": { "type": "Point" }
},
{ "name": "scaleDown",
"params": [ { "type": "Point" }, { "type": "i32" } ],
"result": { "type": "Point" },
"errors": [ "CALC_DIVBYZERO" ]
}
]
}
]
}

This example alone can not tell everything that implies but please
note that this IDL is for generating programming codes and other IDLs
(such as ThriftIDL, WADL), as well as defining JSON-RPC messages. If
others are interested in this approach, I can post some updates later.
And comments are welcome always.

--
You received this message because you are subscribed to the Google Groups "JSON-RPC" group.
To post to this group, send email to json...@googlegroups.com.
To unsubscribe from this group, send email to json-rpc+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/json-rpc?hl=en.

Sasha Ovsankin

unread,
Apr 29, 2010, 6:19:49 PM4/29/10
to JSON-RPC
You may also want to look at Avro: http://hadoop.apache.org/avro/docs/current/#compare

The schema is in JSON and I like the fact that it is dynamic.

idleSun

unread,
Apr 29, 2010, 7:42:54 PM4/29/10
to JSON-RPC
Sasha,
Avro looks very close to what I want to do. Thanks a lot for the good
information. I may not need to define new IDL after all.
Reply all
Reply to author
Forward
0 new messages