スキル一覧に戻る
Mcafee123

swagger

by Mcafee123

0🍴 0📅 2026年1月10日
GitHubで見るManusで実行

SKILL.md


name: swagger description: Configure Swagger/OpenAPI documentation for affolterNET.Web.Api. Use when setting up API documentation, customizing Swagger UI, or configuring OpenAPI metadata.

Swagger/OpenAPI Configuration

Configure Swagger/OpenAPI documentation for your API.

For complete reference, see Library Guide.

Quick Start

appsettings.json

{
  "affolterNET": {
    "Web": {
      "Swagger": {
        "Enabled": true,
        "Title": "My API",
        "Version": "v1",
        "Description": "API documentation for My Application"
      }
    }
  }
}

Configuration Options

SwaggerOptions

PropertyTypeDefaultDescription
Enabledbooltrue (dev)Enable Swagger UI and endpoint
Titlestring"API"API title in Swagger UI
Versionstring"v1"API version
DescriptionstringnullAPI description
RoutePrefixstring"swagger"URL prefix for Swagger UI

Common Patterns

Development Only

{
  "affolterNET": {
    "Web": {
      "Swagger": {
        "Enabled": true
      }
    }
  }
}

In production, set Enabled to false or remove the configuration.

Custom Route

{
  "affolterNET": {
    "Web": {
      "Swagger": {
        "Enabled": true,
        "RoutePrefix": "api-docs"
      }
    }
  }
}

Access at: https://your-api.com/api-docs

With Authentication

When authentication is enabled, Swagger UI will include the authorization header configuration for testing authenticated endpoints.

Controller Documentation

Use XML comments for API documentation:

/// <summary>
/// Gets all users
/// </summary>
/// <returns>List of users</returns>
/// <response code="200">Returns the list of users</response>
/// <response code="401">Unauthorized</response>
[HttpGet]
[ProducesResponseType(typeof(List<User>), 200)]
[ProducesResponseType(401)]
public IActionResult GetUsers() { ... }

Enable XML documentation in your .csproj:

<PropertyGroup>
  <GenerateDocumentationFile>true</GenerateDocumentationFile>
  <NoWarn>$(NoWarn);1591</NoWarn>
</PropertyGroup>

Troubleshooting

Swagger UI not loading

  • Verify Enabled is true in configuration
  • Check the RoutePrefix matches your expected URL
  • Ensure no middleware is blocking the Swagger routes

Missing endpoints

  • Confirm controllers are properly registered
  • Check that routes are correctly attributed
  • Verify authorization doesn't block discovery

スコア

総合スコア

50/100

リポジトリの品質指標に基づく評価

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

0/10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

レビュー

💬

レビュー機能は近日公開予定です