-
Notifications
You must be signed in to change notification settings - Fork 0
Added v2 to v3 migration transforms #20
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
Draft
HassanAkbar
wants to merge
6
commits into
fix/parse-data-loss
Choose a base branch
from
feat/migrate-version-transforms
base: fix/parse-data-loss
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
b721678
add real v2 to v3 migration transforms
HassanAkbar 4e8fd12
Merge branch 'fix/parse-data-loss' into feat/migrate-version-transforms
HassanAkbar f172467
narrow migration phase gaps to what is still missing
HassanAkbar 1f6a73f
Migrate from source XML and guard document root
HassanAkbar 1e39346
Name the public entry point in the root error
HassanAkbar 9cae03b
Reject a model whose version is not the one requested
HassanAkbar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| module Dcc | ||
| module Migrate | ||
| # Registry of migrations whose full incompatibility set has been verified | ||
| # against the bundled XSDs. | ||
| # | ||
| # Unregistered pairs raise rather than run. DCC 2.1.0 and 2.1.1 sit in the | ||
| # `https://ptb.de/si/smartcom/d-si/v1_0_1` D-SI namespace, which no | ||
| # transform here addresses, so accepting them by major version alone would | ||
| # silently emit an unmigrated document. | ||
| module Route | ||
| TRANSFORMS = { %w[2.3.0 3.3.0] => :V2ToV3 }.freeze | ||
|
|
||
| # v3.3.0 is a strict superset of v3.2.1 at instance level; only the | ||
| # `schemaVersion` pattern differs. | ||
| SCHEMA_VERSION_ONLY = [%w[3.2.1 3.3.0]].freeze | ||
|
|
||
| class << self | ||
| # @param from [String] normalized source version, e.g. "2.3.0". | ||
| # @param to [String] normalized target version, e.g. "3.3.0". | ||
| # @return [Boolean] whether this migration is registered. | ||
| def supported?(from, to) | ||
| TRANSFORMS.key?([from, to]) || | ||
| SCHEMA_VERSION_ONLY.include?([from, to]) | ||
| end | ||
|
|
||
| # @return [Module, nil] a module responding to `.call(xml, to:)`, or | ||
| # nil when only `schemaVersion` needs rewriting. | ||
| def for(from, to) | ||
| name = TRANSFORMS[[from, to]] | ||
| name && ::Dcc::Migrate.const_get(name) | ||
| end | ||
|
|
||
| # @return [Array<String>] every registered pair, for error messages. | ||
| def supported_pairs | ||
| (TRANSFORMS.keys + SCHEMA_VERSION_ONLY) | ||
| .map { |from, to| "#{from} to #{to}" } | ||
| end | ||
| end | ||
| end | ||
| end | ||
| end |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.