Normalize import_export structure
What does this MR do?
This brings a significant refactor to how
we handle import_export.yml
, merge it with EE
and how we handle that for reader and saver.
This is meant to simplify the code, and remove a ton of conditions to handle different models of the structure.
This is also meant to prepare the structure
to extend it much easier, like adding preload:
or additional object types when needed.
This does not change the behavior of import/export, rather unifies and simplifies the current implementation.
This basically makes all internal handling to consume the structure that is:
tree:
project:
- labels:
- :priorities
- milestones:
- events:
- :push_event_payload
included_attributes:
user:
- :id
excluded_attributes:
project:
- :name
methods:
labels:
- :type
events:
- :action
preloads:
statuses:
project:
ee:
tree:
project:
protected_branches:
- :unprotect_access_levels
included_attributes:
user:
- :name_ee
excluded_attributes:
project:
- :name_without_ee
methods:
labels:
- :type_ee
events_ee:
- :action_ee
preloads:
statuses:
bridge_ee:
To be internally represented as:
{
tree: {
project: {
labels: {
priorities: {}
},
milestones: {
events: {
push_event_payload: {}
}
}
}
},
included_attributes: {
user: [:id]
},
excluded_attributes: {
project: [:name]
},
methods: {
labels: [:type],
events: [:action]
},
preloads: {
statuses: {
project: nil
}
}
}
Previously the structure for tree:
would be a mix of hashes
, with arrays
, with strings
and symbols
.
This ensures that we always use uniform representation.
This is joint effort with @alipniagov.
This is slice of https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/32423.
In order to solve the https://gitlab.com/gitlab-org/gitlab-ce/issues/35389.
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry for user-facing changes, or community contribution. Check the link for other scenarios. -
Code review guidelines -
Merge request performance guidelines -
Style guides