Refinitiv · API Governance Rules

Refinitiv API Rules

Spectral linting rules defining API design standards and conventions for Refinitiv.

7 Rules error 2 warn 4 info 1
View Rules File View on GitHub

Rule Categories

refinitiv

Rules

warn
refinitiv-operation-summary-title-case
All operation summaries must use Title Case.
$.paths[*][*].summary
warn
refinitiv-operation-id-camel-case
OperationIds must use camelCase.
$.paths[*][*].operationId
warn
refinitiv-tags-defined
All operations must include at least one tag.
$.paths[*][*]
error
refinitiv-servers-defined
API must define at least one server.
$
error
refinitiv-response-success-defined
All operations must define at least one success (2xx) response.
$.paths[*][*].responses
warn
refinitiv-info-contact
API info must include a contact object.
$.info
info
refinitiv-schema-descriptions
All schema properties should have descriptions.
$.components.schemas[*].properties[*]

Spectral Ruleset

Raw ↑
extends: spectral:oas
rules:
  refinitiv-operation-summary-title-case:
    description: All operation summaries must use Title Case.
    message: "Operation summary '{{value}}' must use Title Case."
    severity: warn
    given: "$.paths[*][*].summary"
    then:
      function: pattern
      functionOptions:
        match: "^[A-Z][a-zA-Z0-9 '\\-]*$"

  refinitiv-operation-id-camel-case:
    description: OperationIds must use camelCase.
    message: "OperationId '{{value}}' must use camelCase."
    severity: warn
    given: "$.paths[*][*].operationId"
    then:
      function: pattern
      functionOptions:
        match: "^[a-z][a-zA-Z0-9]*$"

  refinitiv-tags-defined:
    description: All operations must include at least one tag.
    message: "Operation must include at least one tag."
    severity: warn
    given: "$.paths[*][*]"
    then:
      field: tags
      function: truthy

  refinitiv-servers-defined:
    description: API must define at least one server.
    message: "API must have at least one server defined."
    severity: error
    given: "$"
    then:
      field: servers
      function: truthy

  refinitiv-response-success-defined:
    description: All operations must define at least one success (2xx) response.
    message: "Operation must define a success response."
    severity: error
    given: "$.paths[*][*].responses"
    then:
      function: schema
      functionOptions:
        schema:
          anyOf:
            - required: ["200"]
            - required: ["201"]
            - required: ["202"]
            - required: ["204"]

  refinitiv-info-contact:
    description: API info must include a contact object.
    message: "API info.contact must be defined."
    severity: warn
    given: "$.info"
    then:
      field: contact
      function: defined

  refinitiv-schema-descriptions:
    description: All schema properties should have descriptions.
    message: "Schema property should have a description."
    severity: info
    given: "$.components.schemas[*].properties[*]"
    then:
      field: description
      function: defined