Skip to content

Elements: Fix UdiEntityTypeHelper.ToUmbracoObjectType() for Element entities#22874

Merged
AndyButland merged 2 commits into
release/18.0from
v18/hotfix/toumbracoobjecttype
May 19, 2026
Merged

Elements: Fix UdiEntityTypeHelper.ToUmbracoObjectType() for Element entities#22874
AndyButland merged 2 commits into
release/18.0from
v18/hotfix/toumbracoobjecttype

Conversation

@ronaldbarendse

Copy link
Copy Markdown
Contributor

Prerequisites

  • I have added steps to test this contribution in the description below

Description

Adds the missing ToUmbracoObjectType() cases for Element and ElementContainer, so the conversion is symmetric with FromUmbracoObjectType().

The gap

UdiEntityTypeHelper.FromUmbracoObjectType() already maps both v18 Element types to their UDI entity type strings, but the reverse ToUmbracoObjectType() is missing those cases and throws NotSupportedException instead. The same asymmetry exists for DocumentBlueprintContainer, but that one applies to v17 too and will be handled separately on release/17.0 and merged up.

Changes

  • UdiEntityTypeHelper.ToUmbracoObjectType() - new cases for Constants.UdiEntityType.Element and Constants.UdiEntityType.ElementContainer.
  • UdiEntityTypeHelperTests - new test fixture round-tripping every defined mapping in both directions.

Testing

  • dotnet test --filter UdiEntityTypeHelperTests - 40/40 pass.
  • Manual: UdiEntityTypeHelper.ToUmbracoObjectType(\"element\") returns UmbracoObjectTypes.Element instead of throwing.
  • Manual: UdiEntityTypeHelper.ToUmbracoObjectType(\"element-container\") returns UmbracoObjectTypes.ElementContainer instead of throwing.

…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>
Copilot AI review requested due to automatic review settings May 18, 2026 12:15
@claude

claude Bot commented May 18, 2026

Copy link
Copy Markdown

Claude encountered an error after 0s —— View job


I'll analyze this and get back to you.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 Element and ElementContainer cases to UdiEntityTypeHelper.ToUmbracoObjectType().
  • Added unit coverage for supported UdiEntityTypeHelper mappings 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.

@AndyButland AndyButland left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

@ronaldbarendse

Copy link
Copy Markdown
Contributor Author

The test is removed, so it can be re-added without merge conflicts once the v17 PR is merged in 💪🏻

@AndyButland AndyButland merged commit 432031e into release/18.0 May 19, 2026
23 of 24 checks passed
@AndyButland AndyButland deleted the v18/hotfix/toumbracoobjecttype branch May 19, 2026 07:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants