Skip to content

Omit optional request values from connected-service designer data - #452

Merged
WanjohiSammy merged 4 commits into
masterfrom
fix/omit-optional-request-values
Aug 20, 2026
Merged

WanjohiSammy merged 4 commits into
masterfrom
fix/omit-optional-request-values

Conversation

@WanjohiSammy

Copy link
Copy Markdown
Member

Summary

Keep custom HTTP headers and web-proxy username/password values available for the active code-generation operation, but omit them from connected-service designer data. The default configuration path remains unchanged and avoids creating a copy when there are no optional values or legacy save flags to remove.

Changes

  • Mark custom HTTP headers and web-proxy username/password properties as ignored by DataContractSerializer, Newtonsoft.Json, and System.Text.Json.
  • Persist a sanitized copy only when optional values or legacy save flags are present.
  • Preserve the original in-memory configuration passed to code generation.
  • Preserve non-optional proxy settings, including host and domain.
  • Preserve the concrete ServiceConfigurationV4 type and V4-specific values.
  • Remove the two save controls because these values are no longer written to designer data.
  • Capture serialized designer data in handler-path tests.

Before

Enabling either save control retained the corresponding optional values on the configuration object passed to designer-data persistence.

After

Designer data omits custom HTTP headers and web-proxy username/password values regardless of legacy save-flag values. The active generation operation still receives the original values. Configurations without those values or flags use the existing object directly.

public bool OpenGeneratedFilesInIDE { get; set; }
public bool GenerateMultipleFiles { get; set; }
[IgnoreDataMember]
[Newtonsoft.Json.JsonIgnore]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we can safely remove the newtonsoft.json?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is to prevent Newtonsoft.Json (Json.NET) from serializing or deserailizing this particular property

public bool StoreWebProxyNetworkCredentials { get; set; }
[IgnoreDataMember]
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

do we still store the password in the code?

@WanjohiSammy WanjohiSammy Aug 20, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Maybe required at some instance when user wants to auth

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Updates connected-service persistence so optional request values (custom HTTP headers and web-proxy username/password) remain available for the active code-generation operation but are omitted from designer data persisted by the connected-service designer, with a default fast path that avoids copying when no optional values or legacy flags are present.

Changes:

  • Ignore custom headers + proxy username/password during serialization (DataContractSerializer, Newtonsoft.Json, System.Text.Json).
  • Persist a sanitized copy of ServiceConfiguration only when needed (optional values present and/or legacy “store” flags set).
  • Hide legacy persistence UI controls by default behind an AppContext switch and add end-to-end tests that assert omitted persisted values while generation still receives the originals.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.

Show a summary per file
File Description
test/ODataConnectedService.Tests/TestHelpers/TestConnectedServiceHandlerContext.cs Captures serialized designer-data JSON in tests for assertions about omitted fields.
test/ODataConnectedService.Tests/ODataConnectedServiceWizardTests.cs Adds tests for feature-flagged legacy UI visibility and FeatureFlags.IsEnabled.
test/ODataConnectedService.Tests/ODataConnectedServiceHandlerTest.cs Expands handler tests to verify persisted designer data omits optional values while generation receives originals; adds serialization coverage.
src/ODataConnectedService.Shared/Views/ConfigODataEndpoint.xaml.cs Adds feature-flag-controlled visibility for legacy persistence checkboxes.
src/ODataConnectedService.Shared/Views/ConfigODataEndpoint.xaml Collapses legacy persistence controls in XAML by default.
src/ODataConnectedService.Shared/ODataConnectedServiceHandler.cs Persists a sanitized configuration copy (only when required) while leaving the original configuration intact for generation.
src/ODataConnectedService.Shared/ODataConnectedService.Shared.projitems Includes the new FeatureFlags.cs in the shared project items.
src/ODataConnectedService.Shared/Common/FeatureFlags.cs Adds centralized AppContext-switch feature flag helper + switch name constant.
src/Microsoft.OData.CodeGen/Models/ServiceConfiguration.cs Marks optional request-value properties as ignored for supported serializers.
README.md Documents the legacy persistence options feature flag behavior and usage.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@WanjohiSammy
WanjohiSammy merged commit accf01f into master Aug 20, 2026
4 checks passed
@WanjohiSammy
WanjohiSammy deleted the fix/omit-optional-request-values branch August 20, 2026 05:58
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