cloudevents / cloudevents/sdk-csharp
Include specversion in CloudEvent.GetPopulatedAttributes
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 334
- Forks
- 88
- Avg merge
- 7m
- Merged PRs (30d)
- 2
Description
Summary
CloudEvent.GetPopulatedAttributes() currently excludes specversion, even though the spec version is always populated on a CloudEvent. Callers that enumerate context attributes therefore omit a required CloudEvents attribute unless they special-case CloudEvent.SpecVersion.VersionId.
Cross-SDK behavior
The Java SDK includes specversion in its equivalent enumeration:
SpecVersion.V1.getAllAttributes()includesspecversion.CloudEventAttributes.getAttributeNames()filters that collection to non-null values.CloudEventImplTest.testGetAttributeNames()explicitly expectsspecversion.
This difference surfaced while mapping a C# CloudEvent to protocol properties by iterating GetPopulatedAttributes(); the resulting event had the other populated attributes but no specversion.
Proposed behavior
Return CloudEventsSpecVersion.SpecVersionAttribute with SpecVersion.VersionId from GetPopulatedAttributes(), alongside other populated context and extension attributes.
The built-in formatters and bindings already serialize spec version separately, so they should skip this pair during their existing enumeration to keep wire output unchanged.
I intend to submit a PR with the implementation, regression test, and updates to internal enumeration call sites.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at CloudEvent.GetPopulatedAttributes() and trace the formatter and binding enumeration call sites mentioned in the issue. Compare the existing C# behavior with the cited Java attribute enumeration tests, then add a regression test showing specversion is returned while serialized wire output remains unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100