Skip to content

Make getDocument folder-safe (resolve document folders) - #22

Merged
solverat merged 2 commits into
open-dxp:1.xfrom
blankse:document-union-folder-safe
Jul 20, 2026
Merged

Make getDocument folder-safe (resolve document folders)#22
solverat merged 2 commits into
open-dxp:1.xfrom
blankse:document-union-folder-safe

Conversation

@blankse

@blankse blankse commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

getDocument(fullpath) on a folder path currently fails: DocumentType::resolveType returns null for folders, so the document union cannot resolve the abstract type at runtime ("Abstract type Document must resolve to an Object type at runtime ... received null").

This adds the already-existing _document_folder type to the union (getTypes) and resolves it (resolveType), mirroring the folder guard already present in AbstractRelationsType, ObjectsType and AnyDocumentTargetType. No new type is introduced.

Verified against a real Pimcore install: before, getDocument on a folder path errors; after, it returns document_folder. Non-folder documents are unaffected.

blankse added 2 commits July 20, 2026 16:39
…oring

Mirror of the folder guard used in the relation resolvers; adds the
existing _document_folder type to the document union so getDocument on a
folder path resolves instead of failing on an unresolvable union type.
Adding _document_folder to the document union made it appear twice in
AnyDocumentTargetType/AnyTargetType, which prepend it and then merge the
document union's types. GraphQL unions require unique members. Rely on the
document union as the single source: AnyDocumentTargetType returns its types
directly; AnyTargetType only adds _document_folder separately when the
document union itself is not merged.
@solverat
solverat merged commit 00b4d01 into open-dxp:1.x Jul 20, 2026
13 checks passed
@solverat

Copy link
Copy Markdown
Contributor

Thanks @blankse

@github-actions github-actions Bot locked and limited conversation to collaborators Jul 20, 2026
@solverat solverat modified the milestones: 1.0.6, 1.0.7 Jul 20, 2026
@solverat solverat added the bug Something isn't working label Jul 20, 2026
@solverat solverat self-assigned this Jul 20, 2026
@blankse
blankse deleted the document-union-folder-safe branch July 20, 2026 17:27
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants