Info Require Openapi Version 3x

info-require-openapi-version-3x

info experience: versioningexperience: governance spec: document

OpenAPI MUST Be Version 3.x

APIs should use OpenAPI 3.x specification. Analysis of 773 API specs shows 97% use OpenAPI 3.x, with 86% on 3.1.0, making it the dominant standard for modern API definitions.

Rule definition

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

info-require-openapi-version-3x:
  title: Info Require Openapi Version 3x
  reference: https://spotlight-rules.com/spec/rules/openapi/info-require-openapi-version-3x/
  description: APIs should use OpenAPI 3.x specification. Analysis of 773 API
    specs shows 97% use OpenAPI 3.x, with 86% on 3.1.0, making it the dominant
    standard for modern API definitions.
  message: OpenAPI MUST Be Version 3.x
  severity: info
  given: $
  then:
    field: openapi
    function: pattern
    functionOptions:
      match: ^3\.
  tags:
    - format:openapi
    - spec:document
    - experience:versioning
    - experience:governance
  prompt: "You are editing an OpenAPI document to satisfy the Spotlight API
    governance rule 'info-require-openapi-version-3x' (Info Require Openapi
    Version 3x). Requirement: APIs should use OpenAPI 3.x specification.
    Analysis of 773 API specs shows 97% use OpenAPI 3.x, with 86% on 3.1.0,
    making it the dominant standard for modern API definitions. To fix: Ensure
    `openapi` matches the regular expression `^3\\.`; rewrite any value that
    does not. 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 'info-require-openapi-version-3x' (Info Require Openapi Version 3x). Requirement: APIs should use OpenAPI 3.x specification. Analysis of 773 API specs shows 97% use OpenAPI 3.x, with 86% on 3.1.0, making it the dominant standard for modern API definitions. To fix: Ensure `openapi` matches the regular expression `^3\.`; rewrite any value that does not. 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)$
Severityinfo — educational by default; raise to warn/error to enforce
Referencehttps://spotlight-rules.com/spec/rules/openapi/info-require-openapi-version-3x/