Intent.AspNetCore.Scalar module provides a modern, high-performance OpenAPI documentation interface using the Scalar library. Scalar offers a sleek, responsive alternative to Swagger UI with improved user experience and performance.
Overview
Scalar is a modern API documentation tool that generates beautiful, interactive documentation from your OpenAPI specifications. It provides a superior user experience compared to traditional Swagger UI with features like:- Fast, responsive interface
- Modern, clean design
- Built-in authentication testing
- Better request/response visualization
- Enhanced code generation
What Gets Generated
OpenApiConfiguration
Configures Scalar for your ASP.NET Core application:HideRouteParametersFromBodyOperationTransformer
Prevents route parameters from appearing in request bodies:Key Features
Modern UI
Clean, responsive design built with modern web standards
Fast Performance
Optimized for speed and smooth interactions
Code Generation
Generate client code in multiple languages
Dark Mode
Built-in dark mode support
Module Settings
Authentication
Configure the Scalar security schemeOptions:
None- No authenticationBearer- JWT Bearer token authenticationImplicit- OAuth 2.0 Implicit flow
Use Fully Qualified Schema Identifiers
Use fully qualified type names for schema identifiersExample:
true:MyApp.Api.Dtos.ProductDtofalse:ProductDto
Accessing Scalar UI
Once configured, access the Scalar documentation at:Scalar vs Swagger UI
| Feature | Scalar | Swagger UI |
|---|---|---|
| Performance | Faster, more responsive | Standard performance |
| UI/UX | Modern, clean design | Traditional interface |
| Dark Mode | Built-in | Requires customization |
| Code Generation | Multiple languages with better UX | Basic code samples |
| Request Testing | Enhanced with history | Standard functionality |
| Learning Curve | Intuitive | Familiar to most developers |
| Customization | Modern theming options | Extensive but dated |
Authentication Configuration
When authentication is configured, Scalar provides a streamlined auth experience:Bearer Token
OAuth 2.0 Implicit Flow
Customizing Scalar
Configure Scalar’s appearance and behavior:Code Generation
Scalar provides enhanced code generation for multiple languages:- C# HttpClient
- JavaScript Fetch
- cURL
Request History
Scalar maintains a history of API requests made through the UI:- View previous requests
- Replay requests with one click
- Edit and resend modified requests
- Export request collections
Migration from Swagger UI
To migrate from Swashbuckle to Scalar:XML Documentation
Scalar automatically includes XML documentation comments:Installation
Dependencies
Intent.Common.CSharpIntent.OutputManager.RoslynWeaver
Browser Support
Scalar works in all modern browsers:- Chrome/Edge (latest)
- Firefox (latest)
- Safari (latest)
Next Steps
Controllers
Generate well-documented controllers
Versioning
Document multiple API versions
Security
Add authentication to your API
Swashbuckle
Compare with traditional Swagger UI
