Skip to content
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

Conversation

BrianLParker
Copy link
Collaborator

@BrianLParker BrianLParker commented May 23, 2023

@hassanhabib @Catalin-Andronie

Closes #130
Closes #132

POC Repo (Reference this branch ...)

Output Screenshot
image

@BrianLParker BrianLParker marked this pull request as draft May 23, 2023 16:47
Copy link
Contributor

@Catalin-Andronie Catalin-Andronie left a 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()
Copy link
Contributor

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.

Suggested change
_ => propertyValue.ToString()
_ => propertyValue?.ToString()

@hassanhabib
Copy link
Owner

@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()
Copy link
Owner

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?

Copy link
Collaborator Author

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.

@Catalin-Andronie
Copy link
Contributor

@hassanhabib @BrianLParker any news about this?
We need this to be merged in order to continue implementing CLIENTS: Transcript Audio File.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants