Add asset path metadata attributes - #68234
Open
javiercn wants to merge 3 commits into
Open
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: b17d3f77-bb29-4f1d-8c96-c29347281928
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: b17d3f77-bb29-4f1d-8c96-c29347281928
Contributor
There was a problem hiding this comment.
Pull request overview
Adds new public metadata attributes that enable Razor (in other repos) to opt-in specific component parameters and selected HTML attributes for compile-time ~/ asset-path expansion, plus the initial built-in HTML allowlist and a validating test.
Changes:
- Introduces
AssetPathAttribute(component parameter opt-in) andAcceptsAssetPathAttribute(HTML element/attribute allowlist metadata). - Declares the initial built-in HTML mappings via
AssetPathAttributes(img[src],link[href],script[src]). - Adds a unit test asserting the built-in mapping set.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/Components/Web/test/AssetPathAttributesTest.cs | Adds a test verifying the built-in HTML allowlist metadata. |
| src/Components/Web/src/Web/AssetPathAttributes.cs | Declares the initial built-in HTML asset-path allowlist via repeatable metadata attributes. |
| src/Components/Web/src/PublicAPI.Unshipped.txt | Records the new public AssetPathAttributes type in the Web assembly API surface. |
| src/Components/Components/src/PublicAPI.Unshipped.txt | Records the new public attribute types and members in the Components assembly API surface. |
| src/Components/Components/src/AssetPathAttribute.cs | Adds the marker attribute for opt-in component parameter asset-path expansion. |
| src/Components/Components/src/AcceptsAssetPathAttribute.cs | Adds the repeatable metadata attribute for HTML element/attribute allowlist declarations. |
Comment on lines
+9
to
+11
| /// <remarks> | ||
| /// This attribute is valid only on properties that are also marked with <see cref="ParameterAttribute"/>. | ||
| /// </remarks> |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: b17d3f77-bb29-4f1d-8c96-c29347281928
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #68229
API review: #68237
Summary
AssetPathAttributefor component authors to mark individual parameters as accepting asset-path expansion.AcceptsAssetPathAttributemetadata for HTML element and attribute combinations.audio[src],img[src],input[src],link[href],script[src],source[src],track[src],video[poster], andvideo[src].Razor compiler transformation, behavior tests, and SDK switch support are intentionally handled in their respective repositories.