Skip to content

allow match expressions to target variant document types#9

Merged
hugowetterberg merged 1 commit into
mainfrom
feature/extend-variants
Mar 6, 2026
Merged

allow match expressions to target variant document types#9
hugowetterberg merged 1 commit into
mainfrom
feature/extend-variants

Conversation

@hugowetterberg
Copy link
Copy Markdown
Contributor

Match expressions like {"type":{"const":"core/article#prefab"}} can now target a specific variant, allowing constraints to be added that only apply to that variant and not the base document type.

Previously documentMatchAttribute resolved variants before matching, so match expressions could only ever see the base type. Now the raw document type is tried first, and variant resolution is used as a fallback. This means {"type":{"const":"core/article"}} still matches variant documents, while {"type":{"const":"core/article#prefab"}} matches only that specific variant.

The test adds a "prefab-setting" meta block that is declared only for core/article#prefab and verifies that it is accepted on the variant but rejected as undeclared on the base core/article.

Match expressions like `{"type":{"const":"core/article#prefab"}}` can now
target a specific variant, allowing constraints to be added that only apply
to that variant and not the base document type.

Previously `documentMatchAttribute` resolved variants before matching, so
match expressions could only ever see the base type. Now the raw document
type is tried first, and variant resolution is used as a fallback. This
means `{"type":{"const":"core/article"}}` still matches variant documents,
while `{"type":{"const":"core/article#prefab"}}` matches only that specific
variant.

The test adds a "prefab-setting" meta block that is declared only for
`core/article#prefab` and verifies that it is accepted on the variant but
rejected as undeclared on the base `core/article`.
@hugowetterberg hugowetterberg merged commit 41c6ce2 into main Mar 6, 2026
2 checks passed
@hugowetterberg hugowetterberg deleted the feature/extend-variants branch March 6, 2026 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants