Repository navigation
fix: handle 2.x message traits without headers - #58
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 30 minutes. View limit details
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Deserialize headers and schema formats src/ByteBard.AsyncAPI.Readers/V2/AsyncApiMessageTraitDeserializer.cs, test/ByteBard.AsyncAPI.Tests/Models/AsyncApiMessage_Should.cs |
The V2 deserializer preserves an existing headers object or initializes one when applying a schema format. Tests cover schema format ordering and input with no headers. |
Serialize optional headers across versions src/ByteBard.AsyncAPI/Models/AsyncApiMessageTrait.cs, test/ByteBard.AsyncAPI.Tests/Models/AsyncApiMessage_Should.cs |
V2 serialization accesses header schema and format safely. V3 serialization omits headers when no schema exists. Tests cover serialization without headers, V3 header format, and cross-version conversion. |
Priority:
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Suggested reviewers: visualbean
Merge Risk: 
Minimal · up to b08f9
-
The described header-handling changes have no identified issue requiring resolution before merge; normal checks remain appropriate.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passed-
Full details: Description check
-
Explanation
The description clearly explains the three fixes, the 3.x behavior, and the test results. It does not use the template headings or include a formal Changelog or Related Issues section, but the required change context and validation details are present.
-
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
b2a1c0c to
65818e7
Compare
The 2.x writer threw NullReferenceException for a message trait without headers because it read Headers.SchemaFormat unconditionally. The 2.x reader threw too when schemaFormat appeared without headers, or before them, and a later headers field discarded an earlier schemaFormat. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adds 3.x counterparts to the 2.x message trait tests, so the change to the 3.x writer is shown not to regress: a trait without headers, a trait with headers, and a 2.x trait with schemaFormat but no headers upgraded to 3.x. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
b08f9fb to
4f3a7d7
Compare
Fixes a 2.x message trait crash that downstream consumers have to work around (see bielu/Bielu.AspNetCore.ApiDescriptions#137).
NullReferenceExceptionfor a trait withoutheaders(this.Headers.SchemaFormat).schemaFormatappeared withoutheaders, or before them.headersfield discarded an earlierschemaFormat.All three are fixed. In 3.x output, a trait whose headers have a format but no schema now leaves
headersout.Testing
dotnet test: all pass.🤖 Generated with Claude Code
Summary by CodeRabbit