Refinitiv · API Governance Rules

Refinitiv API Rules

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

8 Rules error 1 warn 5 info 2
View Rules File View on GitHub

Rule Categories

channel message no operation payload security server

Rules

error
server-secure-protocol
Servers should use a secure protocol (this API's convention).
$.servers[*].protocol
warn
security-schemes-defined
Security schemes should be defined in components.
$.components
info
channel-key-casing
Channel names should be snake_case (the dominant convention in this API).
$.channels
warn
message-name-casing
Message names should be PascalCase (the dominant convention in this API).
$.components.messages
info
payload-property-casing
Message payload properties should be PascalCase (the dominant convention in this API).
$.components.schemas[*].properties
warn
operation-id-casing
Operation IDs should be camelCase (the dominant convention in this API).
$.channels[*][publish,subscribe].operationId
warn
message-payload-defined
Messages should define a payload schema (set on 100% of this API's messages).
$.components.messages[*]
warn
no-empty-descriptions
Descriptions must not be empty strings.
$..description

Spectral Ruleset

Raw ↑
# refinitiv — AsyncAPI Spectral ruleset (strengthened)
# Plain Spectral. Rules measured from this provider's own AsyncAPI event
# conventions by strengthen_asyncapi.py, then self-validated against the spec.
#
# Provenance:
#   - server-secure-protocol: 100% of servers already secure
#   - security-schemes: ['bearerToken']
#   - channel-key-casing: snake @ 50% (n=4)
#   - message-name-casing: pascal @ 100% (n=11)
#   - payload-property-casing: pascal @ 77% (n=39)
#   - operation-id-casing: camel @ 100% (n=8, v2)
#   - message-payload-defined: 100% adherence
extends:
  - spectral:asyncapi
rules:
  server-secure-protocol:
    description: Servers should use a secure protocol (this API's convention).
    severity: error
    given: $.servers[*].protocol
    then:
      function: pattern
      functionOptions:
        match: ^(amqps|https|ibmmq|jms|kafka-secure|mqtts|secure-mqtt|stomps|wss)$
  security-schemes-defined:
    description: Security schemes should be defined in components.
    severity: warn
    given: $.components
    then:
      field: securitySchemes
      function: truthy
  channel-key-casing:
    description: Channel names should be snake_case (the dominant convention in this API).
    severity: info
    given: $.channels
    then:
      field: '@key'
      function: casing
      functionOptions:
        type: snake
  message-name-casing:
    description: Message names should be PascalCase (the dominant convention in this API).
    severity: warn
    given: $.components.messages
    then:
      field: '@key'
      function: casing
      functionOptions:
        type: pascal
  payload-property-casing:
    description: Message payload properties should be PascalCase (the dominant convention in this API).
    severity: info
    given: $.components.schemas[*].properties
    then:
      field: '@key'
      function: pattern
      functionOptions:
        match: ^[A-Z][A-Za-z0-9]*$
  operation-id-casing:
    description: Operation IDs should be camelCase (the dominant convention in this API).
    severity: warn
    given: $.channels[*][publish,subscribe].operationId
    then:
      function: casing
      functionOptions:
        type: camel
  message-payload-defined:
    description: Messages should define a payload schema (set on 100% of this API's messages).
    severity: warn
    given: $.components.messages[*]
    then:
      field: payload
      function: truthy
  no-empty-descriptions:
    description: Descriptions must not be empty strings.
    severity: warn
    given: $..description
    then:
      function: truthy