Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 41e80f7

Browse files
committed
fixed couple issues
Signed-off-by: Tim Brunko <[email protected]>
1 parent 9ccd339 commit 41e80f7

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

binding/format/protobuf/v2/protobuf.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ func ToProto(e *event.Event) (*pb.CloudEvent, error) {
9191
dataSchemaStr := e.DataSchema()
9292
uri, err := url.Parse(dataSchemaStr)
9393
if err != nil {
94-
return nil, fmt.Errorf("failed to url.Parse %s: %s", dataSchemaStr, err)
94+
return nil, fmt.Errorf("failed to url.Parse %s: %w", dataSchemaStr, err)
9595
}
9696
container.Attributes[dataschema], _ = attributeFor(uri)
9797
}

binding/format/protobuf/v2/protobuf_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ func TestFromProto(t *testing.T) {
109109
Type: "some.type",
110110
Attributes: map[string]*pb.CloudEventAttributeValue{
111111
"datacontenttype": {Attr: &pb.CloudEventAttributeValue_CeString{CeString: "application/json"}},
112-
"dataschema": {Attr: &pb.CloudEventAttributeValue_CeUri{CeUri: "link"}},
112+
"dataschema": {Attr: &pb.CloudEventAttributeValue_CeUri{CeUri: "https://example-data-schema.com"}},
113113
"extra1": {Attr: &pb.CloudEventAttributeValue_CeString{CeString: "extra1 value"}},
114114
"extra2": {Attr: &pb.CloudEventAttributeValue_CeInteger{CeInteger: 2}},
115115
"extra3": {Attr: &pb.CloudEventAttributeValue_CeBoolean{CeBoolean: true}},
@@ -125,7 +125,7 @@ func TestFromProto(t *testing.T) {
125125
out.SetSource("/source")
126126
out.SetType("some.type")
127127
_ = out.SetData("application/json", map[string]interface{}{"unit": "test"})
128-
out.SetDataSchema("link")
128+
out.SetDataSchema("https://example-data-schema.com")
129129
out.SetExtension("extra1", "extra1 value")
130130
out.SetExtension("extra2", 2)
131131
out.SetExtension("extra3", true)
@@ -142,7 +142,7 @@ func TestFromProto(t *testing.T) {
142142
Type: "some.type",
143143
Attributes: map[string]*pb.CloudEventAttributeValue{
144144
"datacontenttype": {Attr: &pb.CloudEventAttributeValue_CeString{CeString: "text/plain"}},
145-
"dataschema": {Attr: &pb.CloudEventAttributeValue_CeUri{CeUri: "link"}},
145+
"dataschema": {Attr: &pb.CloudEventAttributeValue_CeUri{CeUri: "https://example-data-schema.com"}},
146146
"extra1": {Attr: &pb.CloudEventAttributeValue_CeString{CeString: "extra1 value"}},
147147
"extra2": {Attr: &pb.CloudEventAttributeValue_CeInteger{CeInteger: 2}},
148148
"extra3": {Attr: &pb.CloudEventAttributeValue_CeBoolean{CeBoolean: true}},
@@ -158,7 +158,7 @@ func TestFromProto(t *testing.T) {
158158
out.SetSource("/source")
159159
out.SetType("some.type")
160160
_ = out.SetData("text/plain", `this is some text with a "quote"`)
161-
out.SetDataSchema("link")
161+
out.SetDataSchema("https://example-data-schema.com")
162162
out.SetExtension("extra1", "extra1 value")
163163
out.SetExtension("extra2", 2)
164164
out.SetExtension("extra3", true)
@@ -175,7 +175,7 @@ func TestFromProto(t *testing.T) {
175175
Type: "some.type",
176176
Attributes: map[string]*pb.CloudEventAttributeValue{
177177
"datacontenttype": {Attr: &pb.CloudEventAttributeValue_CeString{CeString: "application/json"}},
178-
"dataschema": {Attr: &pb.CloudEventAttributeValue_CeUri{CeUri: "link"}},
178+
"dataschema": {Attr: &pb.CloudEventAttributeValue_CeUri{CeUri: "https://example-data-schema.com"}},
179179
"extra1": {Attr: &pb.CloudEventAttributeValue_CeString{CeString: "extra1 value"}},
180180
"extra2": {Attr: &pb.CloudEventAttributeValue_CeInteger{CeInteger: 2}},
181181
"extra3": {Attr: &pb.CloudEventAttributeValue_CeBoolean{CeBoolean: true}},
@@ -191,7 +191,7 @@ func TestFromProto(t *testing.T) {
191191
out.SetSource("/source")
192192
out.SetType("some.type")
193193
_ = out.SetData("application/json", `{"unit":"test"}`)
194-
out.SetDataSchema("link")
194+
out.SetDataSchema("https://example-data-schema.com")
195195
out.SetExtension("extra1", "extra1 value")
196196
out.SetExtension("extra2", 2)
197197
out.SetExtension("extra3", true)

0 commit comments

Comments
 (0)