Skip to content

Adds test and lets us test against empty strings #28021

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

Merged
merged 1 commit into from
Nov 23, 2020

Conversation

henriksen
Copy link
Contributor

@henriksen henriksen commented Nov 20, 2020

Summary of the changes (Less than 80 chars)

  • When using JsonPatch.Test, this removes check for current value being null or empty.

Addresses #28019

This makes it compliant with RFC6902 4.6 saying

Here, "equal" means that the value at the target location and the
   value conveyed by "value" are of the same JSON type, and that they
   are considered equal by the following rules for that type:

   o  strings: are considered equal if they contain the same number of
      Unicode characters and their code points are byte-by-byte equal.

Two empty strings should be equal.

Might also want to remove the null check on current value completely, seeing as RFC6902 specifies that literals (false, true, and null): are considered equal if they are the same. Testing a null value against a null value would now fail. As I read the spec, they should be considered equal.

@dnfadmin
Copy link

dnfadmin commented Nov 20, 2020

CLA assistant check
All CLA requirements met.

@mkArtakMSFT mkArtakMSFT added community-contribution Indicates that the PR has been added by a community member area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates labels Nov 20, 2020
@mkArtakMSFT
Copy link
Contributor

Thanks for your PR, @henriksen
@pranavkm can you please review this? Thanks!

@henriksen
Copy link
Contributor Author

Let me know if removing the null check should be a separate PR, or if I should just include it here.

@pranavkm
Copy link
Contributor

@henriksen could you send a separate PR for the null change? Thanks!

@pranavkm pranavkm merged commit d731ce9 into dotnet:master Nov 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants