Skip to content

Blueprints: Fix UdiEntityTypeHelper.ToUmbracoObjectType() for document blueprint containers#22875

Merged
AndyButland merged 3 commits into
v17/devfrom
v17/hotfix/toumbracoobjecttype
May 19, 2026
Merged

Blueprints: Fix UdiEntityTypeHelper.ToUmbracoObjectType() for document blueprint containers#22875
AndyButland merged 3 commits into
v17/devfrom
v17/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 DocumentBlueprintContainer case to UdiEntityTypeHelper.ToUmbracoObjectType(), so the conversion is symmetric with FromUmbracoObjectType() which already supports it.

The gap

UdiEntityTypeHelper.FromUmbracoObjectType() maps UmbracoObjectTypes.DocumentBlueprintContainer to Constants.UdiEntityType.DocumentBlueprintContainer, but the reverse ToUmbracoObjectType(\"document-blueprint-container\") throws NotSupportedException instead of returning the matching enum value.

Changes

  • UdiEntityTypeHelper.ToUmbracoObjectType() - new case for Constants.UdiEntityType.DocumentBlueprintContainer.
  • UdiEntityTypeHelperTests - new test fixture round-tripping every defined mapping in both directions.

This will flow up to v18 via the usual merge-up. The v18 Element/ElementContainer asymmetry is tracked separately in #22874.

Testing

  • dotnet test --filter UdiEntityTypeHelperTests - 38/38 pass.
  • Manual: UdiEntityTypeHelper.ToUmbracoObjectType(\"document-blueprint-container\") returns UmbracoObjectTypes.DocumentBlueprintContainer instead of throwing.

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

This PR fixes an asymmetry in UdiEntityTypeHelper by adding support for converting the document-blueprint-container UDI entity type back into UmbracoObjectTypes.DocumentBlueprintContainer, and adds unit tests to validate round-tripping for all currently supported mappings.

Changes:

  • Add Constants.UdiEntityType.DocumentBlueprintContainer handling to UdiEntityTypeHelper.ToUmbracoObjectType().
  • Add UdiEntityTypeHelperTests covering both FromUmbracoObjectType() and ToUmbracoObjectType() across all mapped cases.

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 the missing DocumentBlueprintContainer reverse mapping to make conversions symmetric.
tests/Umbraco.Tests.UnitTests/Umbraco.Core/UdiEntityTypeHelperTests.cs Adds unit tests that validate all current mappings in both conversion directions.

@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.

Thanks @ronaldbarendse. I also added MemberTypeContainer and adjust the unit test to use reflection, and thus hopefully catch any future cases of this type of bug rather than just verifying the current mappings. Please let me know what you think.

Also - is this a live issue that you'd like out in the earliest patch? If not, I'd be minded to move it to the next minor, as it's not really a regression rather a fairly long standing issue. Again, please let me know.

@ronaldbarendse

Copy link
Copy Markdown
Contributor Author

I only noticed the missing cases while doing PR #22873, not because I was hitting a specific bug (although this will trip up calls that use the IEntityService/IIdKeyMap for these entity types). I didn't spot the missing MemberTypeContainer one though!

Feel free to change the base branch and merge it onto the next minor instead. I just figured that since this is a very simple bugfix, targeting the next patch would make sense and also make it easier to merge up to the next v18 prerelease...

@AndyButland AndyButland changed the base branch from release/17.4.1 to release/17.5.0 May 19, 2026 05:40
@AndyButland AndyButland changed the base branch from release/17.5.0 to v17/dev May 19, 2026 05:40
@AndyButland AndyButland changed the base branch from v17/dev to release/17.4.1 May 19, 2026 05:40
ronaldbarendse and others added 3 commits May 19, 2026 07:57
…t blueprint containers

Adds the missing DocumentBlueprintContainer case so the conversion is
symmetric with FromUmbracoObjectType().

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@AndyButland AndyButland force-pushed the v17/hotfix/toumbracoobjecttype branch from d3639df to 7742d96 Compare May 19, 2026 05:57
@AndyButland AndyButland changed the base branch from release/17.4.1 to v17/dev May 19, 2026 05:59
@AndyButland AndyButland merged commit cd4521b into v17/dev May 19, 2026
25 checks passed
@AndyButland AndyButland deleted the v17/hotfix/toumbracoobjecttype branch May 19, 2026 07:11
AndyButland added a commit that referenced this pull request May 19, 2026
…t blueprint containers (#22875)

* Blueprints: Fix UdiEntityTypeHelper.ToUmbracoObjectType() for document blueprint containers

Adds the missing DocumentBlueprintContainer case so the conversion is
symmetric with FromUmbracoObjectType().

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* Add missing case for MemberTypeContainer.

* Use reflection to ensure other future missed cases are surfaced without having to explicitly extend the tests.

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: Andy Butland <abutland73@gmail.com>
AndyButland added a commit that referenced this pull request May 19, 2026
…t blueprint containers (#22875)

* Blueprints: Fix UdiEntityTypeHelper.ToUmbracoObjectType() for document blueprint containers

Adds the missing DocumentBlueprintContainer case so the conversion is
symmetric with FromUmbracoObjectType().

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* Add missing case for MemberTypeContainer.

* Use reflection to ensure other future missed cases are surfaced without having to explicitly extend the tests.

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: Andy Butland <abutland73@gmail.com>
@AndyButland

Copy link
Copy Markdown
Contributor

Cherry-picked to release/17.5.0 and release/18.0.

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