-
Notifications
You must be signed in to change notification settings - Fork 299
Fix Serialization/Deserialization issue with $ prefix columns #3051
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: release/1.6
Are you sure you want to change the base?
Fix Serialization/Deserialization issue with $ prefix columns #3051
Conversation
) ### Why make this change? Serialization and deserialization of metadata currently fail when column names are prefixed with the $ symbol. ### Root cause This issue occurs because we’ve enabled the ReferenceHandler flag in our System.Text.Json serialization settings. When this flag is active, the serializer treats $ as a reserved character used for special metadata (e.g., $id, $ref). As a result, any property name starting with $ is interpreted as metadata and cannot be deserialized properly. ### What is this change? This update introduces custom logic in the converter’s Write and Read methods to handle $-prefixed column names safely. - During serialization, columns beginning with $ are escaped as "_$". - During deserialization, this transformation is reversed to restore the original property names. ### How was this tested - [x] Unit tests --------- Co-authored-by: Aniruddh Munde <anmunde@microsoft.com>
## Why make this change? - To apply correct serialization and deserialization logic for stored procedures. With the previous changes, serialization was not working correctly for the StoredProcedureDefinition type, which extends SourceDefinition. When the value type was passed explicitly for serialization, the parent type was used instead, causing some child-type properties to be omitted. ## What is this change? Instead of manually specifying the value type during serialization, this change allows the library to infer the type automatically and perform the correct serialization. ## How was this tested? - [x] Unit Tests --------- Co-authored-by: Aniruddh Munde <anmunde@microsoft.com>
There was a problem hiding this 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 pull request addresses a serialization/deserialization issue with column names that start with a dollar sign ($). The fix introduces an escaping mechanism that transforms dollar-prefixed column names during serialization and restores them during deserialization.
Changes:
- Added escaping/unescaping logic in DatabaseObjectConverter to handle dollar-prefixed column names
- Added three comprehensive unit tests to validate serialization/deserialization with dollar-prefixed columns
- Modified InitializeObjects test helper to support generating test data with dollar-prefixed column names
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 14 comments.
| File | Description |
|---|---|
| src/Core/Services/MetadataProviders/Converters/DatabaseObjectConverter.cs | Implements escaping/unescaping mechanism for dollar-prefixed column names in serialization/deserialization |
| src/Service.Tests/UnitTests/SerializationDeserializationTests.cs | Adds tests for dollar-prefixed columns and updates test helper to support this scenario |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/Core/Services/MetadataProviders/Converters/DatabaseObjectConverter.cs
Show resolved
Hide resolved
src/Service.Tests/UnitTests/SerializationDeserializationTests.cs
Outdated
Show resolved
Hide resolved
src/Core/Services/MetadataProviders/Converters/DatabaseObjectConverter.cs
Outdated
Show resolved
Hide resolved
src/Service.Tests/UnitTests/SerializationDeserializationTests.cs
Outdated
Show resolved
Hide resolved
src/Core/Services/MetadataProviders/Converters/DatabaseObjectConverter.cs
Outdated
Show resolved
Hide resolved
src/Core/Services/MetadataProviders/Converters/DatabaseObjectConverter.cs
Show resolved
Hide resolved
src/Core/Services/MetadataProviders/Converters/DatabaseObjectConverter.cs
Show resolved
Hide resolved
|
@Alekhya-Polavarapu I've opened a new pull request, #3055, to work on those changes. Once the pull request is ready, I'll request review from you. |
|
@Alekhya-Polavarapu I've opened a new pull request, #3056, to work on those changes. Once the pull request is ready, I'll request review from you. |
…onverter.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
@copilot implement fixes for typos in documentation you listed |
|
@Alekhya-Polavarapu I've opened a new pull request, #3057, to work on those changes. Once the pull request is ready, I'll request review from you. |
## Why make this change? Code review identified typos in XML documentation comments that inaccurately described the escaping mechanism and contained spelling errors. ## What is this change? Fixed documentation comments to accurately reflect the implementation: - **DatabaseObjectConverter.cs**: Updated escape/unescape method summaries to correctly describe the `DAB_ESCAPE$` prefix transformation (previously incorrectly documented as `_$`) - **SerializationDeserializationTests.cs**: Corrected "deserilization" → "deserialization" in three test method comments ## How was this tested? - [x] Documentation-only change, no functional changes <!-- START COPILOT CODING AGENT TIPS --> --- 💬 We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey). --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Alekhya-Polavarapu <67075378+Alekhya-Polavarapu@users.noreply.github.com>
|
/azp run |
|
Azure Pipelines successfully started running 6 pipeline(s). |
Why make this change?
Serialization and deserialization of metadata currently fail when column names are prefixed with the $ symbol.
What is this change?
This pull request enhances the serialization and deserialization logic for database metadata objects to properly handle column names that start with a dollar sign ($). It introduces a mechanism to escape such column names during serialization and unescape them during deserialization, ensuring compatibility and correctness when processing metadata with special column names.
How was this tested?