Skip to content
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

Diagram schema migration #306

Merged
merged 11 commits into from
Oct 15, 2023

Conversation

loreanvictor
Copy link
Contributor

@loreanvictor loreanvictor commented Sep 29, 2023

Checklist

  • I documented the TypeScript code using JSDoc style.
  • I added multiple screenshots/screencasts of my UI changes (NA)
  • I translated all the newly inserted strings into German and English (NA)

Motivation and Context

Following up on this discussion: Current model schema of Apollon results in unnecessary conflicts when patching / merging two replicas (e.g. in realtime collaboration) using JSONPatch and JSONPointer standards.

Description

The proposed change will use id -> element maps instead of arrays for element, relationships, assessments and interactive fields of the model schema, causing standard patch operations on these collections to become idempotent, and if not directly targeting the same element, commutative, effectively resolving most conflicts that could arise while merging two replicas of the model. It results in a major bump in model version to v3, with import support for v2 models (no export support added atm).

IMPORTANT

This requires a follow up PR for simplifying and optimising the serialisation/deserialisation code. This change is excluded from the current PR as the existing code has issues that need to be fixed beforehand (as otherwise, it is almost impossible to ensure the refactoring yields correct results).

Steps for Testing

  1. Run the editor
  2. Create a diagram and export it as JSON

Test Coverage

File Branch Line
main/apollon-editor.ts 79.16% 83.47%
main/typings.ts 100% 100%
main/compat 100% 100%
main/compat/v2 100% 100%
main/components/store 97.72% 93.82%
main/packages/uml-communication-diagram/uml-communication-link/uml-communication-link.ts 72.72% 90.47%
main/scenes/svg.tsx 73.46% 81.56%

There are some other files that are changed by prettier, I have not included them since their coverage is unchanged.

@loreanvictor loreanvictor marked this pull request as ready for review October 12, 2023 09:02
@matthiaslehnertum
Copy link
Collaborator

Looks good to me! Nicely done! Apollon itself as well as the deserialization of v2 diagrams operate as expected.

@matthiaslehnertum
Copy link
Collaborator

Can you merge this one @loreanvictor ? :)

@loreanvictor
Copy link
Contributor Author

Can you merge this one @loreanvictor ? :)

Unfortunately, I do not seem to have the permission 😅

@krusche
Copy link
Member

krusche commented Oct 15, 2023

I will merge the PR

@krusche krusche merged commit 4dc3dfe into ls1intum:develop Oct 15, 2023
2 checks passed
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