encoding/protobuf: don't map google.protobuf types
(at least not yet)
Issue #5
Change-Id: If8430cf8ec9bb376bcf0c69ec385f1f0d066c4e6
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/2374
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
diff --git a/encoding/protobuf/testdata/attributes.proto.out.cue b/encoding/protobuf/testdata/attributes.proto.out.cue
index 0bdd410..9c13d65 100644
--- a/encoding/protobuf/testdata/attributes.proto.out.cue
+++ b/encoding/protobuf/testdata/attributes.proto.out.cue
@@ -14,7 +14,10 @@
// limitations under the License.
package v1
-import "time"
+import (
+ "github.com/golang/protobuf/ptypes/duration"
+ "github.com/golang/protobuf/ptypes/timestamp"
+)
// Attributes represents a set of typed name/value pairs. Many of Mixer's
// API either consume and/or return attributes.
@@ -77,10 +80,10 @@
bytesValue?: bytes @protobuf(6,name=bytes_value)
} | {
// Used for values of type TIMESTAMP
- timestampValue?: time.Time @protobuf(7,type=google.protobuf.Timestamp,name=timestamp_value)
+ timestampValue?: timestamp.Timestamp @protobuf(7,type=google.protobuf.Timestamp,name=timestamp_value)
} | {
// Used for values of type DURATION
- durationValue?: time.Duration @protobuf(8,type=google.protobuf.Duration,name=duration_value)
+ durationValue?: duration.Duration @protobuf(8,type=google.protobuf.Duration,name=duration_value)
} | {
// Used for values of type STRING_MAP
stringMapValue?: Attributes_StringMap @protobuf(9,type=StringMap,name=string_map_value)
@@ -116,10 +119,10 @@
bools <_>: bool
// Holds attributes of type TIMESTAMP
- timestamps <_>: time.Time
+ timestamps <_>: timestamp.Timestamp
// Holds attributes of type DURATION
- durations <_>: time.Duration
+ durations <_>: duration.Duration
// Holds attributes of type BYTES
bytes <_>: bytes
diff --git a/encoding/protobuf/testdata/client_config.proto.out.cue b/encoding/protobuf/testdata/client_config.proto.out.cue
index 66ec87a..fc7f747 100644
--- a/encoding/protobuf/testdata/client_config.proto.out.cue
+++ b/encoding/protobuf/testdata/client_config.proto.out.cue
@@ -21,8 +21,8 @@
package client
import (
+ "github.com/golang/protobuf/ptypes/duration"
"istio.io/api/mixer/v1"
- "time"
)
// Specifies the behavior when the client is unable to connect to Mixer.
@@ -36,10 +36,10 @@
// Base time to wait between retries. Will be adjusted by exponential
// backoff and jitter.
- baseRetryWait?: time.Duration @protobuf(3,type=google.protobuf.Duration,name=base_retry_wait)
+ baseRetryWait?: duration.Duration @protobuf(3,type=google.protobuf.Duration,name=base_retry_wait)
// Max time to wait between retries.
- maxRetryWait?: time.Duration @protobuf(4,type=google.protobuf.Duration,name=max_retry_wait)
+ maxRetryWait?: duration.Duration @protobuf(4,type=google.protobuf.Duration,name=max_retry_wait)
}
// Example of single-value enum.
@@ -108,7 +108,7 @@
// Specify refresh interval to write Mixer client statistics to Envoy share
// memory. If not specified, the interval is 10 seconds.
- statsUpdateInterval?: time.Duration @protobuf(5,type=google.protobuf.Duration,name=stats_update_interval)
+ statsUpdateInterval?: duration.Duration @protobuf(5,type=google.protobuf.Duration,name=stats_update_interval)
// Name of the cluster that will forward check calls to a pool of mixer
// servers. Defaults to "mixer_server". By using different names for
@@ -183,5 +183,5 @@
// Specify report interval to send periodical reports for long TCP
// connections. If not specified, the interval is 10 seconds. This interval
// should not be less than 1 second, otherwise it will be reset to 1 second.
- reportInterval?: time.Duration @protobuf(6,type=google.protobuf.Duration,name=report_interval)
+ reportInterval?: duration.Duration @protobuf(6,type=google.protobuf.Duration,name=report_interval)
}
diff --git a/encoding/protobuf/testdata/istio.io/api/mixer/v1/attributes_proto_gen.cue b/encoding/protobuf/testdata/istio.io/api/mixer/v1/attributes_proto_gen.cue
index 0bdd410..9c13d65 100644
--- a/encoding/protobuf/testdata/istio.io/api/mixer/v1/attributes_proto_gen.cue
+++ b/encoding/protobuf/testdata/istio.io/api/mixer/v1/attributes_proto_gen.cue
@@ -14,7 +14,10 @@
// limitations under the License.
package v1
-import "time"
+import (
+ "github.com/golang/protobuf/ptypes/duration"
+ "github.com/golang/protobuf/ptypes/timestamp"
+)
// Attributes represents a set of typed name/value pairs. Many of Mixer's
// API either consume and/or return attributes.
@@ -77,10 +80,10 @@
bytesValue?: bytes @protobuf(6,name=bytes_value)
} | {
// Used for values of type TIMESTAMP
- timestampValue?: time.Time @protobuf(7,type=google.protobuf.Timestamp,name=timestamp_value)
+ timestampValue?: timestamp.Timestamp @protobuf(7,type=google.protobuf.Timestamp,name=timestamp_value)
} | {
// Used for values of type DURATION
- durationValue?: time.Duration @protobuf(8,type=google.protobuf.Duration,name=duration_value)
+ durationValue?: duration.Duration @protobuf(8,type=google.protobuf.Duration,name=duration_value)
} | {
// Used for values of type STRING_MAP
stringMapValue?: Attributes_StringMap @protobuf(9,type=StringMap,name=string_map_value)
@@ -116,10 +119,10 @@
bools <_>: bool
// Holds attributes of type TIMESTAMP
- timestamps <_>: time.Time
+ timestamps <_>: timestamp.Timestamp
// Holds attributes of type DURATION
- durations <_>: time.Duration
+ durations <_>: duration.Duration
// Holds attributes of type BYTES
bytes <_>: bytes
diff --git a/encoding/protobuf/testdata/istio.io/api/mixer/v1/config/client/client_config_proto_gen.cue b/encoding/protobuf/testdata/istio.io/api/mixer/v1/config/client/client_config_proto_gen.cue
index 8471bc5..07e33a3 100644
--- a/encoding/protobuf/testdata/istio.io/api/mixer/v1/config/client/client_config_proto_gen.cue
+++ b/encoding/protobuf/testdata/istio.io/api/mixer/v1/config/client/client_config_proto_gen.cue
@@ -20,8 +20,8 @@
package client
import (
+ "github.com/golang/protobuf/ptypes/duration"
"istio.io/api/mixer/v1"
- "time"
)
// Specifies the behavior when the client is unable to connect to Mixer.
@@ -35,10 +35,10 @@
// Base time to wait between retries. Will be adjusted by exponential
// backoff and jitter.
- baseRetryWait?: time.Duration @protobuf(3,type=google.protobuf.Duration,name=base_retry_wait)
+ baseRetryWait?: duration.Duration @protobuf(3,type=google.protobuf.Duration,name=base_retry_wait)
// Max time to wait between retries.
- maxRetryWait?: time.Duration @protobuf(4,type=google.protobuf.Duration,name=max_retry_wait)
+ maxRetryWait?: duration.Duration @protobuf(4,type=google.protobuf.Duration,name=max_retry_wait)
}
// Example of single-value enum.
@@ -107,7 +107,7 @@
// Specify refresh interval to write Mixer client statistics to Envoy share
// memory. If not specified, the interval is 10 seconds.
- statsUpdateInterval?: time.Duration @protobuf(5,type=google.protobuf.Duration,name=stats_update_interval)
+ statsUpdateInterval?: duration.Duration @protobuf(5,type=google.protobuf.Duration,name=stats_update_interval)
// Name of the cluster that will forward check calls to a pool of mixer
// servers. Defaults to "mixer_server". By using different names for
@@ -182,5 +182,5 @@
// Specify report interval to send periodical reports for long TCP
// connections. If not specified, the interval is 10 seconds. This interval
// should not be less than 1 second, otherwise it will be reset to 1 second.
- reportInterval?: time.Duration @protobuf(6,type=google.protobuf.Duration,name=report_interval)
+ reportInterval?: duration.Duration @protobuf(6,type=google.protobuf.Duration,name=report_interval)
}
diff --git a/encoding/protobuf/testdata/istio.io/api/mixer/v1/mixer_proto_gen.cue b/encoding/protobuf/testdata/istio.io/api/mixer/v1/mixer_proto_gen.cue
index 9c4bf1c..335b311 100644
--- a/encoding/protobuf/testdata/istio.io/api/mixer/v1/mixer_proto_gen.cue
+++ b/encoding/protobuf/testdata/istio.io/api/mixer/v1/mixer_proto_gen.cue
@@ -17,8 +17,8 @@
package v1
import (
+ "github.com/golang/protobuf/ptypes/duration"
"google.golang.org/genproto/googleapis/rpc/status"
- "time"
)
// Used to get a thumbs-up/thumbs-down before performing an action.
@@ -70,7 +70,7 @@
status?: __status.Status @protobuf(1,type=google.rpc.Status,"(gogoproto.nullable)=false")
// The amount of time for which this result can be considered valid.
- validDuration?: time.Duration @protobuf(2,type=google.protobuf.Duration,name=valid_duration,"(gogoproto.nullable)=false","(gogoproto.stdduration)")
+ validDuration?: duration.Duration @protobuf(2,type=google.protobuf.Duration,name=valid_duration,"(gogoproto.nullable)=false","(gogoproto.stdduration)")
// The number of uses for which this result can be considered valid.
validUseCount?: int32 @protobuf(3,name=valid_use_count)
@@ -88,7 +88,7 @@
// Expresses the result of a quota allocation.
CheckResponse_QuotaResult: {
// The amount of time for which this result can be considered valid.
- validDuration?: time.Duration @protobuf(1,type=google.protobuf.Duration,name=valid_duration,"(gogoproto.nullable)=false","(gogoproto.stdduration)")
+ validDuration?: duration.Duration @protobuf(1,type=google.protobuf.Duration,name=valid_duration,"(gogoproto.nullable)=false","(gogoproto.stdduration)")
// The amount of granted quota. When `QuotaParams.best_effort` is true, this will be >= 0.
// If `QuotaParams.best_effort` is false, this will be either 0 or >= `QuotaParams.amount`.
diff --git a/encoding/protobuf/testdata/istio.io/api/pkg/google.golang.org/genproto/googleapis/rpc/status/status_proto_gen.cue b/encoding/protobuf/testdata/istio.io/api/pkg/google.golang.org/genproto/googleapis/rpc/status/status_proto_gen.cue
index e1348a8..f8e8246 100644
--- a/encoding/protobuf/testdata/istio.io/api/pkg/google.golang.org/genproto/googleapis/rpc/status/status_proto_gen.cue
+++ b/encoding/protobuf/testdata/istio.io/api/pkg/google.golang.org/genproto/googleapis/rpc/status/status_proto_gen.cue
@@ -14,6 +14,8 @@
// limitations under the License.
package status
+import "github.com/golang/protobuf/ptypes/any"
+
// The `Status` type defines a logical error model that is suitable for
// different programming environments, including REST APIs and RPC APIs. It is
// used by [gRPC](https://github.com/grpc). The error model is designed to be:
@@ -80,5 +82,5 @@
// A list of messages that carry the error details. There is a common set of
// message types for APIs to use.
- details?: [...] @protobuf(3,type=google.protobuf.Any)
+ details?: [...any.Any] @protobuf(3,type=google.protobuf.Any)
}