-
Notifications
You must be signed in to change notification settings - Fork 571
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
System.Text.Json Serialization Support in .NET SDK Objects #3033
Conversation
modified PropertiesHaveJsonAttributes to check for equivalent STJ attributes
…son attributes added json converters for system text json to ensure we conform to our API and existing SDK behavior
migrated manually managed files
updated wholesome tests for better reporting
updated classes with Deleted properties
added NewtonsoftAndSystemTextJsonOutputTheSameObject wholesome test, to ensure all stripe entities serialize the same through json.net and system text json added STJEnumerableObjectConverter because STJ serializes IEnumerable implementations as arrays and not objects
added test to verify that enumerable item types have the proper STJ converters updated wholesome tests
…pe-dotnet into jar/coexist-system-text-json
The build failure is not expected, and appears to be due to a significant difference between .NET 6 and .NET 8. |
…nt JsonObject(MemberSerialization.OptIn) functionality in System Text Json. This is needed because JsonInclude does not work the same in .NET 6 and .NET 7 as it does in .NET 8 added SerializablePropertyCache and other supporting classes converted several converters to converter factories, for type safety updated comments updated generated code
…nverter added wholesome test for member serialization opt in converter annotation updated WholesomeTest GetProperties to use more accurate selector
src/Stripe.net/Infrastructure/JsonConverters/STJAnyOfConverter.cs
Outdated
Show resolved
Hide resolved
src/Stripe.net/Infrastructure/JsonConverters/STJStripeObjectConverter.cs
Outdated
Show resolved
Hide resolved
src/Stripe.net/Infrastructure/JsonConverters/STJStripeObjectConverter.cs
Outdated
Show resolved
Hide resolved
src/Stripe.net/Infrastructure/JsonConverters/STJStripeObjectConverter.cs
Show resolved
Hide resolved
…events are properly serializes refactored custom serialization to pull out common reusable logic updated wholesome tests to verify lists of V2 event subclasses and the custom converter updated no attributes needed attribute string with better descriptions removed GetRawText calls; we can use the JsonElement directly
added section to readme
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the detailed tests, looks awesome 🚀
Compat failures are expected and ok, and appear to be because of this change: https://github.com/stripe/sdk-codegen/pull/1954 |
Why?
Users reported in #2495 and #1979 that Stripe.net objects did not behave as expected when serialized using System.Text.Json. System.Text.Json has become the standard for modern .NET, and the Stripe.net SDK objects should support serializing using it.
What?
Changelog