私は、ASP.NET Core Web APIでスワッガーUIをカスタマイズしようとしています。私はこれらのチュートリアル以下のよCutomize Swagger UI ASP.NETコアWeb API
:
- https://docs.microsoft.com/en-us/aspnet/core/tutorials/web-api-help-pages-using-swagger?tabs=visual-studio
- https://github.com/swagger-api/swagger-ui
これはStartup.csある
は、私はこのようなUIがしたいです設定:
// Add the detail information for the API.
services.ConfigureSwaggerGen(options =>
{
// Determine base path for the application.
var basePath = _env.WebRootPath;
// Complete path
var xmlPath = Path.Combine(basePath, "myapi.xml");
// Set the comments path for the swagger json and ui.
options.IncludeXmlComments(xmlPath);
});
app.UseStaticFiles();
// Enable middleware to serve generated Swagger as a JSON endpoint
app.UseSwagger();
// Enable middleware to serve swagger-ui assets (HTML, JS, CSS etc.)
app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "MyAPI");
});
私はすでにgitリポジトリから闊歩UIのファイルをダウンロードし、このように私のプロジェクトの上に置く:
私はこれを行うには正しいことであれば知っているが、私はありませんスワッガーUIの変更を見ることができません。
'index.html'ファイルに、あなたのCSSを参照していますか?また、 'http:// localhost:/swagger/ui/index.html'をブラウズし、最上部の入力ボックスに' http:// localhost:/swagger/v1/swagger.json'を入力してください。レンダリングされたページ? –
それは問題です。そのindex.htmlページは呼び出されません。 – perozzo
「index.htmlページは呼び出されていません」ということはどういう意味ですか?あなたはそれが正しく提供されていることを確認するためにそれを参照しようとしましたか? –