Regression tests for [JsonPropertyName] on temporal types (closes #4253)#4256
Merged
jeremydmiller merged 1 commit intomasterfrom Apr 16, 2026
Merged
Conversation
Reporter claimed [JsonPropertyName] is ignored for DateTimeOffset
properties in both LINQ Where SQL and CREATE INDEX DDL. Tracing the
code paths showed QueryableMember.ctor correctly delegates to
ToJsonKey() for all types, including DateTimeOffsetMember, DateTimeMember,
DateOnlyMember, and TimeOnlyMember.
Added regression tests that mirror the bug repro exactly across:
- DateTime, DateTimeOffset, DateOnly, TimeOnly in LINQ Where SQL
- DateTimeOffset in CREATE INDEX DDL
- The { required; get; init; } property shape from the bug report
- End-to-end integration query
All tests pass on master; the bug does not reproduce. Keeping these
as regression coverage to prevent future regressions.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This was referenced Apr 17, 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.
Closes #4253
Summary
The issue reported that
[JsonPropertyName("ts")]on aDateTimeOffsetproperty is ignored by Marten's LINQ provider — SQL emits(data ->> 'Timestamp')instead of(data ->> 'ts'), andCREATE INDEXDDL has the same issue.After tracing the code paths on master (8.30.0), the obvious candidates all look correct:
QueryableMemberbase ctor setsRawLocatorusingmember.ToJsonKey(casing)which honors[JsonPropertyName]DateTimeOffsetMember,DateTimeMember,DateOnlyMember,TimeOnlyMemberall inherit this base behaviorComputedIndexresolves members through the sameMemberForpath as LINQI wrote 8 regression tests mirroring the bug repro exactly. All 8 pass on master — the bug does not reproduce on the current code. The reporter may have been on an older build, or there's a reproduction step I'm missing.
Rather than keep the issue open without a reproducible repro, landing these regression tests to prevent future regressions across all temporal types.
Tests added
LINQ Where SQL (
src/LinqTests/Acceptance/json_naming_attributes.cs):recognize_stj_json_property_on_datetimeoffset_in_linqrecognize_stj_json_property_on_datetimeoffset_required_init_in_linq— uses therequired { get; init; }shape from the bug reportrecognize_stj_json_property_on_datetime_in_linqrecognize_stj_json_property_on_dateonly_in_linqrecognize_stj_json_property_on_timeonly_in_linqend_to_end_query_with_datetimeoffset_json_property_name— end-to-end count query from the bug reproIndex DDL (
src/DocumentDbTests/Indexes/computed_indexes.cs):datetimeoffset_index_ddl_uses_json_property_namedatetimeoffset_required_init_index_ddl_uses_json_property_nameTest plan
🤖 Generated with Claude Code