Sportmonks · API Governance Rules

Sportmonks API Rules

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

9 Rules error 2 warn 6
View Rules File View on GitHub

Rule Categories

sportmonks

Rules

error
sportmonks-info-contact
Sportmonks API specs must declare a contact ([email protected]).
$.info
error
sportmonks-info-license
Sportmonks API specs must declare a license block.
$.info
warn
sportmonks-server-base-url
Sportmonks Football servers must point at the v3 base URL.
$.servers[*].url
warn
sportmonks-security-api-token
Sportmonks endpoints must accept the API token via Authorization header or api_token query.
$.components.securitySchemes
warn
sportmonks-operation-id-camel
operationId must be camelCase for consistency with Sportmonks endpoint naming.
$.paths[*][get,post,put,delete,patch].operationId
warn
sportmonks-operation-summary-title-case
operation summary should use Title Case.
$.paths[*][get,post,put,delete,patch].summary
warn
sportmonks-tag-defined
every operation must declare a tag.
$.paths[*][get,post,put,delete,patch]
warn
sportmonks-response-200-schema
200 responses must reference a schema (no untyped JSON).
$.paths[*][get,post,put,delete,patch].responses.200.content.application/json
hint
sportmonks-include-param-present
collection endpoints should accept the include parameter for relational embedding.
$.paths[?(@property.match(/^\\/(fixtures|leagues|teams|players|livescores|standings)/))].get.parameters

Spectral Ruleset

Raw ↑
extends:
  - spectral:oas
documentationUrl: https://docs.sportmonks.com/
rules:
  sportmonks-info-contact:
    description: Sportmonks API specs must declare a contact ([email protected]).
    message: "info.contact is required"
    severity: error
    given: $.info
    then:
      field: contact
      function: truthy

  sportmonks-info-license:
    description: Sportmonks API specs must declare a license block.
    message: "info.license is required"
    severity: error
    given: $.info
    then:
      field: license
      function: truthy

  sportmonks-server-base-url:
    description: Sportmonks Football servers must point at the v3 base URL.
    message: "server URL should be https://api.sportmonks.com/v3/football"
    severity: warn
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: "^https://(api|cricket)\\.sportmonks\\.com(/api)?/(v3|v2\\.0)"

  sportmonks-security-api-token:
    description: Sportmonks endpoints must accept the API token via Authorization header or api_token query.
    message: "security must reference ApiTokenHeader or ApiTokenQuery"
    severity: warn
    given: $.components.securitySchemes
    then:
      function: truthy

  sportmonks-operation-id-camel:
    description: operationId must be camelCase for consistency with Sportmonks endpoint naming.
    message: "operationId '{{value}}' should be camelCase"
    severity: warn
    given: $.paths[*][get,post,put,delete,patch].operationId
    then:
      function: pattern
      functionOptions:
        match: "^[a-z][a-zA-Z0-9]+$"

  sportmonks-operation-summary-title-case:
    description: operation summary should use Title Case.
    message: "summary '{{value}}' should be Title Case"
    severity: warn
    given: $.paths[*][get,post,put,delete,patch].summary
    then:
      function: pattern
      functionOptions:
        match: "^([A-Z][A-Za-z0-9]*)( [A-Z][A-Za-z0-9]*)*( By [A-Z][A-Za-z0-9]*)?$"

  sportmonks-tag-defined:
    description: every operation must declare a tag.
    message: "operation must have at least one tag"
    severity: warn
    given: $.paths[*][get,post,put,delete,patch]
    then:
      field: tags
      function: truthy

  sportmonks-response-200-schema:
    description: 200 responses must reference a schema (no untyped JSON).
    message: "response 200 must have a schema"
    severity: warn
    given: $.paths[*][get,post,put,delete,patch].responses.200.content.application/json
    then:
      field: schema
      function: truthy

  sportmonks-include-param-present:
    description: collection endpoints should accept the include parameter for relational embedding.
    message: "consider supporting the 'include' query parameter on collection endpoints"
    severity: hint
    given: $.paths[?(@property.match(/^\\/(fixtures|leagues|teams|players|livescores|standings)/))].get.parameters
    then:
      function: truthy