Problem Statement
Undocumented security schemes prevent client code generators and automated testing tools from configuring authentication headers properly.
❌ Anti-Pattern / Bad Implementation
No components.securitySchemes defined; endpoints lack authorization requirements.
bad-pattern.yaml
paths:
/v1/protected-data:
get:
summary: Protected endpoint✓ Refactored / Recommended Implementation
Explicit Bearer JWT securityScheme attached to globally or operationally scoped security blocks.
good-pattern.yaml
openapi: 3.0.3
paths:
/v1/protected-data:
get:
summary: Protected data resource
security:
- BearerAuth: []
responses:
'200':
description: Success
'401':
description: Unauthorized
components:
securitySchemes:
BearerAuth:
type: http
scheme: bearer
bearerFormat: JWTHow APIForge Checks This
- Checks for global and path security requirement declarations
- Validates securityScheme component configurations
