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

[Typing] Remove the implicit JSON check #826

Closed
wants to merge 1 commit into from
Closed

[Typing] Remove the implicit JSON check #826

wants to merge 1 commit into from

Conversation

Tang8330
Copy link
Contributor

@Tang8330 Tang8330 commented Jul 30, 2024

We are already parsing JSON here. This PR removes the need for us to implicitly check if a string is a JSON object or not.

We will only label something as JSON if the schema provided, it or payload itself is a map.


return string(colValBytes), nil
isArray := reflect.ValueOf(colVal).Kind() == reflect.Slice
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lifted this from typing.String.Kind

if err != nil {
return "", err
}
if strings.Contains(fmt.Sprint(colVal), constants.ToastUnavailableValuePlaceholder) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to create a map just to have it marshaled, we can do it ourselves. Also the if statement is a no-op given the case.

@Tang8330 Tang8330 changed the title [Typing] Removing the need to check JSON explicitly [Typing] Remove the implicit JSON check Jul 30, 2024
@Tang8330 Tang8330 marked this pull request as ready for review July 30, 2024 17:00
@Tang8330 Tang8330 marked this pull request as draft July 30, 2024 18:03
@Tang8330 Tang8330 closed this Aug 14, 2024
@Tang8330 Tang8330 deleted the clean-up branch August 20, 2024 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant