IMDb-API · API Governance Rules

IMDb-API API Rules

Spectral linting rules defining API design standards and conventions for IMDb-API.

7 Rules error 2 warn 5
View Rules File View on GitHub

Rule Categories

imdb

Rules

error
imdb-api-operation-id-camelcase
All operationIds MUST be camelCase (e.g. getTitle, searchMovie).
$.paths.*.*
warn
imdb-api-summary-title-case
Operation summaries MUST use Title Case.
$.paths.*.*.summary
warn
imdb-api-paths-versioned-via-language
Public paths MUST start with a two-letter language path segment or the /API/ shared root for tools.
$.paths
warn
imdb-api-apikey-in-path
Endpoints that require an API key MUST take it as a path or query parameter named apiKey.
$.paths..parameters[?(@.required==true)]
warn
imdb-api-tt-id-pattern
IMDb title id parameters MUST validate against ^tt\\d+$.
$.paths..parameters[?(@.name=='id' && @.in=='path')]
error
imdb-api-no-empty-tags
Operations MUST be tagged.
$.paths.*.*
warn
imdb-api-info-contact
info.contact MUST be present so consumers know who maintains the service.
$.info

Spectral Ruleset

Raw ↑
extends: [[spectral:oas, all]]
documentationUrl: https://tv-api.com/api
rules:
  imdb-api-operation-id-camelcase:
    description: All operationIds MUST be camelCase (e.g. getTitle, searchMovie).
    severity: error
    given: $.paths.*.*
    then:
      field: operationId
      function: pattern
      functionOptions:
        match: '^[a-z][a-zA-Z0-9]+$'
  imdb-api-summary-title-case:
    description: Operation summaries MUST use Title Case.
    severity: warn
    given: $.paths.*.*.summary
    then:
      function: pattern
      functionOptions:
        match: '^([A-Z][a-zA-Z0-9]*)([\\s\\-][A-Z0-9a-z][a-zA-Z0-9]*)*$'
  imdb-api-paths-versioned-via-language:
    description: Public paths MUST start with a two-letter language path segment or the /API/ shared root for tools.
    severity: warn
    given: $.paths
    then:
      field: '@key'
      function: pattern
      functionOptions:
        match: '^/(\\{lang\\}/API/|API/)'
  imdb-api-apikey-in-path:
    description: Endpoints that require an API key MUST take it as a path or query parameter named apiKey.
    severity: warn
    given: $.paths..parameters[?(@.required==true)]
    then:
      field: name
      function: truthy
  imdb-api-tt-id-pattern:
    description: IMDb title id parameters MUST validate against ^tt\\d+$.
    severity: warn
    given: $.paths..parameters[?(@.name=='id' && @.in=='path')]
    then:
      field: schema.pattern
      function: truthy
  imdb-api-no-empty-tags:
    description: Operations MUST be tagged.
    severity: error
    given: $.paths.*.*
    then:
      field: tags
      function: truthy
  imdb-api-info-contact:
    description: info.contact MUST be present so consumers know who maintains the service.
    severity: warn
    given: $.info
    then:
      field: contact
      function: truthy