Skip to content

[CDX-372] Add support for arbitrary redirect data#93

Merged
esezen merged 1 commit intomainfrom
cdx-372-netcore-update-redirectdata
Feb 10, 2026
Merged

[CDX-372] Add support for arbitrary redirect data#93
esezen merged 1 commit intomainfrom
cdx-372-netcore-update-redirectdata

Conversation

@esezen
Copy link
Contributor

@esezen esezen commented Feb 5, 2026

No description provided.

@esezen esezen requested a review from Mudaafi as a code owner February 5, 2026 15:11
Copilot AI review requested due to automatic review settings February 5, 2026 15:11
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 adds support for accessing arbitrary redirect data through an indexer pattern. The RedirectData class now allows callers to access custom metadata fields beyond the predefined Url, RuleId, and MatchId properties.

Changes:

  • Added indexer support to RedirectData class to access arbitrary metadata keys
  • Introduced JSON extension data handling via JsonExtensionData attribute
  • Added unit test validating indexer functionality with various data types

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/constructor.io/models/Search/RedirectData.cs Added dictionary-backed indexer with JsonExtensionData attribute to store arbitrary redirect metadata
src/Constructorio_NET.Tests/client/modules/SearchTests.cs Added test case verifying indexer access to custom keys in redirect data

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

public int MatchId { get; set; }

[JsonExtensionData]
private Dictionary<string, object> _additionalData;
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

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

The private field _additionalData is not accessible to consumers who might need to enumerate all additional data keys. Consider adding a public method or property to expose the keys or entries, such as IEnumerable<string> GetAdditionalDataKeys() or a read-only view of the dictionary.

Copilot uses AI. Check for mistakes.
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! Thanks so much! I just left a small nitpick

public object this[string key]
{
get => _additionalData?.TryGetValue(key, out var value) == true ? value : null;
set
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we really need a setter here? RedirectData comes from the API response, users read it, they don't construct it themselves AFAIU 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's fair. I thought about this for a bit as well. I thought it might be helpful for testing in the future and I wanted to keep it consistent with other attributes of this call. But I agree, it's not necessary 🤔

@esezen esezen merged commit 0b27759 into main Feb 10, 2026
0 of 2 checks passed
@esezen esezen deleted the cdx-372-netcore-update-redirectdata branch February 10, 2026 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants