Elements: Fix UdiEntityTypeHelper.ToUmbracoObjectType() for Element entities#22874
Merged
Conversation
…ntities Adds the missing Element and ElementContainer cases so the conversion is symmetric with FromUmbracoObjectType(). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Claude encountered an error after 0s —— View job I'll analyze this and get back to you. |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds missing UDI entity-type-to-object-type conversions for Element entities in Umbraco.Core, making these mappings align with the existing reverse conversion.
Changes:
- Added
ElementandElementContainercases toUdiEntityTypeHelper.ToUmbracoObjectType(). - Added unit coverage for supported
UdiEntityTypeHelpermappings in both conversion directions.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/Umbraco.Core/UdiEntityTypeHelper.cs |
Adds Element and ElementContainer mappings for UDI entity type conversion. |
tests/Umbraco.Tests.UnitTests/Umbraco.Core/UdiEntityTypeHelperTests.cs |
Adds NUnit test cases validating expected helper conversions. |
Merged
3 tasks
AndyButland
reviewed
May 18, 2026
AndyButland
left a comment
Contributor
There was a problem hiding this comment.
Looks good, but if you are happy with what I've done in #22875, could you remove the test from here please? Then we'll have it when the PR for 17 is merged up.
Contributor
Author
|
The test is removed, so it can be re-added without merge conflicts once the v17 PR is merged in 💪🏻 |
AndyButland
approved these changes
May 19, 2026
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.
Prerequisites
Description
Adds the missing
ToUmbracoObjectType()cases forElementandElementContainer, so the conversion is symmetric withFromUmbracoObjectType().The gap
UdiEntityTypeHelper.FromUmbracoObjectType()already maps both v18 Element types to their UDI entity type strings, but the reverseToUmbracoObjectType()is missing those cases and throwsNotSupportedExceptioninstead. The same asymmetry exists forDocumentBlueprintContainer, but that one applies to v17 too and will be handled separately onrelease/17.0and merged up.Changes
UdiEntityTypeHelper.ToUmbracoObjectType()- new cases forConstants.UdiEntityType.ElementandConstants.UdiEntityType.ElementContainer.UdiEntityTypeHelperTests- new test fixture round-tripping every defined mapping in both directions.Testing
dotnet test --filter UdiEntityTypeHelperTests- 40/40 pass.UdiEntityTypeHelper.ToUmbracoObjectType(\"element\")returnsUmbracoObjectTypes.Elementinstead of throwing.UdiEntityTypeHelper.ToUmbracoObjectType(\"element-container\")returnsUmbracoObjectTypes.ElementContainerinstead of throwing.