Fix #668 STJ JsonElement unwrap, #676 docs cleanup, regression guard for #692#737
Merged
Merged
Conversation
sagarambilpure
approved these changes
May 30, 2026
… cleanup, document microsoft#692 for STJ, properties on an ExpandoObject built from JSON came through as JsonElement values. Rule expressions like `input1.country == "india"` then failed with "binary operator Equal is not defined for the types 'JsonElement' and 'System.String'." Utils.CreateAbstractClassType now infers the native CLR type from a JsonElement's ValueKind (string / int / long / double / bool / null), and Utils.CreateObject unwraps JsonElement scalars to their native values before assigning them. Objects and arrays inside the JsonElement keep JsonElement shape — that path is for typed Newtonsoft-style models that weren't using ExpandoObject anyway. in JSON examples across README.md, docs/Getting-Started.md, and docs/index.md. Removed. after 5.0.4." That's actually standard C# Nullable<T> semantics — both `null < x` and `null > x` are false. The pre-5.0.4 behavior was a Newtonsoft / Dynamic.Core quirk, not the documented contract. Added an explicit test documenting the current behavior plus the canonical `!Dt.HasValue || Dt < someDate` workaround for users who want null-aware ordering. Not changed here: microsoft#679 (rule-chaining via @RuleName) is already covered by in-flight PR microsoft#680 — no point duplicating that work. microsoft#710 and microsoft#709 are unrelated AGV-themed spam; closing comments are in issue-close-comments-batch-5.md. All 164 unit tests pass on net6 / net8 / net9 / net10.
3a97d38 to
ff1b585
Compare
sagarambilpure
approved these changes
May 30, 2026
This was referenced May 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Batch-5 covers four of the six remaining issues. The other two (#679 rule-chaining via
@RuleName, #710/#709 AGV spam) are not addressed in this PR — see "Not in this PR" below.Fixes #668 — System.Text.Json migration: ExpandoObject + JsonElement comparisons broken
After #599 swapped Newtonsoft for STJ, properties on an
ExpandoObjectbuilt from JSON came through asJsonElementvalues. Rule expressions likeinput1.country == "india"then failed with:Utils.CreateAbstractClassTypenow infers the native CLR type from aJsonElement.ValueKind(string / int / long / double / bool / null), andUtils.CreateObjectunwrapsJsonElementscalars to their native values before assigning them. Nested objects and arrays inside theJsonElementkeep theirJsonElementshape — that path is for typed Newtonsoft-style models that weren't usingExpandoObjectanyway.Fixes #676 —
ErrorTyperemoved from docs examplesErrorTypewas removed from theRulemodel in 4.0.0 but still appeared in JSON examples acrossREADME.md,docs/Getting-Started.md, anddocs/index.md. Removed.Regression guard for #692 — nullable
DateTimecomparisons againstnullUser reported "
null < DateTimereturnsfalsein both directions after 5.0.4." That's actually standard C#Nullable<T>semantics — bothnull < xandnull > xare false. The pre-5.0.4 behavior was a Newtonsoft / Dynamic.Core quirk, not the documented contract.Added an explicit test documenting both the current behavior and the canonical workaround:
"!input1.Dt.HasValue || input1.Dt < someDate"