Repository navigation
ids serialization and deserialization: - #7930
Merged
Merged
Conversation
added 4 commits
June 5, 2017 14:04
implement converter for id sting to guid or guid based on id
QilongTang
reviewed
Jun 6, 2017
| public PortModel End { get; private set; } | ||
|
|
||
| /// <summary> | ||
| /// ID of the Connector, which is unique on in the graph. |
Member
Author
|
I've added a new set of tests based on the serialization tests that modify the generated json to have non guid ids - these are then deserialized, run and and compared. I'll fix up the merge conflicts and this should be ready for review. |
gregmarr
reviewed
Jun 6, 2017
| Guid nodeId; | ||
| if (!Guid.TryParse((obj["Id"].Value<string>()), out nodeId)) | ||
| { | ||
| nodeId = GuidUtility.Create(GuidUtility.UrlNamespace, (obj["Id"].Value<string>())); |
Contributor
There was a problem hiding this comment.
This pattern occurs multiple times, seems like it should become a helper function.
Member
Author
There was a problem hiding this comment.
good catch- thanks, should be straight forward.
added 2 commits
June 7, 2017 08:40
# Conflicts: # src/DynamoCoreWpf/ViewModels/Core/DynamoViewModel.cs
QilongTang
reviewed
Jun 7, 2017
| var guid = Guid.Parse(obj["Uuid"].Value<string>()); | ||
|
|
||
| //if the id is not a guid, makes a guid based on the id of the node | ||
| Guid nodeId = GuidUtility.tryParseOrCreateGuid(obj["Id"].Value<string>()); |
Contributor
There was a problem hiding this comment.
Let's just assign this to guid directly
Member
Author
|
@QilongTang addressed the comment. |
QilongTang
reviewed
Jun 7, 2017
| ConvertCurrentWorkspaceToDesignScriptAndSave(filePathBase); | ||
|
|
||
| string json = ConvertCurrentWorkspaceToJsonAndSave(model, filePathBase); | ||
| string json = saveFunction(model, filePathBase); |
Contributor
|
@mjkkirschner LGTM |
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.
Purpose
This PR deals with both https://jira.autodesk.com/browse/QNTM-692 and https://jira.autodesk.com/browse/QNTM-700
Leaves
workspaceModel'sGuidproperty serializing toUuidas it is today.It changes
AnnotationModelPortModelandConnectorModelandNodeModelto serialize theirGuidproperty asIdto be more explicit about that fact that these properties do not need to be globally unique but have different uniqueness requirements that are explained in their summaries.When
idproperties are deserialized they are parsed as if they are guids, if they are not valid guids, we generate a deterministic guid based on the id string.The element resolver still uses guids to remap the model as before. I've also added some checks to it that throw exceptions if a duplicate key is added to the resolve map or resolver models dict - all ids should at a minimum be unique within the graph so this should be a valid check to do.
Declarations
Check these if you believe they are true
*.resxfilesReviewers
@QilongTang
FYIs
@ramramps @ikeough @gregmarr