[Synapse] - Fixed deserialization error when create Pipeline/Dataset/Trigger through DefinitionFile#13721
Merged
wyunchi-ms merged 10 commits intoAzure:masterfrom Dec 15, 2020
Conversation
added 9 commits
December 10, 2020 06:39
Contributor
Author
|
/azp run |
Contributor
|
Azure Pipelines successfully started running 3 pipeline(s). |
wyunchi-ms
reviewed
Dec 14, 2020
| { | ||
| internal static T DeserializeObject<T>(string rawJsonContent) | ||
| { | ||
| var document = JsonDocument.Parse(rawJsonContent, default); |
Contributor
There was a problem hiding this comment.
Feature default literal is not available in C# 7.0.
Contributor
Author
There was a problem hiding this comment.
Thanks for the suggestion. Fixed.
Contributor
Author
|
@wyunchi-ms could you please help review again? |
Contributor
|
Could you please add these modification into |
Contributor
Author
|
@wyunchi-ms there is already an entry in the Upcoming Release section:
|
wyunchi-ms
approved these changes
Dec 15, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
<TL;DR>
This PR aims to fix deserialization issue for New-*Pipeline/Dataset/Trigger cmdlets.
TL:DR
Synapse has integrated some Azure Data Factory's fundamental features, for example pipeline, dataset, triggers, etc. We refer these resources as artifacts. One common use scenario for New-*Artifact is, users provide a definition file that contains request body, the PowerShell command reads the definition file, deserialize its content to some SDK models and call methods to send a PUT request to create some artifact resource.
Previously, these related PowerShell cmdlets suffer from a deserialization issue. In short, this is because, The PowerShell consumes Azure.Analytics.Synapse.Artifacts C# SDK. The SDK is track 2 data plane SDK. Its serializer/deserializer (methods to serialize/deserialize SDK models) are not exposed. For example, see PipelineResource.Serialization.cs - methods in this file are not
public.Before this change, our deserialization approach in PowerShell is as below: we writes some wrapper classes, let's say PSArtifact.cs. First of call, we leverage Newtonsoft.Json library for serialization to an instance of
PSArtifact, then we write and callToSdkObjectmethod insidePSArtifactto transformPSArtifactto some SDK modelSdkArtifact. Then call SDK method withSdkArtifact. This approach is buggy and we have seen several customer reported deserialization failure issues recently. At code level, this is because we have to write lots ofToSdkObjectmethods by hand and provide parameterless constructor for many files (Otherwise the Newtonsoft.Json will complain that it cannot find proper ctor or call some unexpected ctor).In this PR, we are trying to fix the deserialization issue by calling SDK's original serialization/de-serialization methods, rather than leverage Newtonsoft.Json library. Due to the invisibility of those SDK serialization methods, we cannot call them directly. So we turn to use reflection instead. The mainly related files are:
Besides the major change that is mentioned above, the PR also does the following items:
Azure.Analytics.Synapse.Artifactsto the latest version and update code inSet-AzSynapseNotebookto solve an payload validation issue due to a breaking change at backend side.Checklist
CONTRIBUTING.mdChangeLog.mdfile(s) has been updated:ChangeLog.mdfile can be found atsrc/{{SERVICE}}/{{SERVICE}}/ChangeLog.md## Upcoming Releaseheader -- no new version header should be added