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

DXCDT-370: Check prerequisites for keyword preservation #754

Merged
merged 23 commits into from
Feb 27, 2023

Conversation

willvedd
Copy link
Contributor

@willvedd willvedd commented Feb 23, 2023

🔧 Changes

In order for keyword preservation to work, there are two key prerequisites that must be met:

  • Non-empty keyword replace mappings
  • Non-empty local resource configuration files

If the above criteria are not met, it suggests an erroneous condition and that data loss could occur. This PR introduces checks to ensure that these prerequisites are met before attempting to preserve keywords. Otherwise, an exception will be thrown. It is debatable wether or not an exception is a bit harsh, but for this first iteration I'm proposing to stay on the safer side and stop the usage of keyword preservation if it is doomed to work.

🔬 Testing

Added E2E tests for both checks.

📝 Checklist

  • All new/changed/fixed functionality is covered by tests (or N/A)
  • I have added documentation for all new/changed functionality (or N/A)

@willvedd willvedd requested a review from a team as a code owner February 23, 2023 21:40
export const setupContext = async (config: Config): Promise<DirectoryContext | YAMLContext> => {
export const setupContext = async (
config: Config,
command: 'import' | 'export'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was necessary for me to introduce this command argument to exclude the prerequisite checks if an import was being run.

@willvedd willvedd enabled auto-merge (squash) February 23, 2023 22:04
@willvedd willvedd merged commit 69681d8 into master Feb 27, 2023
@willvedd willvedd deleted the DXCDT-370-keyword-preservation-check-prereqs branch February 27, 2023 15:36
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.

None yet

2 participants