Repository navigation
Commit e653de6
committed
refactor: Prevent duplicate schema serialization errors in AsyncAPI components
The serialization logic in AsyncApiComponents.cs is updated to remove the explicit distinct filtering when writing schemas for JSON and MultiFormat types. This change addresses a regression where inlining recursive schemas reached by multiple references previously caused an error ("An item with the same key has already been added").
This change is supported by updating the serialization logic in src/ByteBard.AsyncAPI/Models/AsyncApiComponents.cs to remove the distinct filtering logic for AsyncApiJsonSchemaReference and AsyncApiMultiFormatSchemaReference when writing schemas.
A corresponding regression test in test/ByteBard.AsyncAPI.Tests/Models/AsyncApiSchema_Should.cs has been added to verify that serializing components with recursive references reached multiple times no longer throws an error.1 parent 70e73db commit e653de6
2 files changed
Lines changed: 42 additions & 7 deletions
File tree
- src/ByteBard.AsyncAPI/Models
- test/ByteBard.AsyncAPI.Tests/Models
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | 5 | | |
7 | 6 | | |
8 | 7 | | |
| |||
129 | 128 | | |
130 | 129 | | |
131 | 130 | | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | 131 | | |
136 | 132 | | |
137 | 133 | | |
| |||
395 | 391 | | |
396 | 392 | | |
397 | 393 | | |
398 | | - | |
399 | | - | |
400 | | - | |
401 | 394 | | |
402 | 395 | | |
403 | 396 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
712 | 712 | | |
713 | 713 | | |
714 | 714 | | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
715 | 757 | | |
716 | 758 | | |
0 commit comments