Last active
January 30, 2025 08:40
-
-
Save dj-nitehawk/c7052f01f3f650e67fb6782c84d3b5f0 to your computer and use it in GitHub Desktop.
API Visualization with Scalar
This file contains 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
using Scalar.AspNetCore; //dotnet add package Scalar.AspNetCore | |
var bld = WebApplication.CreateBuilder(args); | |
bld.Services | |
.AddFastEndpoints() | |
.SwaggerDocument(); //define a swagger doc - v1 by default | |
var app = bld.Build(); | |
app.UseFastEndpoints(); | |
if (app.Environment.IsDevelopment()) | |
{ | |
//scalar by default looks for the swagger json file here: | |
app.UseOpenApi(c => c.Path = "/openapi/{documentName}.json"); | |
app.MapScalarApiReference(); | |
} | |
app.Run(); | |
//scalar ui can be accessed at: http://localhost:{port}/scalar/v1 |
@mkosucu
that has nothing to do with scalar. pls refer to the following docs:
schema names: https://fast-endpoints.com/docs/swagger-support#short-schema-names
endpoint names: https://fast-endpoints.com/docs/swagger-support#short-endpoint-names
I have been looking somewhere completely irrelevant! Many thanks for your help @dj-nitehawk . Appreciated.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If I use this approach, the Model names include namespaces too, i.e.
ScalartestMyRequest
I tried multiple ways, but could not transform the model names, expected nameMyRequest
, Do you have any idea how to resolve this? @dj-nitehawk