Skip to content

Comment out placeholders in CAMARA_common.yaml for $ref consumption #601

@hdamker

Description

@hdamker

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 $ref would 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 API

This affects three types of placeholder occurrences:

  1. Enum values- "{{SPECIFIC_CODE}}" in code enums (5 responses)
  2. Example blocksGENERIC_4xx_{{SPECIFIC_CODE}}: example entries with their value blocks (5 responses)
  3. 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

Thanks and credits to @rartych for the idea and testing it in a PoC.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions