The problem
Undocumented security schemes prevent client code generators and automated testing tools from configuring authentication headers properly.
AvoidThe anti-pattern
YAMLbad-pattern.yaml
paths:
/v1/protected-data:
get:
summary: Protected endpointNo components.securitySchemes defined; endpoints lack authorization requirements.
PreferThe refactored version
YAMLgood-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: JWTExplicit Bearer JWT securityScheme attached to globally or operationally scoped security blocks.
How APIForge checks this
- Checks for global and path security requirement declarations
- Validates securityScheme component configurations