Skip to content

Add asset path metadata attributes - #68234

Open
javiercn wants to merge 3 commits into
mainfrom
asset-path-expansion
Open

Add asset path metadata attributes#68234
javiercn wants to merge 3 commits into
mainfrom
asset-path-expansion

Conversation

@javiercn

@javiercn javiercn commented Aug 5, 2026

Copy link
Copy Markdown
Member

Part of #68229

API review: #68237

Summary

  • Add AssetPathAttribute for component authors to mark individual parameters as accepting asset-path expansion.
  • Add repeatable AcceptsAssetPathAttribute metadata for HTML element and attribute combinations.
  • Declare built-in HTML mappings for audio[src], img[src], input[src], link[href], script[src], source[src], track[src], video[poster], and video[src].
  • Leave the built-in Blazor component annotation set empty.

Razor compiler transformation, behavior tests, and SDK switch support are intentionally handled in their respective repositories.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: b17d3f77-bb29-4f1d-8c96-c29347281928
Copilot AI review requested due to automatic review settings August 5, 2026 16:35
@javiercn
javiercn requested a review from a team as a code owner August 5, 2026 16:35
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: b17d3f77-bb29-4f1d-8c96-c29347281928

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

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) and AcceptsAssetPathAttribute (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
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