Skip to content
This repository was archived by the owner on Dec 9, 2024. It is now read-only.

Commit 529cc4a

Browse files
alexdebriemthenw
authored andcommitted
Require CloudEvents Source be a URI (#414)
1 parent e3b1318 commit 529cc4a

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

event/event.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ type Event struct {
4040
EventType Type `json:"eventType" validate:"required"`
4141
EventTypeVersion string `json:"eventTypeVersion,omitempty"`
4242
CloudEventsVersion string `json:"cloudEventsVersion" validate:"required"`
43-
Source string `json:"source" validate:"url,required"`
43+
Source string `json:"source" validate:"uri,required"`
4444
EventID string `json:"eventID" validate:"required"`
4545
EventTime time.Time `json:"eventTime,omitempty"`
4646
SchemaURL string `json:"schemaURL,omitempty"`

event/event_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,15 @@ var newTests = []struct {
7979
[]byte(`{
8080
"eventType": "user.created",
8181
"cloudEventsVersion": "`+ eventpkg.TransformationVersion +`",
82-
"source": "https://example.com/",
82+
"source": "/mysource",
8383
"eventID": "6f6ada3b-0aa2-4b3c-989a-91ffc6405f11",
8484
"contentType": "text/plain",
8585
"data": "test"
8686
}`),
8787
eventpkg.Event{
8888
EventType: eventpkg.Type("user.created"),
8989
CloudEventsVersion: eventpkg.TransformationVersion,
90-
Source: "https://example.com/",
90+
Source: "/mysource",
9191
ContentType: "text/plain",
9292
Data: "test",
9393
},

0 commit comments

Comments
 (0)