The Movie Database · API Governance Rules

The Movie Database API Rules

Spectral linting rules defining API design standards and conventions for The Movie Database.

10 Rules error 3 warn 7
View Rules File View on GitHub

Rule Categories

tmdb

Rules

error
tmdb-operations-must-have-operationid
All TMDB API operations must define an operationId for client SDK generation.
$.paths[*][*]
warn
tmdb-operations-must-have-summary
All operations must have a summary.
$.paths[*][*]
error
tmdb-responses-must-include-200
All read operations must define a 200 success response.
$.paths[*][get].responses
warn
tmdb-responses-must-include-401
All write operations must document 401 Unauthorized.
$.paths[*][post].responses
warn
tmdb-language-param-must-have-description
The language parameter must have a description indicating ISO 639-1 format.
$.paths[*][*].parameters[?(@.name == 'language')]
error
tmdb-page-param-must-be-integer
The page parameter must be an integer type.
$.paths[*][*].parameters[?(@.name == 'page')].schema
warn
tmdb-path-id-params-must-be-integer
Path parameters ending in _id (movie_id, series_id, person_id) must be integer type.
$.paths[*][*].parameters[?(@.in == 'path' && @.name =~ /.*_id$/)]
warn
tmdb-responses-define-json-content
200 responses must define application/json content.
$.paths[*][get].responses.200
warn
tmdb-info-must-have-contact
The API info object should include contact information.
$.info
warn
tmdb-parameters-must-have-descriptions
All parameters should have descriptions for clarity.
$.paths[*][*].parameters[*]

Spectral Ruleset

Raw ↑
extends: spectral:oas
rules:
  tmdb-operations-must-have-operationid:
    description: All TMDB API operations must define an operationId for client SDK generation.
    severity: error
    given: "$.paths[*][*]"
    then:
      field: operationId
      function: truthy

  tmdb-operations-must-have-summary:
    description: All operations must have a summary.
    severity: warn
    given: "$.paths[*][*]"
    then:
      field: summary
      function: truthy

  tmdb-responses-must-include-200:
    description: All read operations must define a 200 success response.
    severity: error
    given: "$.paths[*][get].responses"
    then:
      field: "200"
      function: truthy

  tmdb-responses-must-include-401:
    description: All write operations must document 401 Unauthorized.
    severity: warn
    given: "$.paths[*][post].responses"
    then:
      field: "401"
      function: truthy

  tmdb-language-param-must-have-description:
    description: The language parameter must have a description indicating ISO 639-1 format.
    severity: warn
    given: "$.paths[*][*].parameters[?(@.name == 'language')]"
    then:
      field: description
      function: truthy

  tmdb-page-param-must-be-integer:
    description: The page parameter must be an integer type.
    severity: error
    given: "$.paths[*][*].parameters[?(@.name == 'page')].schema"
    then:
      field: type
      function: enumeration
      functionOptions:
        values:
          - integer

  tmdb-path-id-params-must-be-integer:
    description: Path parameters ending in _id (movie_id, series_id, person_id) must be integer type.
    severity: warn
    given: "$.paths[*][*].parameters[?(@.in == 'path' && @.name =~ /.*_id$/)]"
    then:
      field: schema.type
      function: enumeration
      functionOptions:
        values:
          - integer

  tmdb-responses-define-json-content:
    description: 200 responses must define application/json content.
    severity: warn
    given: "$.paths[*][get].responses.200"
    then:
      field: content
      function: truthy

  tmdb-info-must-have-contact:
    description: The API info object should include contact information.
    severity: warn
    given: "$.info"
    then:
      field: contact
      function: truthy

  tmdb-parameters-must-have-descriptions:
    description: All parameters should have descriptions for clarity.
    severity: warn
    given: "$.paths[*][*].parameters[*]"
    then:
      field: description
      function: truthy