Skip to content

[CDX-373] Explicitly type FmtOptions#94

Merged
esezen merged 14 commits intomainfrom
cdx-373-netcore-update-fmtoptions
Mar 2, 2026
Merged

[CDX-373] Explicitly type FmtOptions#94
esezen merged 14 commits intomainfrom
cdx-373-netcore-update-fmtoptions

Conversation

@esezen
Copy link
Contributor

@esezen esezen commented Feb 5, 2026

This is a breaking change. Please do not merge until we land on a release strategy.

@esezen esezen requested a review from Mudaafi as a code owner February 5, 2026 16:52
Copilot AI review requested due to automatic review settings February 5, 2026 16:52
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the FmtOptions parameter from a generic Dictionary<string, string> to a strongly-typed FmtOptions class, improving type safety and API clarity.

Changes:

  • Introduced a new FmtOptions class with explicitly typed properties for all format options
  • Updated request models to use the new FmtOptions type instead of Dictionary<string, string>
  • Modified URL building logic in Helpers.cs to handle the strongly-typed FmtOptions object with separate handling for scalar and array properties

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/constructor.io/models/common/FmtOptions.cs New strongly-typed class defining all format option properties with documentation
src/constructor.io/utils/Helpers.cs Updated URL building to serialize FmtOptions properties individually with new helper methods
src/constructor.io/models/common/IPlpRequest.cs Changed FmtOptions property type from dictionary to typed class
src/constructor.io/models/Search/SearchRequest.cs Updated FmtOptions property type to use new class
src/constructor.io/models/Browse/BrowseRequest.cs Updated FmtOptions property type to use new class
src/constructor.io/models/Browse/BrowseItemsRequest.cs Updated FmtOptions property type to use new class
src/constructor.io/models/Browse/BrowseFacetsRequest.cs Refactored to use strongly-typed FmtOptions with null-coalescing initialization
src/constructor.io/models/Browse/BrowseFacetOptionsRequest.cs Refactored to use strongly-typed FmtOptions with null-coalescing initialization
src/Constructorio_NET.Tests/utils/HelpersTest.cs Added comprehensive tests for new FmtOptions serialization including array handling

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@Alexey-Pavlov Alexey-Pavlov left a comment

Choose a reason for hiding this comment

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

Looks great, thanks so much! I’ve left a few comments—when you get a moment, could you take a look?

esezen and others added 3 commits February 12, 2026 15:54
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@esezen esezen requested a review from Alexey-Pavlov February 12, 2026 12:20
Alexey-Pavlov
Alexey-Pavlov previously approved these changes Feb 12, 2026
Copy link
Contributor

@Alexey-Pavlov Alexey-Pavlov left a comment

Choose a reason for hiding this comment

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

Thank you for making changes! LGTM!

Copy link
Contributor

@Mudaafi Mudaafi left a comment

Choose a reason for hiding this comment

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

Thanks for working on this refactor @esezen! I had some comments on the implementation, but lmk what you think

* Add rex support

* Update src/Constructorio_NET.Tests/client/modules/RecommendationsTests.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update tests

* Fix flaky test

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 20 out of 20 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 180 to 182
// Add quiz answers to query string
if (queryParams.Contains(Constants.ANSWERS))
{
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

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

MakeUrl no longer has a dedicated branch for Constants.FMT_OPTIONS / Constants.HIDDEN_FIELDS / Constants.HIDDEN_FACETS. If any caller still passes the legacy shapes (e.g., FMT_OPTIONS as Dictionary<string,string>), those entries will now be silently ignored (no query string output) because the "remaining query params" loop only handles string, int, List<string>, and bool. Consider either keeping backward-compatible serialization for these keys or explicitly throwing a clear exception when legacy keys are present so the failure mode isn’t silent.

Copilot uses AI. Check for mistakes.
Mudaafi
Mudaafi previously approved these changes Feb 26, 2026
Copy link
Contributor

@Mudaafi Mudaafi left a comment

Choose a reason for hiding this comment

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

LGTM, just one comment. @Alexey-Pavlov mind taking a second look?

Comment on lines +359 to +371
if (res.Response.Results.Count > 0)
{
var metadata = res.Response.Results[0].Data?.Metadata;
Assert.IsNotNull(metadata, "Result metadata exists");
Assert.IsTrue(
metadata.ContainsKey(requestedHiddenField),
"Requested hidden field is present in result metadata"
);
Assert.IsNotNull(
metadata[requestedHiddenField],
"Requested hidden field has a non-null value in result metadata"
);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we throw an error if results.Count = 0? If it's ever zero, and this functionality breaks, we wouldn't be aware.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, updated

Alexey-Pavlov
Alexey-Pavlov previously approved these changes Feb 27, 2026
Copy link
Contributor

@Alexey-Pavlov Alexey-Pavlov left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you! Left some minor comments

@esezen esezen dismissed stale reviews from Alexey-Pavlov and Mudaafi via b6eb23f February 27, 2026 19:28
@esezen esezen merged commit 0963f79 into main Mar 2, 2026
1 check failed
@esezen esezen deleted the cdx-373-netcore-update-fmtoptions branch March 2, 2026 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants