Loading...
Loading...
Configures Swagger/OpenAPI documentation
npx skill4agent add levnikolaevich/claude-code-skills ln-775-api-docs-generator| Aspect | Details |
|---|---|
| Input | Context Store from ln-770 |
| Output | Swagger/OpenAPI configuration |
| Stacks | .NET (Swashbuckle), Python (FastAPI built-in) |
STACKPROJECT_ROOTAddSwaggerGenUseSwagger{ "status": "skipped" }MCP ref: "Swashbuckle ASP.NET Core OpenAPI Swagger configuration"
Context7: /domaindrivendev/Swashbuckle.AspNetCoreMCP ref: "FastAPI OpenAPI documentation customization"
Context7: /tiangolo/fastapi| Field | Description | Required |
|---|---|---|
| Title | API name | ✓ Yes |
| Version | API version (v1, v2) | ✓ Yes |
| Description | Brief description | Optional |
| Contact | Support contact | Optional |
| License | API license | Optional |
| Scheme | Use Case | OpenAPI Type |
|---|---|---|
| JWT Bearer (Recommended) | Token in Authorization header | |
| API Key | Key in header or query | |
| OAuth2 | Full OAuth2 flow | |
| None | Public API | No security |
| Feature | .NET | Python | Default |
|---|---|---|---|
| XML Comments | ✓ Supported | N/A | ✓ Enable |
| Response Examples | ✓ Manual | ✓ Pydantic | ✓ Enable |
| Request Validation | ✓ Annotations | ✓ Pydantic | ✓ Enable |
| Try It Out | ✓ Yes | ✓ Yes | ✓ Enable |
| File | Purpose |
|---|---|
| Swagger service registration |
| Enable XML documentation |
Swashbuckle.AspNetCorebuilder.Services.AddSwaggerServices();
// ...
app.UseSwaggerServices();<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);1591</NoWarn>
</PropertyGroup>| File | Purpose |
|---|---|
| OpenAPI customization |
from core.openapi_config import custom_openapi
app.openapi = lambda: custom_openapi(app)dotnet build --no-restorepython -m py_compile core/openapi_config.py| Stack | URL |
|---|---|
| .NET | http://localhost:5000/swagger |
| Python | http://localhost:5000/docs |
| Python (ReDoc) | http://localhost:5000/redoc |
# .NET
curl http://localhost:5000/swagger/v1/swagger.json | jq .
# Python
curl http://localhost:5000/openapi.json | jq .// Structure only - actual code generated via MCP ref
options.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme
{
Description = "JWT Authorization header using Bearer scheme",
Name = "Authorization",
In = ParameterLocation.Header,
Type = SecuritySchemeType.Http,
Scheme = "bearer",
BearerFormat = "JWT"
});# Structure only - actual code generated via MCP ref
from fastapi.security import HTTPBearer
security = HTTPBearer(){
"status": "success",
"files_created": [
"Extensions/SwaggerExtensions.cs"
],
"packages_added": [
"Swashbuckle.AspNetCore"
],
"registration_code": "builder.Services.AddSwaggerServices();",
"message": "Configured Swagger/OpenAPI documentation"
}