Blueprints: Fix UdiEntityTypeHelper.ToUmbracoObjectType() for document blueprint containers#22875
Conversation
|
Claude encountered an error after 0s —— View job I'll analyze this and get back to you. |
There was a problem hiding this comment.
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.DocumentBlueprintContainerhandling toUdiEntityTypeHelper.ToUmbracoObjectType(). - Add
UdiEntityTypeHelperTestscovering bothFromUmbracoObjectType()andToUmbracoObjectType()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
left a comment
There was a problem hiding this comment.
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.
|
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 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... |
…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>
…ut having to explicitly extend the tests.
d3639df to
7742d96
Compare
…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>
…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>
|
Cherry-picked to |
Prerequisites
Description
Adds the missing
DocumentBlueprintContainercase toUdiEntityTypeHelper.ToUmbracoObjectType(), so the conversion is symmetric withFromUmbracoObjectType()which already supports it.The gap
UdiEntityTypeHelper.FromUmbracoObjectType()mapsUmbracoObjectTypes.DocumentBlueprintContainertoConstants.UdiEntityType.DocumentBlueprintContainer, but the reverseToUmbracoObjectType(\"document-blueprint-container\")throwsNotSupportedExceptioninstead of returning the matching enum value.Changes
UdiEntityTypeHelper.ToUmbracoObjectType()- new case forConstants.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.UdiEntityTypeHelper.ToUmbracoObjectType(\"document-blueprint-container\")returnsUmbracoObjectTypes.DocumentBlueprintContainerinstead of throwing.