-
Notifications
You must be signed in to change notification settings - Fork 234
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
Provider state parameters are serialised as numbers, causes errors in provider state middleware when using System.Text.Json #449
Comments
Thanks for the report 👍 I'll check out whether the problem is happening in PactNet itself or whether it's after we've passed to the FFI library. If it's the latter, and gut feel is that it is, then I'll raise an issue on the other repo and link here. |
I've added a test which reproduces the issue, and confirms that this is an issue in I'll raise an upstream issue and link here. |
Unfortunately the upstream maintainers closed the linked issue I created to change this as they believe it's working as expected, and so there's nothing I can do to change this issue. I've added a comment saying I don't agree that's working as expected, but that's where we are unfortunately. |
Added a comment here about a resolution from reading the linked issue, which appears to resolve the issue reproduction. (great things to have to hand!) |
question - how would you expect someone to pass in an integer value here if the signatures are strings for end users? |
I've been reflecting on this overnight and I'm sorry you feel that there is nothing you can do to change this issue. I actually thought that when I read that comment that it was going to be something outside the Pact ecosystem, rather than from inside. We definitely want to find the right, or most pragmatic solution, that works well for as many users, in as many consuming languages as possible! Maybe the current direction isn't correct, but we are always happy to deliberate, and deliberate some more until we can get to a democratised solution :) We are all part of one big (hopefully happy) family! |
If the value of a provider state parameter is a number string, it is serialised in the pact file as a number. This is an issue if the provider state middleware in the provider tests uses System.Text.Json to deserialise a
ProviderState
value as System.Text.Json does not deserialise non-string values into string properties. https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/migrate-from-newtonsoft?pivots=dotnet-6-0#non-string-values-for-string-properties.For example:
generates this pact. Note that parameter "id" is serialised as
10
not"10"
.The text was updated successfully, but these errors were encountered: