From fd956fac554d66104a072a0f22503117e0a0e718 Mon Sep 17 00:00:00 2001 From: Andrea Frittoli Date: Wed, 19 Oct 2022 11:49:58 +0100 Subject: [PATCH] Fix the schemas for custom data The current schema only includes string/base64 which is used for non JSON data. customData may include either JSON (object) or base64 encoded content (string). Fix one of the examples in the spec that was possibly misleading. Signed-off-by: Andrea Frittoli --- schemas/artifactpackaged.json | 11 +++++++++-- schemas/artifactpublished.json | 11 +++++++++-- schemas/branchcreated.json | 11 +++++++++-- schemas/branchdeleted.json | 11 +++++++++-- schemas/buildfinished.json | 11 +++++++++-- schemas/buildqueued.json | 11 +++++++++-- schemas/buildstarted.json | 11 +++++++++-- schemas/changeabandoned.json | 11 +++++++++-- schemas/changecreated.json | 11 +++++++++-- schemas/changemerged.json | 11 +++++++++-- schemas/changereviewed.json | 11 +++++++++-- schemas/changeupdated.json | 11 +++++++++-- schemas/environmentcreated.json | 11 +++++++++-- schemas/environmentdeleted.json | 11 +++++++++-- schemas/environmentmodified.json | 11 +++++++++-- schemas/pipelinerunfinished.json | 11 +++++++++-- schemas/pipelinerunqueued.json | 11 +++++++++-- schemas/pipelinerunstarted.json | 11 +++++++++-- schemas/repositorycreated.json | 11 +++++++++-- schemas/repositorydeleted.json | 11 +++++++++-- schemas/repositorymodified.json | 11 +++++++++-- schemas/servicedeployed.json | 11 +++++++++-- schemas/servicepublished.json | 11 +++++++++-- schemas/serviceremoved.json | 11 +++++++++-- schemas/servicerolledback.json | 11 +++++++++-- schemas/serviceupgraded.json | 11 +++++++++-- schemas/taskrunfinished.json | 11 +++++++++-- schemas/taskrunstarted.json | 11 +++++++++-- schemas/testcasefinished.json | 11 +++++++++-- schemas/testcasequeued.json | 11 +++++++++-- schemas/testcasestarted.json | 11 +++++++++-- schemas/testsuitefinished.json | 11 +++++++++-- schemas/testsuitestarted.json | 11 +++++++++-- spec.md | 4 ++-- 34 files changed, 299 insertions(+), 68 deletions(-) diff --git a/schemas/artifactpackaged.json b/schemas/artifactpackaged.json index 24826523..832ea4e1 100644 --- a/schemas/artifactpackaged.json +++ b/schemas/artifactpackaged.json @@ -86,8 +86,15 @@ ] }, "customData": { - "type": "string", - "contentEncoding": "base64" + "oneOf": [ + { + "type": "object" + }, + { + "type": "string", + "contentEncoding": "base64" + } + ] }, "customDataContentType": { "type": "string" diff --git a/schemas/artifactpublished.json b/schemas/artifactpublished.json index 05813319..33230cf4 100644 --- a/schemas/artifactpublished.json +++ b/schemas/artifactpublished.json @@ -66,8 +66,15 @@ ] }, "customData": { - "type": "string", - "contentEncoding": "base64" + "oneOf": [ + { + "type": "object" + }, + { + "type": "string", + "contentEncoding": "base64" + } + ] }, "customDataContentType": { "type": "string" diff --git a/schemas/branchcreated.json b/schemas/branchcreated.json index a14c22d7..0defa15a 100644 --- a/schemas/branchcreated.json +++ b/schemas/branchcreated.json @@ -86,8 +86,15 @@ ] }, "customData": { - "type": "string", - "contentEncoding": "base64" + "oneOf": [ + { + "type": "object" + }, + { + "type": "string", + "contentEncoding": "base64" + } + ] }, "customDataContentType": { "type": "string" diff --git a/schemas/branchdeleted.json b/schemas/branchdeleted.json index 11da3697..d7b9f954 100644 --- a/schemas/branchdeleted.json +++ b/schemas/branchdeleted.json @@ -86,8 +86,15 @@ ] }, "customData": { - "type": "string", - "contentEncoding": "base64" + "oneOf": [ + { + "type": "object" + }, + { + "type": "string", + "contentEncoding": "base64" + } + ] }, "customDataContentType": { "type": "string" diff --git a/schemas/buildfinished.json b/schemas/buildfinished.json index 96b2573f..f5c2594a 100644 --- a/schemas/buildfinished.json +++ b/schemas/buildfinished.json @@ -70,8 +70,15 @@ ] }, "customData": { - "type": "string", - "contentEncoding": "base64" + "oneOf": [ + { + "type": "object" + }, + { + "type": "string", + "contentEncoding": "base64" + } + ] }, "customDataContentType": { "type": "string" diff --git a/schemas/buildqueued.json b/schemas/buildqueued.json index a03833da..8812edc8 100644 --- a/schemas/buildqueued.json +++ b/schemas/buildqueued.json @@ -66,8 +66,15 @@ ] }, "customData": { - "type": "string", - "contentEncoding": "base64" + "oneOf": [ + { + "type": "object" + }, + { + "type": "string", + "contentEncoding": "base64" + } + ] }, "customDataContentType": { "type": "string" diff --git a/schemas/buildstarted.json b/schemas/buildstarted.json index 9986120a..8a0733c1 100644 --- a/schemas/buildstarted.json +++ b/schemas/buildstarted.json @@ -66,8 +66,15 @@ ] }, "customData": { - "type": "string", - "contentEncoding": "base64" + "oneOf": [ + { + "type": "object" + }, + { + "type": "string", + "contentEncoding": "base64" + } + ] }, "customDataContentType": { "type": "string" diff --git a/schemas/changeabandoned.json b/schemas/changeabandoned.json index 4f5bbbb5..33a9fbda 100644 --- a/schemas/changeabandoned.json +++ b/schemas/changeabandoned.json @@ -86,8 +86,15 @@ ] }, "customData": { - "type": "string", - "contentEncoding": "base64" + "oneOf": [ + { + "type": "object" + }, + { + "type": "string", + "contentEncoding": "base64" + } + ] }, "customDataContentType": { "type": "string" diff --git a/schemas/changecreated.json b/schemas/changecreated.json index 198891e3..60daf87e 100644 --- a/schemas/changecreated.json +++ b/schemas/changecreated.json @@ -86,8 +86,15 @@ ] }, "customData": { - "type": "string", - "contentEncoding": "base64" + "oneOf": [ + { + "type": "object" + }, + { + "type": "string", + "contentEncoding": "base64" + } + ] }, "customDataContentType": { "type": "string" diff --git a/schemas/changemerged.json b/schemas/changemerged.json index fcd13699..e7970be2 100644 --- a/schemas/changemerged.json +++ b/schemas/changemerged.json @@ -86,8 +86,15 @@ ] }, "customData": { - "type": "string", - "contentEncoding": "base64" + "oneOf": [ + { + "type": "object" + }, + { + "type": "string", + "contentEncoding": "base64" + } + ] }, "customDataContentType": { "type": "string" diff --git a/schemas/changereviewed.json b/schemas/changereviewed.json index f73658c7..0781cd46 100644 --- a/schemas/changereviewed.json +++ b/schemas/changereviewed.json @@ -86,8 +86,15 @@ ] }, "customData": { - "type": "string", - "contentEncoding": "base64" + "oneOf": [ + { + "type": "object" + }, + { + "type": "string", + "contentEncoding": "base64" + } + ] }, "customDataContentType": { "type": "string" diff --git a/schemas/changeupdated.json b/schemas/changeupdated.json index c3e0032c..815ceec5 100644 --- a/schemas/changeupdated.json +++ b/schemas/changeupdated.json @@ -86,8 +86,15 @@ ] }, "customData": { - "type": "string", - "contentEncoding": "base64" + "oneOf": [ + { + "type": "object" + }, + { + "type": "string", + "contentEncoding": "base64" + } + ] }, "customDataContentType": { "type": "string" diff --git a/schemas/environmentcreated.json b/schemas/environmentcreated.json index 21a9773f..0fd9186e 100644 --- a/schemas/environmentcreated.json +++ b/schemas/environmentcreated.json @@ -73,8 +73,15 @@ ] }, "customData": { - "type": "string", - "contentEncoding": "base64" + "oneOf": [ + { + "type": "object" + }, + { + "type": "string", + "contentEncoding": "base64" + } + ] }, "customDataContentType": { "type": "string" diff --git a/schemas/environmentdeleted.json b/schemas/environmentdeleted.json index 1ee91c84..064346ef 100644 --- a/schemas/environmentdeleted.json +++ b/schemas/environmentdeleted.json @@ -70,8 +70,15 @@ ] }, "customData": { - "type": "string", - "contentEncoding": "base64" + "oneOf": [ + { + "type": "object" + }, + { + "type": "string", + "contentEncoding": "base64" + } + ] }, "customDataContentType": { "type": "string" diff --git a/schemas/environmentmodified.json b/schemas/environmentmodified.json index 8f96a918..06193968 100644 --- a/schemas/environmentmodified.json +++ b/schemas/environmentmodified.json @@ -73,8 +73,15 @@ ] }, "customData": { - "type": "string", - "contentEncoding": "base64" + "oneOf": [ + { + "type": "object" + }, + { + "type": "string", + "contentEncoding": "base64" + } + ] }, "customDataContentType": { "type": "string" diff --git a/schemas/pipelinerunfinished.json b/schemas/pipelinerunfinished.json index 195f4959..7b93c032 100644 --- a/schemas/pipelinerunfinished.json +++ b/schemas/pipelinerunfinished.json @@ -79,8 +79,15 @@ ] }, "customData": { - "type": "string", - "contentEncoding": "base64" + "oneOf": [ + { + "type": "object" + }, + { + "type": "string", + "contentEncoding": "base64" + } + ] }, "customDataContentType": { "type": "string" diff --git a/schemas/pipelinerunqueued.json b/schemas/pipelinerunqueued.json index bd600162..d184bc14 100644 --- a/schemas/pipelinerunqueued.json +++ b/schemas/pipelinerunqueued.json @@ -73,8 +73,15 @@ ] }, "customData": { - "type": "string", - "contentEncoding": "base64" + "oneOf": [ + { + "type": "object" + }, + { + "type": "string", + "contentEncoding": "base64" + } + ] }, "customDataContentType": { "type": "string" diff --git a/schemas/pipelinerunstarted.json b/schemas/pipelinerunstarted.json index ea5546e5..350e357c 100644 --- a/schemas/pipelinerunstarted.json +++ b/schemas/pipelinerunstarted.json @@ -77,8 +77,15 @@ ] }, "customData": { - "type": "string", - "contentEncoding": "base64" + "oneOf": [ + { + "type": "object" + }, + { + "type": "string", + "contentEncoding": "base64" + } + ] }, "customDataContentType": { "type": "string" diff --git a/schemas/repositorycreated.json b/schemas/repositorycreated.json index 633ee662..63fd5801 100644 --- a/schemas/repositorycreated.json +++ b/schemas/repositorycreated.json @@ -85,8 +85,15 @@ ] }, "customData": { - "type": "string", - "contentEncoding": "base64" + "oneOf": [ + { + "type": "object" + }, + { + "type": "string", + "contentEncoding": "base64" + } + ] }, "customDataContentType": { "type": "string" diff --git a/schemas/repositorydeleted.json b/schemas/repositorydeleted.json index 4f7a10fe..f18237c7 100644 --- a/schemas/repositorydeleted.json +++ b/schemas/repositorydeleted.json @@ -79,8 +79,15 @@ ] }, "customData": { - "type": "string", - "contentEncoding": "base64" + "oneOf": [ + { + "type": "object" + }, + { + "type": "string", + "contentEncoding": "base64" + } + ] }, "customDataContentType": { "type": "string" diff --git a/schemas/repositorymodified.json b/schemas/repositorymodified.json index 57e5b4cd..660a07f9 100644 --- a/schemas/repositorymodified.json +++ b/schemas/repositorymodified.json @@ -79,8 +79,15 @@ ] }, "customData": { - "type": "string", - "contentEncoding": "base64" + "oneOf": [ + { + "type": "object" + }, + { + "type": "string", + "contentEncoding": "base64" + } + ] }, "customDataContentType": { "type": "string" diff --git a/schemas/servicedeployed.json b/schemas/servicedeployed.json index b88f3b33..9fa6acc4 100644 --- a/schemas/servicedeployed.json +++ b/schemas/servicedeployed.json @@ -91,8 +91,15 @@ ] }, "customData": { - "type": "string", - "contentEncoding": "base64" + "oneOf": [ + { + "type": "object" + }, + { + "type": "string", + "contentEncoding": "base64" + } + ] }, "customDataContentType": { "type": "string" diff --git a/schemas/servicepublished.json b/schemas/servicepublished.json index 5aefd8c7..807b6840 100644 --- a/schemas/servicepublished.json +++ b/schemas/servicepublished.json @@ -83,8 +83,15 @@ ] }, "customData": { - "type": "string", - "contentEncoding": "base64" + "oneOf": [ + { + "type": "object" + }, + { + "type": "string", + "contentEncoding": "base64" + } + ] }, "customDataContentType": { "type": "string" diff --git a/schemas/serviceremoved.json b/schemas/serviceremoved.json index e1a22e3e..b762b798 100644 --- a/schemas/serviceremoved.json +++ b/schemas/serviceremoved.json @@ -83,8 +83,15 @@ ] }, "customData": { - "type": "string", - "contentEncoding": "base64" + "oneOf": [ + { + "type": "object" + }, + { + "type": "string", + "contentEncoding": "base64" + } + ] }, "customDataContentType": { "type": "string" diff --git a/schemas/servicerolledback.json b/schemas/servicerolledback.json index b8bca8f1..7411cead 100644 --- a/schemas/servicerolledback.json +++ b/schemas/servicerolledback.json @@ -91,8 +91,15 @@ ] }, "customData": { - "type": "string", - "contentEncoding": "base64" + "oneOf": [ + { + "type": "object" + }, + { + "type": "string", + "contentEncoding": "base64" + } + ] }, "customDataContentType": { "type": "string" diff --git a/schemas/serviceupgraded.json b/schemas/serviceupgraded.json index ab8d72fe..acd3c6ff 100644 --- a/schemas/serviceupgraded.json +++ b/schemas/serviceupgraded.json @@ -91,8 +91,15 @@ ] }, "customData": { - "type": "string", - "contentEncoding": "base64" + "oneOf": [ + { + "type": "object" + }, + { + "type": "string", + "contentEncoding": "base64" + } + ] }, "customDataContentType": { "type": "string" diff --git a/schemas/taskrunfinished.json b/schemas/taskrunfinished.json index 1e4e295c..659c4963 100644 --- a/schemas/taskrunfinished.json +++ b/schemas/taskrunfinished.json @@ -95,8 +95,15 @@ ] }, "customData": { - "type": "string", - "contentEncoding": "base64" + "oneOf": [ + { + "type": "object" + }, + { + "type": "string", + "contentEncoding": "base64" + } + ] }, "customDataContentType": { "type": "string" diff --git a/schemas/taskrunstarted.json b/schemas/taskrunstarted.json index 0223557f..bba3a83a 100644 --- a/schemas/taskrunstarted.json +++ b/schemas/taskrunstarted.json @@ -89,8 +89,15 @@ ] }, "customData": { - "type": "string", - "contentEncoding": "base64" + "oneOf": [ + { + "type": "object" + }, + { + "type": "string", + "contentEncoding": "base64" + } + ] }, "customDataContentType": { "type": "string" diff --git a/schemas/testcasefinished.json b/schemas/testcasefinished.json index 546227ba..7e97b69c 100644 --- a/schemas/testcasefinished.json +++ b/schemas/testcasefinished.json @@ -66,8 +66,15 @@ ] }, "customData": { - "type": "string", - "contentEncoding": "base64" + "oneOf": [ + { + "type": "object" + }, + { + "type": "string", + "contentEncoding": "base64" + } + ] }, "customDataContentType": { "type": "string" diff --git a/schemas/testcasequeued.json b/schemas/testcasequeued.json index 7bfb451d..9eca8418 100644 --- a/schemas/testcasequeued.json +++ b/schemas/testcasequeued.json @@ -66,8 +66,15 @@ ] }, "customData": { - "type": "string", - "contentEncoding": "base64" + "oneOf": [ + { + "type": "object" + }, + { + "type": "string", + "contentEncoding": "base64" + } + ] }, "customDataContentType": { "type": "string" diff --git a/schemas/testcasestarted.json b/schemas/testcasestarted.json index 148796d1..c9a35bfc 100644 --- a/schemas/testcasestarted.json +++ b/schemas/testcasestarted.json @@ -66,8 +66,15 @@ ] }, "customData": { - "type": "string", - "contentEncoding": "base64" + "oneOf": [ + { + "type": "object" + }, + { + "type": "string", + "contentEncoding": "base64" + } + ] }, "customDataContentType": { "type": "string" diff --git a/schemas/testsuitefinished.json b/schemas/testsuitefinished.json index ad45c7a2..0d328800 100644 --- a/schemas/testsuitefinished.json +++ b/schemas/testsuitefinished.json @@ -66,8 +66,15 @@ ] }, "customData": { - "type": "string", - "contentEncoding": "base64" + "oneOf": [ + { + "type": "object" + }, + { + "type": "string", + "contentEncoding": "base64" + } + ] }, "customDataContentType": { "type": "string" diff --git a/schemas/testsuitestarted.json b/schemas/testsuitestarted.json index 809e5d42..4335d20c 100644 --- a/schemas/testsuitestarted.json +++ b/schemas/testsuitestarted.json @@ -66,8 +66,15 @@ ] }, "customData": { - "type": "string", - "contentEncoding": "base64" + "oneOf": [ + { + "type": "object" + }, + { + "type": "string", + "contentEncoding": "base64" + } + ] }, "customDataContentType": { "type": "string" diff --git a/spec.md b/spec.md index 97e17b30..cf74d330 100644 --- a/spec.md +++ b/spec.md @@ -396,8 +396,8 @@ additional data in CDEvents. - OPTIONAL - Examples: - - '{"mydata1": "myvalue1"}' - - 'VGhlIHZvY2FidWxhcnkgZGVmaW5lcyAqZXZlbnQgdHlwZXMqLCB3aGljaCBhcmUgbWFkZSBvZiAqc3ViamVjdHMqCg==' + - `{"mydata1": "myvalue1"}` + - `"VGhlIHZvY2FidWxhcnkgZGVmaW5lcyAqZXZlbnQgdHlwZXMqLCB3aGljaCBhcmUgbWFkZSBvZiAqc3ViamVjdHMqCg=="` #### customDataContentType