Integrate Scalar as an Aspire primitive with extension methods#150
Integrate Scalar as an Aspire primitive with extension methods#150
Conversation
Co-authored-by: indcoder <2099300+indcoder@users.noreply.github.com>
Co-authored-by: indcoder <2099300+indcoder@users.noreply.github.com>
indcoder
left a comment
There was a problem hiding this comment.
The Scalar references need to be added to the App Host. Please go through the scalar post and make the necessary changes.
Co-authored-by: indcoder <2099300+indcoder@users.noreply.github.com>
Co-authored-by: indcoder <2099300+indcoder@users.noreply.github.com>
Co-authored-by: indcoder <2099300+indcoder@users.noreply.github.com>
I've added the necessary Scalar references to the AppHost:
The AppHost now properly configures Scalar endpoints for both the Event API and Registration API services. |
|
Why is the Scalar extension needed.....the scalar blog post does not mention it. |
Co-authored-by: indcoder <2099300+indcoder@users.noreply.github.com>
You're absolutely right. The AppHost extension only configures Aspire dashboard URLs and doesn't use any Scalar types directly. I've removed the unnecessary Scalar.AspNetCore package reference from the AppHost project in commit a41bd3d. The actual Scalar functionality is properly implemented in ServiceDefaults where the package reference belongs. |
|
The issue has been updated.....use that as the starting point and adhere to the scalar reference for the Aspire scalar implementation. |
- Follow official Scalar guide for .NET Aspire integration - Remove custom extension methods in favor of direct service configuration - Add Scalar URL configuration for Registration API in AppHost - Remove unnecessary Scalar package reference from ServiceDefaults - Update documentation to reflect official approach Co-authored-by: indcoder <2099300+indcoder@users.noreply.github.com>
I've updated the implementation to follow the official Scalar .NET Aspire integration guide rather than using custom extensions. The changes include:
The implementation now follows the standard pattern where services configure Scalar directly and the AppHost provides dashboard links using the built-in URL configuration methods. Commit f170535 addresses this feedback. Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
This PR implements Scalar API documentation as a .NET Aspire primitive, providing a simplified way to add interactive API documentation to Aspire applications.
What's Changed
🔧 ServiceDefaults Extensions
AddScalarDefaults()method that automatically configures OpenAPI and Scalar servicesMapScalarDefaults()method for easy endpoint mapping with sensible defaults🏗️ AppHost Extensions
WithScalarApiDocumentation()extension method for declarative resource configuration🔄 Service Updates
app.MapScalarDefaults("Visage Event API")app.MapScalarDefaults("Visage Registration API")✅ Testing & Validation
ScalarIntegrationTest.cs📚 Documentation & Examples
/docs/scalar-aspire-integration.mdUsage Examples
Before (Manual Configuration)
After (Aspire Primitive)
AppHost Configuration
Benefits
builder.AddScalar()pattern for AppHostArchitecture
The implementation follows .NET Aspire patterns and provides:
Fixes #149.
Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
aka.mscurl -I -sSL --retry 5 --retry-delay 2 --connect-timeout 15 REDACTED(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.