Skip to content

Commit f01f50e

Browse files
Remove validation from the string representation (#639)
* Remove validation from the string representation Signed-off-by: Francesco Guardiani <[email protected]> * Yeah sometimes i just trust too much on my ide Signed-off-by: Francesco Guardiani <[email protected]> * Now this should be fine Signed-off-by: Francesco Guardiani <[email protected]>
1 parent a2406aa commit f01f50e

File tree

2 files changed

+4
-21
lines changed

2 files changed

+4
-21
lines changed

v2/event/event.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package event
33
import (
44
"bytes"
55
"encoding/json"
6-
"fmt"
76
"strings"
87
)
98

@@ -66,18 +65,6 @@ func (e Event) ExtensionAs(name string, obj interface{}) error {
6665
func (e Event) String() string {
6766
b := strings.Builder{}
6867

69-
b.WriteString("Validation: ")
70-
71-
valid := e.Validate()
72-
if valid == nil {
73-
b.WriteString("valid\n")
74-
} else {
75-
b.WriteString("invalid\n")
76-
}
77-
if valid != nil {
78-
b.WriteString(fmt.Sprintf("Validation Error: \n%s\n", valid.Error()))
79-
}
80-
8168
b.WriteString(e.Context.String())
8269

8370
if e.DataEncoded != nil {

v2/event/event_test.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,7 @@ func TestString(t *testing.T) {
224224
event: event.Event{
225225
Context: MinEventContextV03(),
226226
},
227-
want: `Validation: valid
228-
Context Attributes,
227+
want: `Context Attributes,
229228
specversion: 0.3
230229
type: com.example.simple
231230
source: http://example.com/source
@@ -236,8 +235,7 @@ Context Attributes,
236235
event: event.Event{
237236
Context: MinEventContextV1(),
238237
},
239-
want: `Validation: valid
240-
Context Attributes,
238+
want: `Context Attributes,
241239
specversion: 1.0
242240
type: com.example.simple
243241
source: http://example.com/source
@@ -249,8 +247,7 @@ Context Attributes,
249247
Context: FullEventContextV03(now),
250248
DataEncoded: []byte(`{"a":"apple","b":"banana"}`),
251249
},
252-
want: fmt.Sprintf(`Validation: valid
253-
Context Attributes,
250+
want: fmt.Sprintf(`Context Attributes,
254251
specversion: 0.3
255252
type: com.example.simple
256253
source: http://example.com/source
@@ -275,8 +272,7 @@ Data,
275272
Context: FullEventContextV1(now),
276273
DataEncoded: []byte(`{"a":"apple","b":"banana"}`),
277274
},
278-
want: fmt.Sprintf(`Validation: valid
279-
Context Attributes,
275+
want: fmt.Sprintf(`Context Attributes,
280276
specversion: 1.0
281277
type: com.example.simple
282278
source: http://example.com/source

0 commit comments

Comments
 (0)