Generated javascript dtos requiring missing built in proto types types, e.g. Timestamp (using beta-3, proto3, CommonJs)

332 views
Skip to first unread message

Keith Woods

unread,
Jun 1, 2016, 2:48:18 PM6/1/16
to Protocol Buffers
Hi All

I'm using proto3 with the last beta 3 (v3.0.0-beta-3) to generate javascript DTOS as CommonJs modules.

In the generated javascript, built in proto type (e.g. google.protobuf.Timestamp) are 'required' but don't exist.

For example, given this proto:

// foo.proto
syntax
= "proto3";

import "google/protobuf/timestamp.proto";

message SomeMessage {
   google.protobuf.Timestamp someTime = 1;
}


And this command:

protoc --proto_path=./ --js_out=import_style=commonjs:./ foo.proto

we get this output: 

/**
* @fileoverview
* @enhanceable
* @public
*/
// GENERATED CODE -- DO NOT EDIT!

var jspb = require('google-protobuf');
var goog = jspb;
var global = Function('return this')();

var google_protobuf_timestamp_pb = require('./google/protobuf/timestamp_pb.js'); // NOTE ./google/protobuf/timestamp_pb.js doesn't exist
goog.exportSymbol('proto.SomeMessage', null, global);

The file timestamp_pb.js isn't generated (note timestamp.proto does exist under my protoc executable). 

I'd expect it to exist in either:
  1. the google-protobuf npm package, e.g.  require('google-protobuf/somePathHere/timestamp_pb.js')
  2. the output generated by protoc

I don't see anything in the repo to support the first option, and not sure about the second.

Any ideas?

Any help much appreciated. 

Feng Xiao

unread,
Jun 1, 2016, 2:54:35 PM6/1/16
to Keith Woods, Protocol Buffers
We should support option (1): the google-protobuf package is supposed to contain these well-known types. Could you create a github issue for that?
 

Any ideas?

Any help much appreciated. 

--
You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+u...@googlegroups.com.
To post to this group, send email to prot...@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Keith Woods

unread,
Jun 1, 2016, 3:22:51 PM6/1/16
to Protocol Buffers, devs...@gmail.com
thanks for the response, issue created https://github.com/google/protobuf/issues/1638
Reply all
Reply to author
Forward
0 new messages