Refactor MetaDataProtoEditor.renameRecordType() - #4537
Draft
robert-brunel wants to merge 1 commit into
Draft
Conversation
Remove redundant code from the original `renameRecordType()` implementation by reusing the primitives introduced for the batched version `renameRecordTypes()`. Both public methods now delegate to a shared `applyRecordTypeRenames()` method, which orders the steps so that every validation happens before the first mutation. This refactoring does not affect the behavior, with two exceptions: * Renaming the canonical union field to a name that collides with another field now results in a `MetaDataException` being thrown from `validateUnionFieldRenames()`, instead of silently leaving the field under its old name. * The check that rejects a rename colliding with an imported record type now runs for every usage, where previously it ran only for `RECORD`-usage types. Renaming a `NESTED` type, or the union type, onto the name of an imported record type used to succeed, leaving the metadata with a name that resolves ambiguously.
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.
Remove redundant code from the original
renameRecordType()implementation by reusing the primitives introduced for the batched versionrenameRecordTypes(). Both public methods now delegate to a sharedapplyRecordTypeRenames()method, which orders the steps so that every validation happens before the first mutation.This refactoring does not affect the behavior, with two exceptions:
MetaDataExceptionbeing thrown fromvalidateUnionFieldRenames(), instead of silently leaving the field under its old name.RECORD-usage types. Renaming aNESTEDtype, or the union type, onto the name of an imported record type used to succeed, leaving the metadata with a name that resolves ambiguously.