ln-775-api-docs-generator
L3 Worker - Configures Swagger/OpenAPI documentation
Main Workflow
stateDiagram-v2
[*] --> ReceiveContext: Start
ReceiveContext --> IdempotencyCheck: Context Valid
IdempotencyCheck --> Skip: Swagger Already Configured
IdempotencyCheck --> AnalyzeAPI: Not Configured
AnalyzeAPI --> Research: API Structure Known
Research --> DecisionPoints: Patterns Loaded
DecisionPoints --> Generate: Configuration Decided
Generate --> Validate: Files Generated
Validate --> Return: Success
Skip --> Return: Status = skipped
Return --> [*]: Complete
state AnalyzeAPI {
[*] --> ScanControllers
ScanControllers --> DetectAuth
DetectAuth --> CheckVersioning
CheckVersioning --> [*]
}
Stack-Specific Documentation
flowchart TD
Stack{Technology Stack?}
Stack -->|.NET| DotNet[Swashbuckle]
Stack -->|Python| Python[FastAPI Built-in]
DotNet --> DotNetUI[/swagger]
Python --> PythonUI[/docs]
Python --> ReDoc[/redoc]
subgraph DotNetFeatures[".NET Features"]
XMLComments[XML Comments]
SwaggerGen[SwaggerGen]
SecurityDef[Security Definition]
end
subgraph PythonFeatures["Python Features"]
Pydantic[Pydantic Models]
AutoSchema[Auto Schema]
CustomOpenAPI[Custom OpenAPI]
end
DotNet --> DotNetFeatures
Python --> PythonFeatures
classDef dotnet fill:#512BD4,color:white
classDef python fill:#3776AB,color:white
class DotNet,DotNetUI,XMLComments,SwaggerGen,SecurityDef dotnet
class Python,PythonUI,ReDoc,Pydantic,AutoSchema,CustomOpenAPI python
Security Scheme Configuration
flowchart LR
Auth{Authentication Type?}
Auth -->|JWT Bearer| JWT[HTTP Bearer]
Auth -->|API Key| APIKey[API Key Header]
Auth -->|OAuth2| OAuth[OAuth2 Flows]
Auth -->|None| NoAuth[Public API]
JWT --> JWTConfig["Type: http
Scheme: bearer
BearerFormat: JWT"]
APIKey --> APIKeyConfig["Type: apiKey
In: header
Name: X-API-Key"]
OAuth --> OAuthConfig["Type: oauth2
Flows: authorizationCode
Scopes: read, write"]
NoAuth --> NoAuthConfig["No Security
Definition"]
classDef security fill:#FFD700
class JWTConfig,APIKeyConfig,OAuthConfig,NoAuthConfig security
OpenAPI Specification Structure
flowchart TD
OpenAPI[OpenAPI 3.0 Spec]
OpenAPI --> Info[info]
OpenAPI --> Servers[servers]
OpenAPI --> Paths[paths]
OpenAPI --> Components[components]
OpenAPI --> Security[security]
subgraph Info
Title["title: API Name"]
Version["version: v1"]
Description["description: API Docs"]
end
subgraph Paths
GET["/api/users GET"]
POST["/api/users POST"]
PUT["/api/users/{id} PUT"]
DELETE["/api/users/{id} DELETE"]
end
subgraph Components
Schemas["schemas: Data Models"]
SecuritySchemes["securitySchemes: Auth"]
Responses["responses: Common"]
end
classDef spec fill:#87CEEB
class OpenAPI,Info,Servers,Paths,Components,Security spec
Documentation Access Points
flowchart LR
subgraph DotNetAccess[".NET Access"]
SwaggerUI["http://localhost:5000/swagger"]
SwaggerJSON["http://localhost:5000/swagger/v1/swagger.json"]
end
subgraph PythonAccess["Python Access"]
FastAPIDocs["http://localhost:5000/docs"]
FastAPIReDoc["http://localhost:5000/redoc"]
OpenAPIJSON["http://localhost:5000/openapi.json"]
end
Browser([Browser]) --> DotNetAccess
Browser --> PythonAccess
classDef endpoint fill:#90EE90
class SwaggerUI,SwaggerJSON,FastAPIDocs,FastAPIReDoc,OpenAPIJSON endpoint