generate an html interface from a grpc interface

915 views
Skip to first unread message

Walter Schulze

unread,
Apr 8, 2015, 5:52:57 AM4/8/15
to grp...@googlegroups.com
letmegrpc generates an html interface for a grpc.io interface


Assuming you have a grpc server implementation running on your localhost on port 12345

letmegrpc --addr=localhost:12345 --port=8080 grpc.proto

Now open your webbrowser and goto

Currently the nice web form is only supported for simple messages, messages that don't contain any repeated fields or other messages.
Maybe someone would like to help me build an web form that can handle nested objects?

Louis Ryan

unread,
Apr 8, 2015, 12:27:08 PM4/8/15
to Walter Schulze, grp...@googlegroups.com
Very cool!  Google has a similar tool internally as part of our command line support for the predecessor to GRPC and we're very interested in building out support for something like this.

The internal tool is not based on code generation, but rather it reads protobuf descriptor objects (https://github.com/golang/protobuf/blob/master/protoc-gen-go/descriptor/descriptor.pb.go) and performs the same work dynamically. The advantage of this is that you can point the tool at a running remote server which exposes it's descriptors via a standardized API

--
You received this message because you are subscribed to the Google Groups "grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+u...@googlegroups.com.
To post to this group, send email to grp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/c2321e85-4332-46a3-8efc-26f736b6fbd4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Yugui

unread,
Apr 8, 2015, 6:50:07 PM4/8/15
to Louis Ryan, Walter Schulze, grp...@googlegroups.com
Louis,
Thank you for your message.  I have a question below.

On Thu, Apr 9, 2015 at 1:27 AM 'Louis Ryan' via grpc.io <grp...@googlegroups.com> wrote:
Very cool!  Google has a similar tool internally as part of our command line support for the predecessor to GRPC and we're very interested in building out support for something like this.

The internal tool is not based on code generation, but rather it reads protobuf descriptor objects (https://github.com/golang/protobuf/blob/master/protoc-gen-go/descriptor/descriptor.pb.go) and performs the same work dynamically. The advantage of this is that you can point the tool at a running remote server which exposes it's descriptors via a standardized API

With another guy (@mattn), I have discussed the same idea of command line tool with dynamic messages. And I would really like to have such a tool.

Does gRPC already have such a standard endpoint which serves service descriptors?  If it doesn't, do you think it is acceptable to add such an endpoint to gRPC?


On Wed, Apr 8, 2015 at 2:52 AM, Walter Schulze <awalter...@gmail.com> wrote:
letmegrpc generates an html interface for a grpc.io interface


Assuming you have a grpc server implementation running on your localhost on port 12345

letmegrpc --addr=localhost:12345 --port=8080 grpc.proto

Now open your webbrowser and goto

Currently the nice web form is only supported for simple messages, messages that don't contain any repeated fields or other messages.
Maybe someone would like to help me build an web form that can handle nested objects?

--
You received this message because you are subscribed to the Google Groups "grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+u...@googlegroups.com.
To post to this group, send email to grp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/c2321e85-4332-46a3-8efc-26f736b6fbd4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+u...@googlegroups.com.
To post to this group, send email to grp...@googlegroups.com.

Eric Anderson

unread,
Apr 8, 2015, 6:52:41 PM4/8/15
to Yugui, Louis Ryan, Walter Schulze, grpc-io
On Wed, Apr 8, 2015 at 3:50 PM, Yugui <yu...@yugui.jp> wrote:

Does gRPC already have such a standard endpoint which serves service descriptors?  If it doesn't, do you think it is acceptable to add such an endpoint to gRPC?


gRPC doesn't have such a standard endpoint. However, we were already expecting to add it, it just hasn't been defined yet. It would be a gRPC service.

Yugui

unread,
Apr 8, 2015, 7:09:38 PM4/8/15
to Eric Anderson, Louis Ryan, Walter Schulze, grpc-io
cool. looking forward to seeing that.

--
You received this message because you are subscribed to the Google Groups "grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+u...@googlegroups.com.
To post to this group, send email to grp...@googlegroups.com.

Walter Schulze

unread,
Apr 9, 2015, 2:53:07 AM4/9/15
to Yugui, Eric Anderson, Louis Ryan, grpc-io
Good to know :)

I guess it would be quite easy to change to rather use the descriptor and do it dynamically.

Do you have any idea when google might open source their version?

Does it display forms for nested and repeated messages?

Louis Ryan

unread,
Apr 9, 2015, 1:13:11 PM4/9/15
to Walter Schulze, Yugui, Eric Anderson, grpc-io
On Wed, Apr 8, 2015 at 11:53 PM, Walter Schulze <awalter...@gmail.com> wrote:
Good to know :)

I guess it would be quite easy to change to rather use the descriptor and do it dynamically.

Do you have any idea when google might open source their version?

We don't currently have one for GRPC but they would be largely similar. It's written in C++ and it might be easier to maintain in Go moving forward. 
 

Does it display forms for nested and repeated messages?

It does

Walter Schulze

unread,
Apr 10, 2015, 10:50:15 AM4/10/15
to Louis Ryan, Yugui, Eric Anderson, grpc-io
I get json output from the form which I then unmarshal into the generated struct.
This struct I can then pass to GRPC. 

I see a problem in not generating code in Go except if you can do dynamic marshaling or every GRPC server can handle JSON.

Can every GRPC handle json or do you do dynamic protocol buffer marshaling of the messages?

Or do you have another solution?

Louis Ryan

unread,
Apr 10, 2015, 1:17:12 PM4/10/15
to Walter Schulze, Yugui, Eric Anderson, grpc-io
On Fri, Apr 10, 2015 at 7:50 AM, Walter Schulze <awalter...@gmail.com> wrote:
I get json output from the form which I then unmarshal into the generated struct.
This struct I can then pass to GRPC. 

I see a problem in not generating code in Go except if you can do dynamic marshaling or every GRPC server can handle JSON.

Can every GRPC handle json or do you do dynamic protocol buffer marshaling of the messages?

We have dynamic protobuf marshalling. I know that library support for that exists in Java & C++ for example but I don't know if there's an equivalent to to DynamicMessage in Go.

@Eric - Any idea?

Eric Anderson

unread,
Apr 10, 2015, 2:27:45 PM4/10/15
to Louis Ryan, Walter Schulze, Yugui, grpc-io
On Fri, Apr 10, 2015 at 10:17 AM, Louis Ryan <lr...@google.com> wrote:


On Fri, Apr 10, 2015 at 7:50 AM, Walter Schulze <awalter...@gmail.com> wrote:
I get json output from the form which I then unmarshal into the generated struct.
This struct I can then pass to GRPC. 

I see a problem in not generating code in Go except if you can do dynamic marshaling or every GRPC server can handle JSON.

Can every GRPC handle json or do you do dynamic protocol buffer marshaling of the messages?

We have dynamic protobuf marshalling. I know that library support for that exists in Java & C++ for example but I don't know if there's an equivalent to to DynamicMessage in Go.

@Eric - Any idea?

I'm not seeing one for Go. Go's Proto JSON support also uses the standard library JSON, which also seems to not have a dynamic version.

Walter Schulze

unread,
Apr 11, 2015, 2:34:05 AM4/11/15
to Eric Anderson, Louis Ryan, Yugui, grpc-io
Good to know.
I might get dynamic json to proto transcoding for free in another project I am working on later this year.
Then I should be able to use that to make it fully dynamic.
But for now I am going to stick to some code generation.
Reply all
Reply to author
Forward
0 new messages