-
Notifications
You must be signed in to change notification settings - Fork 51
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
MINOR FIX: Enable Optional Stringification of Properties as StringCon… #136
MINOR FIX: Enable Optional Stringification of Properties as StringCon… #136
Conversation
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.
@BrianLParker please check my remarks.
{ | ||
"text/json" => ConvertToJsonString(propertyValue, ignoreDefaultValues), | ||
"application/json" => ConvertToJsonString(propertyValue, ignoreDefaultValues), | ||
_ => propertyValue.ToString() |
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.
We should guard for null propertyValue
. This code path is triggered when property
has a default value of null and we don't ignore default values.
_ => propertyValue.ToString() | |
_ => propertyValue?.ToString() |
@BrianLParker @Catalin-Andronie I will review this well. |
@@ -109,7 +109,7 @@ private static string ConvertToString(object propertyValue, string mediaType, bo | |||
{ | |||
"text/json" => ConvertToJsonString(propertyValue, ignoreDefaultValues), | |||
"application/json" => ConvertToJsonString(propertyValue, ignoreDefaultValues), | |||
_ => propertyValue.ToString() | |||
_ => propertyValue?.ToString() |
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.
Where's the test for this Null Guard?
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.
This is still draft the tests are coming. I need to talk re tests and optional serialization as well.
Co-authored-by: Cătălin Andronie <[email protected]>
@hassanhabib @BrianLParker any news about this? |
@hassanhabib @Catalin-Andronie
Closes #130
Closes #132
POC Repo (Reference this branch ...)
Output Screenshot