Updating the Java-SDK to the CDEvents Spec - v0.1.0#12
Updating the Java-SDK to the CDEvents Spec - v0.1.0#12adamkenihan wants to merge 8 commits intocdevents:mainfrom
Conversation
|
|
||
|
|
||
| private static String getVersion() { | ||
| return "0.1.0"; |
There was a problem hiding this comment.
add this as static final constant class level variable.
|
Thanks, @adamkenihan for this! How do you plan on managing the migration to the new format? |
| public static CloudEvent createTaskRunStartedEvent( | ||
| final String eventType, final String id, | ||
| final URI source, final String taskName, | ||
| final String pipelineRun, final URI url, |
There was a problem hiding this comment.
Here the pipelineRun is an object of PipelineRun Event defined at https://github.com/cdevents/spec/blob/v0.1.0/core.md#pipelinerun instead of String
| public static CloudEvent createTaskRunFinishedEvent( | ||
| final String eventType, final String id, | ||
| final URI source, final String taskName, | ||
| final String pipelineRun, final URI url, |
There was a problem hiding this comment.
Same as above pipelineRun should be an object of PipelineRun Event
| * @param pipelineName | ||
| * @param url | ||
| * @param errors | ||
| * @param outcome |
There was a problem hiding this comment.
Use Auto "generate element comment" for each method to add this Java doc and avoid declaring missing params, this resolves many of Lint code errors
| .withExtension("name", name) | ||
| .withExtension("owner",owner) | ||
| .withExtension("url", url) | ||
| .withExtension("view", view) |
There was a problem hiding this comment.
update this with the ("viewUrl", viewUrl), this field is viewUrl as per the spec
| .withExtension("name", name) | ||
| .withExtension("owner",owner) | ||
| .withExtension("url", url) | ||
| .withExtension("view", view) |
There was a problem hiding this comment.
update this with the ("viewUrl", viewUrl),
| .withExtension("name", name) | ||
| .withExtension("owner",owner) | ||
| .withExtension("url", url) | ||
| .withExtension("view", view) |
There was a problem hiding this comment.
update this with the ("viewUrl", viewUrl),
| */ | ||
| public static CloudEvent createBranchCreatedEvent( | ||
| final String eventType, final String id, | ||
| final URI source, final String repository, |
There was a problem hiding this comment.
repository should be an object of Repository, defined at https://github.com/cdevents/spec/blob/v0.1.0/source-code-version-control.md#repository,
Need the same change for all of the Branch and Change events below
…d Repository objects.
| buildCloudEvent(eventType, data) | ||
| .withExtension("id", id) | ||
| .withExtension("source", source) | ||
| .withExtension("repository", repository.toString()) |
There was a problem hiding this comment.
please use jackson-databind to write this repository as String, say objectMapper.writeValueAsString(repository)
| buildCloudEvent(eventType, data) | ||
| .withExtension("id", id) | ||
| .withExtension("source", source) | ||
| .withExtension("repository", repository.toString()) |
There was a problem hiding this comment.
please use jackson-databind to write this repository as String, say objectMapper.writeValueAsString(repository)
| buildCloudEvent(eventType, data) | ||
| .withExtension("id", id) | ||
| .withExtension("source", source) | ||
| .withExtension("repository", repository.toString()) |
There was a problem hiding this comment.
please use jackson-databind to write this repository as String, say objectMapper.writeValueAsString(repository)
| buildCloudEvent(eventType, data) | ||
| .withExtension("id", id) | ||
| .withExtension("source", source) | ||
| .withExtension("repository", repository.toString()) |
There was a problem hiding this comment.
please use jackson-databind to write this repository as String, say objectMapper.writeValueAsString(repository)
| buildCloudEvent(eventType, data) | ||
| .withExtension("id", id) | ||
| .withExtension("source", source) | ||
| .withExtension("repository", repository.toString()) |
There was a problem hiding this comment.
please use jackson-databind to write this repository as String, say objectMapper.writeValueAsString(repository)
| .withExtension("id", id) | ||
| .withExtension("source", source) | ||
| .withExtension("taskname", taskName) | ||
| .withExtension("pipelinerun", pipelineRun.toString()) |
There was a problem hiding this comment.
please use jackson-databind to write this pipelineRun as String, say objectMapper.writeValueAsString(pipelineRun)
| .withExtension("id", id) | ||
| .withExtension("source", source) | ||
| .withExtension("taskname", taskName) | ||
| .withExtension("pipelinerun", pipelineRun.toString()) |
There was a problem hiding this comment.
please use jackson-databind to write this pipelineRun as String, say objectMapper.writeValueAsString(pipelineRun)
| buildCloudEvent(eventType, data) | ||
| .withExtension("id", id) | ||
| .withExtension("source", source) | ||
| .withExtension("repository", repository.toString()) |
There was a problem hiding this comment.
please use jackson-databind to write this repository as String, say objectMapper.writeValueAsString(repository)
| buildCloudEvent(eventType, data) | ||
| .withExtension("id", id) | ||
| .withExtension("source", source) | ||
| .withExtension("repository", repository.toString()) |
There was a problem hiding this comment.
please use jackson-databind to write this repository as String, say objectMapper.writeValueAsString(repository)
| CloudEvent cdToSend = | ||
| buildCloudEvent(eventType, data) | ||
| .withExtension("id", id) | ||
| .withExtension("environment", environment.toString()) |
There was a problem hiding this comment.
please use jackson-databind to write this environment as String, say objectMapper.writeValueAsString(environment)
| CloudEvent cdToSend = | ||
| buildCloudEvent(eventType, data) | ||
| .withExtension("id", id) | ||
| .withExtension("environment", environment.toString()) |
There was a problem hiding this comment.
please use jackson-databind to write this environment as String, say objectMapper.writeValueAsString(environment)
| CloudEvent cdToSend = | ||
| buildCloudEvent(eventType, data) | ||
| .withExtension("id", id) | ||
| .withExtension("environment", environment.toString()) |
There was a problem hiding this comment.
please use jackson-databind to write this environment as String, say objectMapper.writeValueAsString(environment)
| CloudEvent cdToSend = | ||
| buildCloudEvent(eventType, data) | ||
| .withExtension("id", id) | ||
| .withExtension("environment", environment.toString()) |
There was a problem hiding this comment.
please use jackson-databind to write this environment as String, say objectMapper.writeValueAsString(environment)
| CloudEvent cdToSend = | ||
| buildCloudEvent(eventType, data) | ||
| .withExtension("id", id) | ||
| .withExtension("environment", environment.toString()) |
There was a problem hiding this comment.
please use jackson-databind to write this environment as String, say objectMapper.writeValueAsString(environment)
|
@rjalander , will you be able to review this so it can be merged? |
|
@adamkenihan please update the PR description as the changes are not only for pipeline events and mention the changes along with the issue #11 |
|
Thank you @adamkenihan |
|
Closing this PR as the same changes raised through Nordix repo https://github.com/Nordix/sdk-java |
Updated events to align with version 0.1.0 spec as described with issue #11