-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JetStream enum PascalCase serializer (#225)
* JetStream enum PascalCase serializer System.Text.Json serializer has some difficult settings serializing enums. Before we just relied on unconventional property names in code but proper way is to use PascalCase. Unfortunately the JSON options also did not allow snake_case conversion also I didn't want to force System.Text.Json v8 onto net6.0 targets (if that supports it). Hence we now have a JetStream specific JSON enum convertor. * net8.0 supports snake_case enums
- Loading branch information
Showing
27 changed files
with
464 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 3 additions & 10 deletions
13
src/NATS.Client.JetStream/Models/ConsumerConfigAckPolicy.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,8 @@ | ||
namespace NATS.Client.JetStream.Models; | ||
|
||
// TODO: enum member naming with JSON serialization isn't working for some reason | ||
#pragma warning disable SA1300 | ||
public enum ConsumerConfigAckPolicy | ||
{ | ||
[System.Runtime.Serialization.EnumMember(Value = @"none")] | ||
none = 0, | ||
|
||
[System.Runtime.Serialization.EnumMember(Value = @"all")] | ||
all = 1, | ||
|
||
[System.Runtime.Serialization.EnumMember(Value = @"explicit")] | ||
@explicit = 2, | ||
None = 0, | ||
All = 1, | ||
Explicit = 2, | ||
} |
Oops, something went wrong.