-
Notifications
You must be signed in to change notification settings - Fork 32
Description
Problem description
CAMARA_common.yaml contains {{SPECIFIC_CODE}} and {{field}} placeholder patterns in Generic error responses. These are useful as documentation for API developers but make the file unparseable as a $ref target:
- YAML parsers treat placeholders as literal string values, producing invalid enum entries
- Spectral and other OpenAPI linting tools flag them
- Bundling tools that resolve
$refwould propagate placeholder strings into API specs
This blocks the move toward $ref-based consumption of common schemas (#577) and the bundling model proposed in ReleaseManagement#436.
Possible evolution
Comment out the placeholder lines (~30 lines across the file) instead of deleting them:
# Before:
code:
enum:
- INVALID_ARGUMENT
- OUT_OF_RANGE
- "{{SPECIFIC_CODE}}"
# After:
code:
enum:
- INVALID_ARGUMENT
- OUT_OF_RANGE
# - "{{SPECIFIC_CODE}}" — API-specific codes added by each APIThis affects three types of placeholder occurrences:
- Enum values —
- "{{SPECIFIC_CODE}}"incodeenums (5 responses) - Example blocks —
GENERIC_4xx_{{SPECIFIC_CODE}}:example entries with their value blocks (5 responses) - Example message —
"{{field}} is not consistent with access token."(1 occurrence in Generic403)
Benefits:
- YAML parsers, bundling tools, and Spectral ignore comments — the file becomes directly consumable via
$ref - Human readers still see the placeholder patterns as documentation
- Minimal change, no structural refactoring needed
- API-specific error code extension patterns (allOf, property override, etc.) remain a separate topic
Alternative solution
Delete the placeholder lines entirely. This also makes the file consumable but loses the documentation value for API developers who read the source file.
Additional context
- Discussion and consensus in Establish guidance for consuming schemas from CAMARA_common.yaml #577 (comment)
- Bundling design document: ReleaseManagement#436 (section 8.1)
- Validation framework umbrella: ReleaseManagement#448
Thanks and credits to @rartych for the idea and testing it in a PoC.