fix: differentiate explicitly empty string delimiter from "no delimiter" - #2295
Open
rmja wants to merge 4 commits into
Open
fix: differentiate explicitly empty string delimiter from "no delimiter"#2295rmja wants to merge 4 commits into
rmja wants to merge 4 commits into
Conversation
Contributor
Author
|
Worth flagging since it's a judgement call and not purely mechanical: this makes the fix touch a test that was written deliberately. The argument is parity — for the Indexed path the generator was the only one inserting the dot, and TryBuildIndexedCollectionModel requires data.CollectionFormatValue.HasValue, which requires a [Query] attribute, which always carries a non-null Delimiter. So the ?? DefaultNestingDelimiter fallback on that path is now purely defensive and unreachable in practice. |
Contributor
Author
|
Great. It seems CI is finally happy. Let me know what you think! |
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.
What kind of change does this PR introduce?
Fixes #2294.
What is the new behavior?
QueryFormDataisdefaultwhen no[Query]attribute is present, soDelimiter is nullin that case — theIsNullOrEmptyguard was there for the absent case, but it swallows""along with it. Nowdata.Delimiter ?? DefaultNestingDelimiter, withDelimiterretyped tostring?so the absent case is expressed as null rather than leaning on emptiness. Three call sites: object query,CollectionFormat.Indexedcollections, and path-residual queries.What is the current behavior?
The source generated and reflection client generates different queries for empty string delimiters.
What might this PR break?
There should be none, as this pr fixes a mismatch between the reflection based client generation and source generated client.
Checklist
mainbranchAdditional information