Repository navigation
Omit optional request values from connected-service designer data - #452
Conversation
| public bool OpenGeneratedFilesInIDE { get; set; } | ||
| public bool GenerateMultipleFiles { get; set; } | ||
| [IgnoreDataMember] | ||
| [Newtonsoft.Json.JsonIgnore] |
There was a problem hiding this comment.
Do we can safely remove the newtonsoft.json?
There was a problem hiding this comment.
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] |
There was a problem hiding this comment.
do we still store the password in the code?
There was a problem hiding this comment.
Maybe required at some instance when user wants to auth
There was a problem hiding this comment.
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
ServiceConfigurationonly when needed (optional values present and/or legacy “store” flags set). - Hide legacy persistence UI controls by default behind an
AppContextswitch 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.
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
ServiceConfigurationV4type and V4-specific values.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.