Header Names Hyphenated Pascal Case

header-names-hyphenated-pascal-case

info experience: namingexperience: consistency spec: parametersspec: headers

'HTTP' headers MUST follow 'Hyphenated-Pascal-Case' notation

All HTTP headers MUST use Hyphenated-Pascal-Case notation.

Rule definition

The full Spotlight rule — drop it into a ruleset (.spotlight.yaml / .spectral.yaml) and run it with any Spotlight tool.

header-names-hyphenated-pascal-case:
  title: Header Names Hyphenated Pascal Case
  reference: https://spotlight-rules.com/spec/rules/openapi/header-names-hyphenated-pascal-case/
  description: All `HTTP` headers MUST use `Hyphenated-Pascal-Case` notation.
  message: "'HTTP' headers MUST follow 'Hyphenated-Pascal-Case' notation"
  severity: info
  given: $..parameters[?(@.in == 'header')].name
  then:
    function: pattern
    functionOptions:
      match: /^([A-Z][a-z0-9]-)*([A-Z][a-z0-9])+/
  tags:
    - format:openapi
    - spec:parameters
    - spec:headers
    - experience:naming
    - experience:consistency
  prompt: "You are editing an OpenAPI document to satisfy the Spotlight API
    governance rule 'header-names-hyphenated-pascal-case' (Header Names
    Hyphenated Pascal Case). Requirement: All `HTTP` headers MUST use
    `Hyphenated-Pascal-Case` notation. To fix: Ensure the targeted value matches
    the regular expression `/^([A-Z][a-z0-9]-)*([A-Z][a-z0-9])+/`; rewrite any
    value that does not. This rule is evaluated at the JSONPath
    `$..parameters[?(@.in == 'header')].name` — inspect every location it
    matches and correct only what violates the rule. Make the smallest change
    that satisfies the rule, leave all unrelated content, key order, comments,
    and formatting unchanged, and keep the document valid OpenAPI. Return only
    the complete corrected document, with no commentary."
AI fix prompt — send this to Claude, Gemini, or ChatGPT with your artifact to auto-fix this rule
You are editing an OpenAPI document to satisfy the Spotlight API governance rule 'header-names-hyphenated-pascal-case' (Header Names Hyphenated Pascal Case). Requirement: All `HTTP` headers MUST use `Hyphenated-Pascal-Case` notation. To fix: Ensure the targeted value matches the regular expression `/^([A-Z][a-z0-9]-)*([A-Z][a-z0-9])+/`; rewrite any value that does not. This rule is evaluated at the JSONPath `$..parameters[?(@.in == 'header')].name` — inspect every location it matches and correct only what violates the rule. Make the smallest change that satisfies the rule, leave all unrelated content, key order, comments, and formatting unchanged, and keep the document valid OpenAPI. Return only the complete corrected document, with no commentary.
ArtifactOpenAPI
Applies at (given)$..parameters[?(@.in == 'header')].name
Severityinfo — educational by default; raise to warn/error to enforce
Referencehttps://spotlight-rules.com/spec/rules/openapi/header-names-hyphenated-pascal-case/