File: Manifests\EndpointsManifest.cs
Web Access
Project: src\src\Aspire.Hosting.Blazor\Aspire.Hosting.Blazor.csproj (Aspire.Hosting.Blazor)
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
 
// These types mirror the static web assets endpoints manifest format
// (*.staticwebassets.endpoints.json) generated by the .NET SDK's
// GenerateStaticWebAssetEndpointsManifest MSBuild task
// (see: https://github.com/dotnet/sdk/blob/main/src/StaticWebAssetsSdk/Tasks/Data/StaticWebAssetEndpoint.cs)
// and consumed by ASP.NET Core's MapStaticAssets() endpoint routing middleware
// (see: https://github.com/dotnet/aspnetcore/blob/main/src/StaticAssets/src/StaticAssetDescriptor.cs).
//
// The model is intentionally a subset — we only declare properties we need to inspect
// or modify (Route, AssetFile, Selectors, ResponseHeaders). Properties like Order and
// EndpointProperties are preserved via [JsonExtensionData] during round-trip serialization,
// ensuring forward-compatibility as the SDK adds new fields across versions.
 
using System.Text.Json;
using System.Text.Json.Serialization;
 
namespace Aspire.Hosting;
 
internal sealed class EndpointsManifest
{
    public EndpointEntry[] Endpoints { get; set; } = [];
 
    [JsonExtensionData]
    public Dictionary<string, JsonElement>? ExtensionData { get; set; }
}
 
internal sealed class EndpointEntry
{
    public string Route { get; set; } = "";
    public string AssetFile { get; set; } = "";
    public EndpointSelector[]? Selectors { get; set; }
    public EndpointResponseHeader[]? ResponseHeaders { get; set; }
 
    [JsonExtensionData]
    public Dictionary<string, JsonElement>? ExtensionData { get; set; }
}
 
internal sealed class EndpointSelector
{
    public string Name { get; set; } = "";
 
    [JsonExtensionData]
    public Dictionary<string, JsonElement>? ExtensionData { get; set; }
}
 
internal sealed class EndpointResponseHeader
{
    public string Name { get; set; } = "";
    public string Value { get; set; } = "";
 
    [JsonExtensionData]
    public Dictionary<string, JsonElement>? ExtensionData { get; set; }
}